2008-02-22

[Thunderbird] Send attachments as real attachments

There is an implicit setting in Thunderbird. It will treat the attachment with "inline" in the attribute of "Content-Disposition", which will trigger the attachment be showed in mail body when viewing.

There is a way to turn it off.

In Thunderbird,
Tools -> Options -> Advanced -> General -> Config Editor

Set the value of "mail.content_disposition_type" to 1

Now, it works.


BTW, I read Aaron Toponce's article to get this useful solution and you can find the article here.

2007-10-29

POSIX bracket expressions






































POSIXASCIIDescription
[:alnum:][A-Za-z0-9]Alphanumeric characters
[:alpha:][A-Za-z]Alphabetic characters
[:blank:][ \t]Space and tab
[:cntrl:][\x00-\x1F\x7F]Control characters
[:digit:][0-9]Digits
[:graph:][\x21-\x7E]Visible characters
[:lower:][a-z]Lowercase letters
[:print:][\x20-\x7E]Visible characters and spaces
[:punct:][!"#$%&'()*+,-./:;?@[\\\]_`{|}~]Punctuation characters
[:space:][ \t\r\n\v\f]Whitespace characters
[:upper:][A-Z]Uppercase letters
[:xdigit:][A-Fa-f0-9]Hexadecimal digits

2007-07-19

ssh-agent start up scritp

To activate ssh-agent when login, I put some scripts in my bash profile.

=> .bash_profile

#-------------------------------------------------------------------
SSH_ENV=${HOME}/.ssh/environment

function start_agent {
echo -n "Initialising new SSH agent..."
sleep 1
ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo "succeeded!"
source ${SSH_ENV}
ssh-add;
}

# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
source ${SSH_ENV}
#ps ${SSH_AGENT_PID} doesn't work under cygwin
( ps -ef | grep ${SSH_AGENT_PID} \
&& ps ux| grep ${SSH_AGENT_PID} ) \
> /dev/null || {

start_agent
}
else
start_agent
fi


=> .bash_logout

#-------------------------------------------------------------------
function quit_agent {
echo -n "Cleaning ssh-agent settins..."
sleep 1

ssh-add -D
ssh-agent -k > /dev/null 2>&1
unset SSH_AGENT_PID
unset SSH_AUTH_SOCK
echo "succeeded!"
sleep 1
}

if [ ${SSH_AGENT_PID+1} == 1 ]; then
echo -n "Quit ssh-agent? (No or Yes) "
while [ 1 ]; do
read ANS
case ${ANS} in
[Yy][Ee][Ss]|[Yy])
quit_agent
exit
;;
[Nn][Oo]|[Nn])
echo "ssh-agent will continue to serve!"
sleep 2
exit
;;
*)
echo -n "What do you mean? (No or Yes)"
;;
esac
done
fi

2007-01-26

FreeBSD under VMware, the time is delay

I found out my freebsd6.2 was complained about time is delayed.

After google, I found this post is useful, FreeBSD detects time via APIC.
You can set following line in /boot/loader.conf

hint.apic.0.disabled=1

Then reboot your FreeBSD, things will go to be different.

2006-12-21

Color under shell and C

剛剛看到一篇文章有關color的

在這邊

