2012年1月18日星期三

convert mkv to avi

for i in `ls *.mkv`; do ffmpeg -i $i -sameq -acodec copy -g 1 $i.avi; done

2011年8月1日星期一

what i learnt from my acl repair surgery

1. strengthen your quads way before the surgery, cos you'll lose muscles.
2. anesthesia is a must for the first 2 days, or the pain and spasm will kill you.
3. anesthesia is a bad mofo, keep you dumb for 10 days, dont do drugs.

2011年5月9日星期一

2011年4月5日星期二

use cron to control deluge download

55 17 * * * export DISPLAY=:0 && /usr/bin/deluge
56 17 * * * pkill -f deluge

Regards,
David Lin

2011年3月16日星期三

sed to find a block of text

How do I address all the lines between RE1 and RE2, excluding
the lines themselves?

Normally, to address the lines between two regular expressions, RE1
and RE2, one would do this: '/RE1/,/RE2/{commands;}'. Excluding
those lines takes an extra step. To put 2 arrows before each line
between RE1 and RE2, except for those lines:
sed '1,/RE1/!{ /RE2/,/RE1/!s/^/>>/; }' input.fil
The preceding script, though short, may be difficult to follow. It
also requires that /RE1/ cannot occur on the first line of the
input file. The following script, though it's not a one-liner, is
easier to read and it permits /RE1/ to appear on the first line:

/RE1/,/RE2/{
/RE1/b
/RE2/b
s/^/>>/
}

A solution to the problem :

sed -n -e '/A/,/B/{
/A/b
/B/b
p
}' File > Target_file

The same thing with awk

awk '/A/,/B/{ if (/A/ || /B/) next; print }' F > G

2010年12月1日星期三

ubuntu lamp 開發環境

sudo apt-get install lamp-server^

就只有一行 ^別忘了

2010年11月30日星期二

付出與收穫會成正比

今天有個朋友 Travis Wu 跟偶分享了一個概念

當每天都多作一點 付出110% 一年下來等於 1.1^365 = 1.28330558 × 10^15
當每天都少作一點 付出90% 一年下來等於 0.9^365 = 1.98845582 × 10^-17

十萬八千里

感謝Travis與我分享