La Vita è Bella

Wednesday, March 21, 2007

Bash script: batch resize your photos

If you toke some photos by your camera, and want to post them to somewhere (for example, I want to post the photo of my Treo 650 because I'm going to sell it), you may need to batch resize your photos.

This bash script shows how to uses ImageMagick to batch resize your photos:

1 #!/bin/sh
3 for file in *.JPG; do
4         convert -resize 1024x768 $file ${file%.JPG}_resize.jpg
5 done

tags: , , , ,

21:28:36 by fishy - linux - Permanent Link

1 comment - no trackbacks yet - karma: 29 [+/-]

Tuesday, March 20, 2007

Note: set proxy for wget

wget -Y -e "http_proxy=host:port" url

"How to set proxy for wget?" I've been asked this question for many times, but it seems didn't appears in the "-h" output nor man page, so I always forgot it.

That's why I'm making a note here :)

tags: , , ,

00:42:01 by fishy - linux - Permanent Link

4 comments - no trackbacks yet - karma: 37 [+/-]

Friday, March 02, 2007

Some (not so many) handy aliases

Under my Debian Linux, when I use screen, I always get some keymap/TERM setting problems, for example, the backspace key never work.

But if I set TERM to "vt100" before launch screen, it's OK, so this alias can resolve the problem:

alias screen='env TERM=vt100 screen'

For the poor network, I always need a multi-thread http downloader. Firefox has a extension DownThemAll!, but after I finish surfing websites (but didn't finish downloading yet), I used to press Command+Q to quit Firefox, and the download was interrupted. lftp has a built-in downloader: pget, so use pget is a good idea:

alias pget="lftp -c pget"

Put the codes into your bashrc file, and restart your terminal, it's done.

tags: , , , ,

21:25:26 by fishy - linux - Permanent Link

1 comment - no trackbacks yet - karma: 27 [+/-]

May the Force be with you. RAmen