有時候還蠻有用的喔
只利用
\033作為escape
\033[0;31;47mChanged\033[0m
整個改變顏色



Changed

2006-12-07

C shell重導符號

>    redirect stdout to file
>>   redirect stdout to end of file
>&   redirect stdout and stderr to file
>>&  redirect stdout and stderr to end of file
>!   redirect stdout to file, even $noclobber has been set
>>!  redirect stdout to end of file, even $noclobber has been set
>&!  redirect stdout and stderr to file, even $noclobber has been set
>>&! redirect stdout and stderr to end of file, even $noclobber has been set

C shell裡頭的&&, ||

C shell 裡頭有兩個condition commands, 分別是&&以及||

&&指的是
當第一個指令執行成功就繼續執行第二個指令
且第一個指令執行失敗則第二個指令就不執行
ex.
mkdir work && touch work/file

||指的是
當第一個指令執行成功就不執行第二個指令
而第一個指令執行失敗就繼續執行第二個指令
ex.
mkdir work || echo "Create directory fail"

2006-12-04

awk的使用

目前需要寫幾個小東西, 之前看過awk的用法,想來很適合目前的工作
這邊有個找到的資料
希望派的上用場



AWK主要結構

Pattern { Actions }

Pattern: relational operation
>, <, >=, <=, ==, !=, ~, !~

Actions: I/O command, scenario control command
print, printf(), getline
if(...) {...} else {...}, while(...) {...}

if pattern is true, we do actions!



AWK欄位變數

$0  一字串,目前AWK讀入的資料列
$1  代表$0上第一個欄位的資料
$2  代表$0上第二個欄位的資料
$3  代表$0上第三個欄位的資料
...  ...



AWK內建變數


NF     表$0上讀入的欄位數目
NR     AWK已讀入的資料列數目
FILENAME AWK正在處理的資料檔名

UNIX命令列上, AWK的用法為
# awk '{print $1, $2, $3 * $4}' file.data

而符號 ' 是用來夾住pattern{actions}的, 另外, 若是程式太大需要寫在別的檔案裡頭,則
# awk -f program.awk file.data



AWK的Regular Expression

/... / 常用來包住Regexp
^ 表示該字串出現在字首 (ex. /^the/)
$ 表示該字串出現在字尾 (ex. /the$/)
. 表示為任一字元
* 表示為前字元出現重複次數的字元(ex. /a*/用來比對a不管有無出現或是出現多次的情況)
+ 表示為前字元出現一次以上的字元(ex. /a+/用來比對a至少出現一次以上)
? 表示為前字元不出現或是只出現一次(ex. /a?/用來比對a不出現或只出現一次)
\ 則為跳脫字元 (ex. /filename\.suf/)
[...] 表示為字元集合 (ex. [ab] 用來比對[a]或[b])
[..-..] 表示字元範圍 (ex. [0-5]用來比對[12345])
[^...] 表示字元的補集(ex. [^a]用來比對非[a]以外的字元)
(...) 用來括住一群字元成為一段字串(ex. /(ab)+/用來比對ab, abab, ababab等)
| 表示為判斷的或(ex. /os | apps/用來比對os, apps)

2006-11-15

2006-11-14

SSL Handshake Sequence

參考apache

Phase 1
Establish protocol version, session id, cipher suite, compression method
Exchange random values
01. => ClientHello
02. <= ServerHello

Phase 2
Optionally send server certificate and request client certificate
03. <= ServerCertificate
04. <= CertificateRequest
05. <= ServerHelloDone

Phase 3
Send client certificate response if requested
06. => ClientCertificate
07. => CertificateVerify

Phase 4
Change CipherSuite and finish handshake
08. => ChangeCipherSpec
09. => Finished
10. <= ChangeCipherSpec
11. <= Finished

2006-11-09

有關SSL and TLS

這幾天在翻SAML的東西,由於對於security的東西都不太熟悉,所以回頭看看SSL之類的資料

這邊找到一份舊資料有關製作SSL憑證作來參考 :-)

而想要認識SAML的人可以先參考這份overview

2005-06-30

Loop Device

剛剛看到一個不錯的東西Loop Device
看來可以在Linux上使用image檔案
倒是不知道在FreeBSD上可不可行

2005-02-24

剛剛去 FTP 上面挖東西

呼~~~一堆長輩們留下來的 script
超好用的
連 kernel 的設定也弄成 script 來幫助操作
太強大了!

sendmail + dnsbl + spamassassin

大概算是這陣子才對這些東西比較熟悉吧
過一陣子再多加上些統計的資料
然後就把一大堆 services 上線吧

太忙了 =.=+
不過也應該是我動作太慢的緣故吧

2005-02-02

Apache 的市佔率

Netcraft做了一份 200502 網頁伺服器市佔率的統計, 目前 apachehttpd 已經到達四千萬的數字, 市佔率達到69.95%, 感覺就很恐怖
同一時刻, Microsoft 的網頁伺服器市佔率也到達 22.68%

恩恩...看來我還是會繼續用 apache httpd

2005-02-01

第一篇 post

呵呵~~~來試試看這個 blog 的功能