Skip to content

Go and vim

The default vim go language syntax file uses a tabstop of 8, which is a bit excessive. Adding the following to ~/.vimrc makes the code nice and compact :

" Use a tabstop of 2 for go files
autocmd FileType go setlocal shiftwidth=2 tabstop=2

Henry Moore Foundation

The Henry Moore foundation in rural Hertfordshire is well worth a visit.

Pictures like these can be found here :

OLYMPUS DIGITAL CAMERA

Resize images on the command line on Mac OS X

My new camera works very well, but the default file size is too large for my gallery. To resize them on the Mac you can run the following on the command line :

sips -Z 1440 *.JPG

Thanks to lifehacker.com for the tip.

Using signal.alarm() for a timeout

The Python signal module let’s you setup Unix signals, including SIGALRM. This can be used to setup a timeout :


import signal

def handler(signum, frame):
print 'received', signum

# Setup the handler
signal.signal(signal.SIGALRM, handler)

# Trigger the alarm after 60 seconds
signal.alarm(60)

This prints ‘received 14’ after 60 seconds.