Introduction:

This page lists some small programs and scripts I've written to do useful things - most are quite hacky, so beware!

Contents

coord.rb: Coordinate Transformation

coord.rb is my very experimental Ruby library for coordinate conversions.

There are two main classes, Coordinate which deals with conversions on single coordinates, for example conversions from something like 52° 39′ 27.2531″ to 52.6575703°.

Coordinates (note the 's') deals with transformations onsets of coordinates (well, two coordinates) and can convert from lat. and long. into eastings and northings as well as converting eastings and northings into OS national grid format (like: TG 51410 13177). Conversions too and from 3D cartestian and lat and long are also available, along with conversions back from eastings and northings to lat. and long. Currently, only the UK national grid is available.

The module CoordinateConversion provides the meat of the Coordinate class - the reasoning behind this is simple - I've never used modules before.

The classes EllipsoidInfo and ProjectionInfo provide information about the projection and ellipsoids used by diferent coordinate systems. And are used by Coordinates.

Finally, since I've just discovered unit testing, the file coord_test.rb contains a test suite which automates testing the above classes - very cool!

Version 0.2 now includes a command line coordinate conversion program. See convert.rb.

For more information on the transforms I've used, read: ' A Guide to coordinate systems in Great Britain' by Ordnance Survey.

View (rdoc generated) documentation.

Download coord-0.2.tar.bz2

spikeyd.rb: A Ruby Sony PI Key event daemon

Having a sony vaio, I played a bit with jdmouse which launches hotkey events (i.e. Fn + F1 etc.), but quickly got fed up with the fact that all of the docs are in Chinese , and that all of the configuration is hard coded. I also didn't need most of the extra mouse functionality.

Enter spikeyd.rb: the Sony PI key daemon - a small(ish) ruby script which uses a YAML config file to store key events, and does some nifty things with the single volume control button.

There is still some work to be done before I'm totally happy with spikeyd but it's quite a functional replacement for jdmouse as it stands, and better still, you can configure it to either run internal methods, or arbitrary ruby code.

Here is a snippet of the YAML config file:

actions:
  F3:
	- @vol.toggleMute
  F4:
	- @vol.increment
  F5:
	- @bright.increase
  F6:
	- @bright.decrease
  F7:
	- @screen.rotate
  F8:
	- system("xscreensaver-command -lock")

Download spikeyd.tar.bz2 (3.2KiB)

exifDirs.rb: Symlink images by Exif data

Inspired by various small scripts to sort images by the exif tag 'Date and Time', I decided to go a bit further. My script links images into directories determined by date and orientation and is designed to be easy to extend. Only tested in Linux, but should be portable to other OSes. Still work in progress.

View Documentation

Downloads exifDirs.rb

snarf_pics.sh: Copy Images from Memory Cards

snarf_pics is a simple shell script which copies images off of a flash card into a dated directory. It then involes exifDirs.rb to link the pics to various directories.

Download snarf_pics.sh

procmailiew.rb: Ruby Procmail Log Viewer

If you're anything like me, then you'll want a nice, pretty list of the last few items that procmail has dealt with. Until recently, I'd been happy with Giblet's procmailview.pl, but then I read about HighLine and decided that I'd try it out by writing my own using it's pretty interface.

This is the result: procmailview.rb.

And this is what the output looks like:

procmailviewer screenshot

animate.rb: Ruby GIF Animation Creator

I often have to produce animations from large series of frames, and so rather than do it by hand, I decided to automate it. This ruby script uses gifsicle and ImageMagick to convert a directory of images (preferable sequentially named) to a gif animation

Get animate.rb.

rss-wp.rb: Ruby RSS Wallpapaer setter

This little script sets your wallpaper to NASA's image of the day RSS feed. It's needs feh, or GNOME (modify the command at the top of the script).

Get rss-wp.rb.

Surround Mixer Launcher

A relic from my Windows days.

Launches the Creative Surround Mixer instead of Windows Mixer on a single click of the volume control icon in the notification area (tray). Works with Win98 through to XP Pro. See Readme for more details.

N.B: It is not possible to modify this program to dynamically find SurMixer2.

N.B2: I can't give any help in installing this program at all! I gave up using Windows ages ago - sorry! Hint: look at XP File Protection, or rather how to disable it.

Download (.zip) (26KiB) or Download with Source (.tar.bz2) (40KiB)