星期四, 4月 12, 2012

Unix scripts (sed & bash for)


今天工作上有個小任務, 一個目錄裡有47張圖, 巧合的是他們只有兩種解析度, 分別是480x84及480x720. 需要把它們分別放到兩個目錄裡. 大概記錄一下怎麼做的, 不然永遠記不得...
  1. 用file取得檔案的解析度, 先不要480x84的.
    • file *.png | grep -v "x 84" | sed 's/\(.*\):.*/\1/' > list
  2. 再在bash cmdline寫一行的script
    • for i in `cat list`; do `mv $i 720`; done
  3. 再把剩下的搬去84目錄下.
    • mv *.png 84
  4. 收工

星期三, 4月 11, 2012

How to use FTP over TLS?

  1. Filezilla
    • Site Manager->New Site->Encryption->Require explicit FTP over TLS.
  2. lftp
    • lftp id@ip
    • set ftp:ssl-protect-data true
    • get filename

Revamp my blog


My blog template didn't change for a while. Blogger has added many new features and I chose my template before that. So that template wasn't too flexible. Now I changed to use another template, removed most of the Ads and add SyntaxHighlighter 3.x. Now the web site would look neater.