31 March 2008

My bash prompt

I like a new line in my prompt so that if I'm deep in a path I don't end up with 10 characters left to type in, and pretty colours so that it's easy to spot the prompt when scrolling through lots of output.

Update 26/04/2008, added red for root.

From my ~/.bashrc
# Comment in the above and uncomment this below for a color prompt
if [ $UID = 0 ] ;then
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]\n\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]\n\$ '
fi


The result (more or less):
tim@lap:~/Documents
$ echo "That's better"


Enjoy.

27 March 2008

stop motion animation on linux

A quick howto...
  1. Take a series of photos on your digital camera.
  2. Copy them onto your linux box.
  3. shrink the photos to a more managable size:
    mogrify -verbose -resize 600x400 -quality 60% *.JPG
  4. Preview the animation with animate:
    animate -delay 8 *
  5. Optionally rotate the image to match the exif information from your camera (mine was sideways):
    exiftran -ai *
  6. Convert the jpg files to png:
    mogrify -format png *.JPG
  7. Create the flash animation from the PNG files:
    png2swf -r 15 -o flower2.swf -v -X 399 -Y 600 *.png
  8. Create an html file to hold the animation containing the following:
    <object>
    <param name="movie" value="flower2.swf" />
    <param name="loop" value="true" />
    <param name="quality" value="high" />
    <embed src="flower2.swf" width="399" height="600" />
    </object>
  9. Write a blog article to tell everyone about it ;-)
    "history" is a handy command for reviewing your activities for writing up your achievements.
And here it is, providing I've kept up with my hosting fees and not been slashodotted: