Pank: May 2004 Archives

dos2unix, unix2dos 用在 DOS <=> UNIX text file 轉換
DOS 格式 0d 0a
UNIX 格式 0a
有時手邊無此工具, 可用功能相同的指令組合
dos2unix:
sed -i "s/\r//" file
or
cat file | col -b > newfile
or
cat file | tr -d "\r" > newfile
cat file | tr -d "\015" > newfile

unix2dos:
sed -i "s/$/\r/" file
sed -i "s/$/\x0d/" file

以上適用 GNU sed, FreeBSD 下的 sed 不適用

GPART

user-pic
Vote 0 Votes

http://www.stud.uni-hannover.de/user/76201/gpart/

gpart - Guess PC-type hard disk partitions
Gpart is a tool which tries to guess the primary partition table of a PC-type hard disk in case the primary partition table in sector 0 is damaged, incorrect or deleted. The guessed table can be written to a file or device. Supported (guessable) filesystem or partition types:

DOS/Windows FAT (FAT 12/16/32)
Linux ext2
Linux swap partitions versions 0 and 1 (Linux >= v2.2.X)
OS/2 HPFS
Windows NT/2000 FS
*BSD disklabels
Solaris/x86 disklabels
Minix FS
Reiser FS
Linux LVM physical volume module (LVM by Heinz Mauelshagen)
SGI XFS on Linux
BeOS filesystem
QNX 4.x filesystem

所得稅

user-pic
Vote 0 Votes

速算公式:所得淨額*稅率-累進差額=應納稅額

所得淨額
稅率
累進差額
0~370,000 6% 0
370,001~990,000 13% 25,900
990,001~1,980,000 21% 105,100
1,980,001~3,720,000 30% 283,300
3,720,001以上 40% 655,300

while read i
do
   echo $i
done < file

和下列效果一樣
for i in `cat file`
do
   echo $i
done

php 條件式字串表示

user-pic
Vote 0 Votes

(expression?"string when expression=true":"string when expression=false");

ex.
echo ($a=="yes"?"YES":"NO");
當 $a = yes 時, 會秀出 YES, 否則會秀出 NO

Sasser remove tool

user-pic
Vote 0 Votes

mailmgr

user-pic
Vote 0 Votes

Mailmgr is a Sendmail Analisys Report Generator.

The html reports contain the following informations:
Username
messages sent
messages received
bytes sent
bytes received
Messages from with date, time and bytes per user
Messages to with date, time and bytes per user

WWW: http://sarg.sourceforge.net/

ref. http://home.so-net.net.tw/weithenn/freebsd_mailmgr.htm

zip tgz bz2 file header

user-pic
Vote 0 Votes

zip
50 4b 03 04 0a

tgz
1f 8b 08 00

bz2
42 5a 68 39 31 41 59 26 53 59 | BZh91AY&SY

skype, nice net phone

user-pic
Vote 0 Votes

早在去年九月就玩過此軟體, 但時當時用的人不多, 玩一下子就丟在一邊

直到最近 cpatch mailing list 在討論, 才又拿出來玩
幾天使用下來,真的很棒
download

我的 id 是 pankpan

md4

user-pic
Vote 0 Votes

openssl dgst -md4 {file}

WinConnect Server XP

user-pic
Vote 0 Votes

讓 Windows XP 支援多個 terminal service 連線
http://www.thinsoftinc.com/products_winconserver_info.html
download

各家 ISP 的 SMTP server

user-pic
Vote 0 Votes

hinet ms1.hinet.net, msa.hinet.net
seednet seed.net.tw, eagle.seed.net.tw
giga smtp.giga.net.tw
tfn smtp.tfn.net.tw
apol smtp.apol.net.tw
ttn smtp.ttn.net, smtp.ispeed.com.tw
so-net so-net.net.tw
sparqnet sparqnet.net
lsc smtp.lsc.net.tw

smb.conf lanman auth

user-pic
Vote 0 Votes

當 samba 有設密碼時
(security = user, encrypt passwords = yes, smb passwd file = smbpasswd)
這個參數要 yes, Windows 9x 才能連

lanman auth (G)
This parameter determines whether or not smbd will attempt to
authenticate users using the LANMAN password hash. If disabled,
only clients which support NT password hashes (e.g. Windows
NT/2000 clients, smbclient, etc... but not Windows 95/98 or the
MS DOS network client) will be able to connect to the Samba
host.

