I’m happy to walk anybody through the minutia of getting an svn install of WordPress set up for yourself (assuming you’re already comfortable with sshing to your webhost/server).
…or how to “Justinify” your photos …or how I learned Lisp on a Saturday night
Yesterday I was working on a project where I needed to resize and “retouch” over a hundred photos for the web.
I tried playing with ImageMagick’s command line mogrify tool, but I wasn’t too pleased with the results—that and there’s something inherently tedious about making visual transformations from the command line. I performed the same operations in GIMP to compare, and it looked much better.
So I was confronting the idea that I’d have to manually edit all 100+ photos when I finally decided to buckle down and learn how to script GIMP.
GIMP uses Scheme (of all things) as its scripting language; Scheme being one of the two popular modern dialects of Lisp; Lisp being the holy grail of high-level programming languages (and the second oldest, after Fortran). So little did I realize, scripting GIMP was going to force me to learn Lisp…
I have to admit I’ve thought for a long time it’d be great to have a tool that brought together all of the settings I usually tweak when I’m editing a photo (color balance for brightness, contrast, saturation, and sharpening) because in GIMP they’re located deep in three different submenus. But doing one photo at a time was never motivation enough to dig under the hood. The thought of retouching 100+ photos, however, was the anvil that broke the camel’s back.
I learn best by looking at very simple but functional examples, so I started scouring the web to see what other people were doing, eventually landing on Dov Grobgeld’s Basic Scheme tutorial at gimp.org. It goes from how to add numbers in Scheme to creating your first extension in less time than it’s probably taken you to read this far. David M. MacMillan’s Some GIMP Scripts-Fu was also a great resource.
I have to say the best thing about GIMP’s extensions is that they enable the creation of rudimentary user interfaces for inputting configurable parameters. So I wasn’t limited to just my standard defaults for contrast and saturation—I could actually “build” an interface with tweakable values. Hot!
Around 3am last night, I finally put all the pieces together. Here’s what the Web Photo Editor looks like:
Update: it was announced on May 13, 2008 that a vulnerability was discovered in a Debian patch to a library used to generate SSH (and SSL) keys. If you followed these instructions before May 15, 2008 to generate a passphraseless key, you’ll need to update your system. All you need to do is goto System > Administration > Update Manager and click “Install Updates” from the GUI (or sudo apt-get update && sudo apt-get dist-upgrade at the command line). If you don’t know what I’m talking about, you’re probably not affected.
Right after I wrote How to regularly backup Windows XP to Ubuntu, using rsync for my T42 ThinkPad, I ended up installing Ubuntu on it. In the end I was mostly interested in backing it up for the purpose of safely wiping Windows. So much for regularly.
Then something unexpected happened: I started to use my 5 year old X23 exclusively. Partly because I’d already gotten comfortable with Ubuntu on it, and partly because I was using it at the time to edit photos on the bus ride home from work. When I got home, it didn’t make sense to switch to another laptop to finish whatever I was working on.
It also may have something to do with a feeling that I think Mark Pilgrim put well:
So I’ve been meaning to get back to rsync to start regularly backing up Ubuntu to Ubuntu. Well my little Mini-ITX server with external hard drive is already up and running. So that half of the equation was in place. What I was a little rusty on was how to set the whole thing up to run without needing a password.
That turns out to be really easy. If you’ve got ssh, then you’ve probably got ssh-keygen, which exists for the sole purpose of generating public and private keys, which when created without a passphrase can be used for password-free logins. So I ran ssh-keygen to generate a 2048 bit RSA key without a passphrase (aka a passphraseless key). I could also have generated a 1024 bit DSA key. I’m not sure I understand the difference. I’m not sure it matters.
ssh-keygen -b 2048
Inside ~/.ssh, ssh-keygen created two standard files, id_rsa and id_rsa.pub, the private and public keys respectively. The next and final step is to copy and “install” the public key on my backup server (192.168.0.100).
ssh-copy-id uses ssh to copy the public key to the remote server and appends it to the ~/.ssh/authorized_keys file. Of course I didn’t know about ssh-copy-id when I started, so I just scp-ed the file over and pasted the public key into the authorized_keys file.
At which point I could use ssh to login without a password! ssh knows to automatically check for the existence of the id_rsa private key and try logging in with that.
ssh 192.168.0.100
Hot damn! That alone makes me want to start distributing my public key around to every server I access regularly. Of course the other benefit (and the whole point of this post!) is that now I’ll also be able to cron an rsync backup without requiring a password.
My ideal backup is a relatively current mirror of my home directory. I’m not looking for modified file snapshots or entire bootable filesystem images, I just want to know that if my hard drive crashes, most of my data (especially the photos) is recoverable. To that end, my rsync needs are relatively simple, though it took some tweaking to get to this point:
The -a option means archive files—it’s really an alias for a lot of other options having to do with maintaining permissions and timestamps, etc. The -z option uses compression when transferring files. The -e ssh option tunnels the file transfer over an encrypted ssh connection. The --delete option deletes any destination files that have been deleted from the source. The --exclude=".*/" option skips hidden files and directories. Finally the last two parts are the source (in this case everything under my home directory) and the destination I’ve already set up on my backup server.
And that’s it. I added it to my cron to run daily at 10pm. Set and forget it.
$ svn info
Path: .
URL: http://svn.automattic.com/wordpress/tags/2.2.2
Repository Root: http://svn.automattic.com/wordpress
Repository UUID: 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Revision: 5946
Node Kind: directory
Schedule: normal
Last Changed Author: matt
Last Changed Rev: 5850
Last Changed Date: 2007-08-04 22:43:11 -0700 (Sat, 04 Aug 2007)
$ svn sw http://svn.automattic.com/wordpress/tags/2.2.3
U wp-includes/default-filters.php
U wp-includes/plugin.php
U wp-includes/query.php
G wp-includes/formatting.php
U wp-includes/feed-rss2-comments.php
U wp-includes/rewrite.php
U wp-includes/version.php
U wp-includes/pluggable.php
U wp-includes/widgets.php
U wp-includes/rss.php
U wp-includes/vars.php
U xmlrpc.php
U wp-mail.php
U wp-admin/admin-ajax.php
U wp-admin/admin-functions.php
U wp-admin/rtl.css
U wp-admin/options.php
U wp-admin/install-rtl.css
U wp-admin/widgets-rtl.css
Updated to revision 6065.
$
Stephanie and I have this idea for a cookbook project we’d like to work on together, and it occurred to me that a wiki would be a great candidate. Actually it may have been Stephanie who first suggested using something like a wiki.
Last night, while taking advantage of this luxurious, completely unscheduled three day weekend, I jotted down a to-do list of projects, and realized that several might benefit from some level of wikification (easy collaboration, non-rigid-structure, online access). But rather than create one-off wikis per project, I had a eureka moment! Why not just create a single “family wiki” for the both of us? Something we could both use as a private braindump for anything we want to share or work on together: research, itineraries, to-do lists, recipes, whatever—all within its malleable confines.
My wiki experience begins and ends with MediaWiki, the wiki engine behind Wikipedia—I actually host a site powered by it exclusively: editplus.info—so I spent some time last night re-educating myself on what else was available. I kind of like the idea of hosting the wiki myself, but of course that means I have to configure and maintain it myself.
On the hosted side of things, StikiPad, Wikispaces, and PBwiki seem to be the three biggest contenders. They all have full-featured, usually ad-supported free versions, with fuller-featured, ad-free versions for a small fee/month. It’s just that for something like this, I don’t feel like I should have to pay. Though I have to admit, StikiPad looks pretty good.
On the self-hosted side of things, MediaWiki (PHP), MoinMoin (Python), Instiki (Ruby), and DokuWiki (PHP) appear to be the leaders. Thanks to Wikipedia, editplus.info, and some projects at work, MediaWiki (and their wikitext format) just seems to make the most sense to me. The only downside is that using MediaWiki as a private wiki always seems like such a hack. That and the default Wikipedia Monobook skin is starting to show its age.
Finally, where would we host it? Stephanie and I both have fairly identity-centric domains (soleilisme.com and justinsomnia.org respectively) so methinks it’s time our blogs get together and create a cyberspace lovechild.