|
Cool hacks small programs, scripts, and musings |
This section is an informal collection of software for Linux and Unix. It's mostly small scripts, build configuration files, and miscellaneous utilities. We're pleased to make them publicly available
timezone utilities
- slashtime
a simple command line tool which displays the current time in various locations around the world; what is uncommon about this script is that it displays the offset relative to the current location, rather than the offset from GMT which is more typical. The screenshots below illustrate this in action. Also used to generate the Timezones page in the Contact Us section of this site. The name of the script comes from the shortcut, /time, one can use to reach it on our site.
Update: You can now specify a target date/time and timezone on the command line, helpful when trying to figure out meetings.
Update: The differential to half hour timezones are now reported properly!Source code: [ perl script ] [ example .tzlist file ]
Screenshots: in Sydney,

and Perth.

Note northern hemisphere cities in summer daylight savings time, and that the half hour offsets are correct. If an entry isn't in your .tzlist file, a "Local" entry for the current local timezone is displayed, as shown in this screenshot (from an older version) passing through Bangkok a few years back.
backup tools
- geode
Travelling frequently, the risk of having a laptop stolen or a hard drive blow is very high, so one wants to archive one's critical files quickly and easily. The two obvious places to stash such contingency backups are to a remote server and a USB key.Of course, your remote machine might be shared, and USB keys are likewise vulnerable to physical theft (not to mention being misplaced), so any data archived to them needs to be encrypted.
geode is a tool which automates building a tarball, encrypting it, and then moving it to the specified archive destination.
One of the things you don't want to loose are your secret keys for ssh and gpg; while they are, of course, passphrase protected, if you don't have the bits on disk, then you're a bit up the creek - especially if you used your gpg key to encrypt all the data. So if you want to securely store your secret keys, one has to encrypt them separately and use a symmetric cipher, not an asymmetric (public/private) one, when doing so. geode takes care of asking for your passphrase and for a key to encrypt the crypto data, which is also handy so you don't have to specify your passphrase ever time gpg asks for it.
It's written in bash (I know, groan. It started small and grew. Tell me you've never had that happen to you), and has some neat perl foo to help figure out how far along it is making the various tarballs. It uses zenity (a tool that allows one to easily create GTK+ dialog boxes from the command line) to show progress, including which file it is working on, which is pretty cool.
Source code: [ bash script ]
I'm working on a rewrite of this in java-gnome (mostly as an exercise, but also so I can make the UI a bit more robust and HIGgy). Instructions to fetch that code are here.
