Archive for July, 2008

Wordpress upgrade script

Tuesday, July 29th, 2008

I’ve just upgraded to Wordpress 2.6, and it struck me that it’d be handy to have a script to do this automatically. I’m sure others have their own versions of this, but here’s mine:


#!/bin/bash
DATESTAMP=`date "+%Y%m%d%H%M%S"`
# All these should be absolute paths so that symlinks work properly
NEWCODE=$(pwd)/blog/wordpress-$DATESTAMP
CURRENT=$(pwd)/blog/current
SHARED=$(pwd)/blog/shared

wget -O blog/latest.tar.gz http://www.wordpress.org/latest.tar.gz
# Extract it and change the directory name
tar -zxf blog/latest.tar.gz -C ./blog
mv blog/wordpress $NEWCODE

# Copy the new content code into the shared directory
cp -a $NEWCODE/wp-content $SHARED/wp-content
# Remove it and then link it back in.  This preserves installed themes
rm -rf $NEWCODE/wp-content
ln -s $SHARED/wp-content $NEWCODE/wp-content
# Link the config in
ln -s $SHARED/wp-config.php $NEWCODE/wp-config.php
# Clobber the old link
rm -f $CURRENT
# Make a new one
ln -s $NEWCODE $CURRENT

There are a couple of rough edges (like not moving $CURRENT sideways before deleting it so that requests that come in mid-process aren’t broken), but it works for me. It assumes that you’ve got the directory ~/blog/shared, containing wp-config.php and your wp-content directory, and the new version of Wordpress will be installed at ~/blog/current (symlinked to a datestamped folder), so that’s where Apache should be pointed.

WEBrick proxy authentication example

Tuesday, July 29th, 2008

I’ve never been able to find an example of using WEBrick’s HTTP proxy with authentication online before, so here’s one I figured out today, after the fold.

(more…)

Clojure’s REPL and Readline

Friday, July 4th, 2008

The standard advice for getting a practical REPL for Clojure is to use jLine, but that’s not really necessary if you’re not on Windows. rlwrap does the job admirably, and was only an

apt-get install rlwrap

away for me.

Government data! Free APIs!

Wednesday, July 2nd, 2008

Wow.

Now I just need to generate some spare time to think through what’s possible with all this.

Also, intriguingly, the Ordnance Survey has released an API that mitigates my old post somewhat.

Entries (RSS)