Adding data, not systems

For the most part, and leaving aside some tool-making or data-checking programming, I think it is far more relaxing to add data to the world than to add more systems-for-working-with-data. Contributing to Wikisource, Openstreetmap, Commons, even Flickr and Reddit, will further the cause (what ’cause’?) more than building some new system for cataloguing photos or conducting conversations.

So take photos, draw maps, write blog posts, explore the world and record what you see. Don’t devise the means to do these things — we already have the means, and have had for a rather long time. Better to get on and do it, I think. The means won’t be perfectly what you’d prefer, but then they never will be (even after you’ve built the system that’s perfectly exactly what you want).

If you see what I mean?

Anyway, I’m only saying this because I’m going to be away from regular coding for a few months from next week, so shall be focussing on Doing more than Building. And I can’t wait!

Rename and move images according to date

My simple import-images.sh script that I use to shift files into my (ownCloud-backed) archiving system:

#!/bin/bash

if [ ! -d "$1" ]; then
  echo "Error: first parameter must be a directory" >&2
  echo "Usage: "$(basename $0)" "
  echo "       where  is an existing directory from which to import images"
  exit 1
fi

DEST=$HOME/photos
exiftool '-FileName
	

Backing up thunderbird email

When backing up Thunderbird, the only files I worry about are the actual mbox files that store the ‘Local Folders’ (archived) email, and the *.mab addresbook files. Everything else is operational cruft. This might seem a bit extreme—after all, why not backup the account configurations and user preferences etc.—but I jump from machine to machine often enough, and reinstall things so regularly, that setting up a few email accounts now and then is too easy, and I prefer the minimalism. This way, I know exactly what I’m backing up and where my emails are, and I’m only backing up what’s essential. I’ve tested restoring to other email clients too (like sylpheed), and all is seamless and heartening.

This minimal backup works too because I use the ‘archive’ function of Thunderbird, which is just a simple “copy to date-based (i.e. year-based) folder hierarchy in Local Folders” function, activated by pressing a. Hence, I don’t bother filing emails by topic, and I store all sent items in the same folders are those received (yeah, I’m not suggesting that anyone else is ever going to find my system at all sensible). So the files backed up are small in number and never disappear (new ones are added, is all). I don’t back up what’s still up in the IMAP server, but then there’s not much of that at any given time.

The last part of my backup is to include all the files, both mbox and mab, in a version control system (in this case, Subversion). This way, I can roll back any file to any previous revision, easily. They’re all text, so the revision space-usage is efficient and of no worry; I’m only talking about half a gig per year anyway.

The script that does all this for me is simple:

#!/bin/bash

TB_PROFILE=/home/sam/.thunderbird/po2p7m5o.default/

MBOXEN=$(dirname $0)"/mboxen"
ABOOKS=$(dirname $0)"/abooks"

echo "Copying addressbooks to $ABOOKS..."
cp -v "$TB_PROFILE"*.mab "$ABOOKS/."

echo "Copying mail files to $MBOXEN..."
rsync -rv --exclude=*.msf "$TB_PROFILE/Mail/Local Folders/Archives.sbd/" $MBOXEN

# ...Followed by a svn commit

mbox is a pretty ridiculous format, really. It’s based on the idea that it can determine the beginning of each email by the fact that the word ‘From’ starts a line and is followed by a space. That’s it! Daft. Thunderbird supposedly has some greater means of delimiting messages, but still I’ve on a number of occasions had email corrupted due to this silliness. Not hard to recover from, usually.