Default : lanman auth = yes

getopt example

user-pic
Vote 0 Votes

getopt 是 shell 裡抓參數的好工具
例: getopt abc:d: 容許參數 -a -b -c -d, -c and -d 後面要接參數

#!/bin/sh
set - `getopt abc:d: $*`
while true
do
case $1 in
-a)
echo option -a
shift
;;
-b)
echo option -b
shift
;;
-c)
echo option -c=$2
shift 2
;;
-d)
echo option -d=$2
shift 2
;;
--)
shift
break
;;
*)
echo "error!"
exit 1
;;
esac
done

執行結果
# ./go -a
option a
# ./go -c jack
option -c=jack
# ./go -b -c jack
option -b
option -c=jack
# ./go -b -c test -d
getopt: option requires an argument -- d
option -b
option -c=test
(使用後面要加參數的 option 會提示)
# ./go -b -c test -f
getopt: invalid option -- f
option -b
option -c=test
(使用未支援的參數會提示)

cd 個人目錄/.mozilla/設定檔名稱/
cd *
rm lock


cd /root/.thunderbird/default
cd 6srdw22r.slt
rm lock

Virtual PC

user-pic
Vote 0 Votes

http://www.winnetmag.com/Article/ArticleID/42032/42032.html

How can I assign a static IP address in Microsoft Virtual PC 2004 if I've selected the "Shared Networking (NAT)" networking option?

A. When you select the "Shared Networking (NAT)" option, Virtual PC 2004 clients by default obtains an IP address (in the 192.168.131.0/24 subnet) from the DHCP server that Virtual PC 2004 emulates. If you want to create a static IP address, you must use the following details:

IP address range: 192.168.131.175 - 192.168.131.200
Subnet mask: 255.255.255.0
Gateway: 192.168.131.254

http://www.kbalertz.com/Feedback_831516.aspx

Working with virtual network cards in Virtual PC 2004 isn't as hard as it seems. Inside of a guest OS, Virtual PC 2004 can virtualize up to four network cards. Each of these can be configured in one of three modes - you can mix and match to your heart's content:

Working with virtual network cards in Virtual PC 2004 isn't as hard as it seems.
Inside of a guest OS, Virtual PC 2004 can virtualize up to four network cards.
Each of these can be configured in one of three modes - you can mix and match to
your heart's content:

"Not Connected" - essentially, the virtual network card (NIC) will appear in the
guest OS, but it will be as if it's not connected to the network. Think of it
as having a physical PC with a network card, but no cable plugged in. Your
guest OS will not be able to communicate with anything over the network.

"Local Only" - the guest OS will only be able to communicate with other
Virtual PCs running on your host. It will not be able to communicate with the
host or the physical network that your host is connected to.
"" - this will essentially "bridge"
the guest's network card with the network card of your host that you select.
When in this mode, it will be as if the guest OS is connected to the network
just like your host PC is. It will get an IP address from a DHCP server if
there is one available, it will be able to access the Internet if you have an
Internet connection, etc. The guest OS will appear to all other machines on the
network as just-another-physical-PC. This is the most common configuration.
Important: Your Virtual PC will be on the network just like any other "real"
PC. This means you need to worry about nasty stuff like viruses and the
like. Always run anti-virus software in your guest operating system.

"Shared networking (NAT)" - the guest OS will share the network card in your
host PC in every way. It will "piggyback" on your connection using your IP
address, your MAC address, etc. This differs from the previous option in that
your guest OS will not get its own IP address and some machines on the network
may not be able to access services running on your guest OS.

(NAT 模式 guest PC 可以連外, 外面無法連 guest PC)

postfix canonical

user-pic
Vote 0 Votes

這個表格重寫 user@somesite 成 other@othesite

在 main.cf 加入 canonical_maps = hash:/etc/postfix/canonical

例一:將 alias name 重寫成 canonical name
test@mail.teco-ia.com.tw test@teco-ia.com.tw
(From: To: 均會重寫)
例二: 當成 forward 使用
test other@othesite

postmap /etc/postfix/canonical 更新 canonical.db
postfix reload 後生效

ref: http://www.laushu.idv.tw/apple/teach/mail_server/postfix_b.html

About this Archive

This page is an archive of recent entries written by Pank in May 2004.

Pank: April 2004 is the previous archive.

Pank: June 2004 is the next archive.

Find recent content on the main index or look in the archives to find all content.