Bash Fun – history and navigation

Garret posted two very useful tips on his blog:

  1. Search history in bash – Hitting CTRL-r allows you to search the Bash history by typing a word. It’ll match the word and bring up that command!
  2. Super-useful inputrc enables you to CTRL-left and CTRL-right through your current command line, just like in the good ol’ DOS days!

Can’t believe the inputrc stuff isn’t enabled by default and I wish I knew the first one a long time ago!

Converting RAW files to Jpeg, Nautilus Style

Further to my previous attempts to convert RAW files to Jpeg, here’s a Nautilus script based on this script. How do you use it? The g-scripts FAQ has more, although in Ubuntu I had to copy the script into ~/.gnome2/nautilus-scripts/
This script uses “Zenity” to display a nice progress bar while the conversion takes place.

#!/bin/bash

(while [ $# -gt 0 ]; do
dcraw -c -a -n -h $1 | ppmtojpeg > `basename $1 cr2`jpg
echo $1
shift
done) | zenity --progress --pulsate --text "Converting RAW files to Jpeg"

Converting RAW to Jpeg in Linux

Dcraw is an amazing open source app that decodes many RAW formats to a more usable format for computer manipulation. It’s used by many commercial programs including Google’s Picassa!
It outputs pnm files, but with a little command line magic it can be used to convert a directory of RAW files to Jpeg.
Canon cameras produce RAW files with the extension “.cr2” so:

for i in *.cr2; do dcraw -c -a -n -h $i | ppmtojpeg > `basename $i cr2`jpg; echo $i done; done

This produces low quality jpeg images alongside your RAW images which makes it useful when browsing the directory with a file manager that doesn’t understand RAW.
You could have the camera produce the low quality jpeg images but why sacrifice the space on your media card?
It goes without saying that this will work on any UNIX platform that Dcraw supports!

FlickrUploadr – Linux Flickr.com uploader

FlickrUploadr is a Flickr upload tool written in Python and Gtk.
It runs on Linux and probably any platform that are supported by Python and Gtk which is most of the popular ones!
I haven’t tried it yet but have to admit I don’t mind the email uploader. Attach a load of photos and click Send. Simple.
(Thanks Donal!)

Ubuntu: back on the scene

I installed Ubuntu ages ago but never got around to configuring it:

  • Firefox didn’t like my .mozilla or .firefox directories. It complained that my default profile was already in use.
  • Thunderbird didn’t work either but I can’t remember why. Could have been the same reason.
  • Mplayer had to be installed from source. I didn’t want to go through the hassle of installing a compiler and associated development libraries.

This morning I rebooted my Debian desktop, only to discover that it wouldn’t boot again. It complained about needing an old version of modutils. Arrggghhh! Wasn’t this the perfect time to try Ubuntu again?
I rebooted, and managed to massage Firefox and Thunderbird enough that they worked.
Mplayer was still a problem but after looking around a bit here’s the easy way to install Mplayer:
Add this line to /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu hoary multiverse

Do an “apt-get update” and “apt-cache search mplayer” to find the right Mplayer for your CPU.