Code Snippets - Bash-foo console stuff
This is going to be a collection of more or less handy (mostly) one-liners that made my life a little easier.You'll find mashups of varying amounts of nasty consiting of mostly awk, grep and my beloved perl.
Batch wrapper for imagemagick's convert
I use this to down-scale the photos I take to web-resolution.Of course it can also be used to create thumbnails or do any other 'convert' thingy for a whole batch of images.
mkdir thumb
ls *jpg | xargs -n1 perl -e '$f=shift @ARGV;system("convert -resize 10% $f thumb/$f");'
Instant image list
This little one-liner creates an image list.Basically a directory listing for images.
Replace the 'thumb/'-part with the subdirectory (or image prefix) of your thumbnails
ls -1 *jpg | awk '\
BEGIN{print "<html><head><title>PAGE TITLE HERE</title></head><body>" } \
END{print "</body></html>"} \
{print "<a href=\"" $0 "\"><img src=\"thumb/" $0 "\"/></a><br/>"}' \
>index.html
