The Plumbing and Heating site is here.


Yet Another 'Pooter Hacker

homo hackerensis

Not sure I can really justify the 'hacker' claim except to (hopefully) differentiate myself from from yer average nueless clewbie Windoze luser. I do use Linux (generally Debian with some forays into Ubuntu but M$-free since ... er <mumble>) and have written working programs (even if only "Hello, World\n") in a variety of languages including Perl, Bourne/Bash shell, C and C++ (and keep promising myself to upclue on Python ... when I get the necessary Tuits. Yeah, and learn emacs too :-))

What follows is some of my scripts and setups which I'm not too embarrased to share with the world, and hope may be of use and/or interest to others.

N.B. I'm running Debian-based systems: Debian stable (currently 'Lenny') on my desktop, and Testing ('Squeeze') on my laptop. YMMV porting any of this to other distros (mainly in terms of what applications your distro may come installed with, or make it easy to use).


File Listing and manipulation

The first script I install on any system is lsl:

ls -al --color "$@" | more

or sometimes

ls -al --color "$@" | less -eRX

This gives me colour-coded and paged directory listings. The less version allows me to page back through a listing (which is nice) but makes me explicitly exit with another RETURN when I reach the end of the listing.

I should probably learn to use Midnight Commander. I used to be fluent in Norton Commander on DOS systems but MC was too different to port my mind-and-finger-set to easily, and I never made it up the learning curve. I use KDE's konqueror for wysiwyg file manipulation, backed up by shell for stuff konq can't do - for example renaming files according to regular expressions using Michael Forman's ren-regexp Perl script. And for doing hard links, which KDE just doesn't seem to know about. :-(

Mail

Like many folks on home PCs I used to use Mozilla mail or Thunderbird (now called Icedove by Debian) to get mail from my ISP (NTL). Since I also have a domain (or three) registered to me which is hosted elsewhere my mail client got mail from that domain too. That included mail for my partner: I set Mozilla up to filter that into a mail folder which was shared with suitable file permissions. And once in a while I'd fire up mutt to read mail sent by the system to me (output of cron jobs etc). Then I got a laptop and wanted to read my mail when I was away from home. One way to do this is to ssh into my home PC from the laptop and run my mail client on the home PC with its display on the laptop: that works, but it runs like cold molasses. Also I wanted to try out sylpheed: but all my existing mail was stored in Mozilla's mail format which Sylpheed didn't understand. And I was running into a bug that made Mozilla keep crashing. So some hacking ensued and ...

Now I use getmail to get mail from my hosting providers (via pop) and put it into the Maildirs of local users. dovecot serves the mail via imap to our mail clients. And I configured exim (Debian's mail transfer agent) to deliver system mail to my Maildir instead of the usual mail spool at /var/mail/username.

Details ...


Audio

It used to be relatively straightforward to get BBC radio's streaming audio (both live and listen-again) as Real Audio, but since late July 2008 they changed the way they deliver it. Fortunately there's now get_iplayer which magically does everything for you.

Except allow you to call yourself a hacker while doing it :-(.

Details ...


Digital photography

I use a variety of tools to get pictures from my digital cameras onto my PC, renaming them to include their Exif date- and time-stamps, auto-rotating them, converting raw format to jpegs etc., which I describe here.


Backup

Having lost my main data disc once I tend to be quite motivated to keeping reasonable backups (and also documenting setups, which is important for when you have to restore a machine). Although backing up all or the important bits of your current hard disc image to something else guards you against your current HDD going down (or out the door, if someone steals your machine) it doesn't help if files get corrupted and you don't notice until after they've been backed up (overwriting your previously backed-up versions). But keeping archive copies of your filesystem rapidly gets out of hand in terms of data storage (even with Terabyte drives costing well under £100 one doesn't want to be constantly swapping HDDs) so one needs a way of backing-up only changed files.

On DOS I used to do this with xcopy and one of its switches that told it to copy only changed files (those with the archive flag set, I think). Where one's backup filesystem supports hard links[1] there's a much more powerful way which gives you a set of mirror image 'snapshots' of the filesystem you're backing up[2] at various points in time (e.g. hourly, daily, weekly ... etc.). The amount of space on the backup drive is the same as for one copy of your filesystem[2] plus the amount of space occupied by the changed[3] versions of files.

I haven't often needed this system (and one time I did I found I hadn't backed up that part of my filesystem!) but it's got me out of a few holes where some files have gone bad or I've screwed up a configuration, and been able to rescue myself using the backup drive.

I have a hand-rolled script that does this for me, making snaphots for each day of the week, each week of the year, and each year. There is also a FLOSS tool called rsnapshot which, for some reason I have now forgotten, I didn't use.

[1] Linux's ext family and other unixey filesystems, natch, but also NTFS, I think.

[2] or those parts of it you choose to back up - you might omit areas like most of your operating system's files, cache files etc

[3] However the snapshot-backup system may think that files have changed when you've only renamed the directory they're in, so if you do a bit of tidying up and decide to rename your 'mp3' directory as 'music' then the space occupied on your backup filesystem may well increase by the size of your mp3/music collection.

Details ...


ssh

Any Real Hacker(tm)must have a variety of 'pooters networked together. My home network doesn't include my toaster, doorbell or kids which probably excludes me from the Real Hacker category but I do have enough systems that communicating between them is an issue. Leaving aside the regular nuts'n'bolts stuff like NFS, NIS, SMB/SAMBA, local web and mail hosting etc. one inevitably needs ssh (including scp and rsync) connectivity. And one does not want to by typing in passwords all the damn' time.


Contact me

at wibble@yaph.org.uk