Copenhagen

23 July 2012

Lucy and I have just begun our first Interrail trip. We flew out from Gatwick to Copenhagen yesterday following a less than perfect night’s sleep on the terminal floor. Perhaps bringing sleeping bags (for a hostel trip) would have been worth it after all.

The man at the tourist information desk spoke impeccable English with a curious hint of a Birmingham accent. He told us that the street we were staying on, Struenseegade (stroont-see-girder) is named after a German doctor who was beheaded for getting a little bit too close to the queen. We withdrew the grand sum of 300 Danish kroner, thinking this would be more than enough for the time we were going to spend in Copenhagen. This turned out to be a little optimistic as we eventually spent 2500.

We had lunch in a cafe laconically named ‘ñ’. It is a vegetarian place and we both had a bedazzling varied Brunch with freshly squeezed orange juice (the Danes don’t seem to drink any other type). It came in at a pretty reasonable price and their wifi worked well, unlike the hostel’s.

Later we went to the Tivoli amusement park, this had a lot of rides ranging from rollercoasters to Hans Christian Andersen moving exhibitions. My favourite was the ‘Daemon’, a very red rollercoaster with loops and corkscrews. We also went on several rides involving spinning around and water which were naturally enjoyable. The most adrenaline fuelled ride we went on was a vertical drop which first moved very, very high with enthusiastic steam noises. From the top we could see a long way around us, accompanied by the musings of a man wondering why he had gone on the ride. Shortly afterwards, we fell fast enough to cause significant g-force and a lot of screaming from Lucy.

We also noticed that bicycles are incredibly popular in the entirely flat Copenhagen. Perhaps due to this, the Danish are almost all very slim and attractive, with the (unusual for England) combination of blue eyes and dark hair. Copenhagen is a very peaceful city, with comparatively few cars to anywhere in the UK. We are now aboard an ICE (InterCity Express) train to Hamburg, which drove onto a ferry and provided a nice break as we had to go above decks. We spent the train journey talking to friendly Germans, which made it go very quickly. We now look forward to finding a hostel which we know only the name of, having deigned to not bother printing out the reservation slip.


Copenhagen - Comments

Run task on drive connection or disconnection in Windows

12 July 2012

Description

This script watches for Windows drive letter connection or disconnection events and allows scheduling of tasks to run accordingly. For example, this is useful if you want to run a program to synchronise the contents of a USB pen drive automatically when it is inserted.

Tasks can be configured in a human-readable JSON format configuration file. It installs itself as a service and is very, very alpha.

Requirements

  • The script should work in Python >= 2.6 and requires pywin32.
  • It has been tested on Windows 7 x64 only.

Source code repository: https://github.com/inversion/drive-letter-watcher


Run task on drive connection or disconnection in Windows - Comments

This blogging thing…

1 July 2012

I’ve started blogs in the past, but always abandoned them pretty quickly. Hopefully this one will be more successful since I like the domain name better than usual.

Expect to see programming with smatterings of ranting and musing.

Cheers,

Andrew


This blogging thing… - Comments

Selective Reading WordPress Plugin

1 July 2012

Since I will soon be writing about travel on this blog, which will be unrelated to the rest of the content, I have written a small WordPress plugin that allows visitors to hide categories they do not wish to read from the site. This was a good opportunity to get some experience writing WordPress plugins too, the API is pretty easy to use.

The plugin is currently active on this site as you can see from the show and hide links in the categories sidebar. It works for hierarchical categories too.

The code is available at GitHub along with a list of current and planned features.

See the page in the WordPress plugin directory at https://wordpress.org/extend/plugins/selective-reading/


Selective Reading WordPress Plugin - Comments

Auto-update Ubuntu server with email notifications

25 June 2012

It’s useful to have a script to keep the packages on your server up to date. On the desktop there is a GUI auto-update tool which is active by default. The caveat is that you don’t want updates to break your server without you realising.

This script is adapted slightly from the Ubuntu wiki to do a ‘safe-upgrade’ and to mail directly rather than using an external SMTP server. It also tails the output of the update since it’s pretty long. Use at your own risk etc., script is below. Copy to /etc/cron.weekly and chmod +x.

#!/bin/bash
#
# use aptitude to automatically install updates. log and email any
# changes.
#

#
# variables to change
#

# address to send results to
MAILTO=[email protected]

#
# script is below here (do not change)
#

tmpfile=$(mktemp)

#
# actually run aptitude to do the updates, logging its output
#

echo -e "aptitude update\r\n..." >> ${tmpfile}
aptitude update | tail >> ${tmpfile} 2>&1
echo "" >> ${tmpfile}
echo "aptitude safe-upgrade" >> ${tmpfile}
aptitude -y safe-upgrade >> ${tmpfile} 2>&1
echo "" >> ${tmpfile}
echo "aptitude clean" >> ${tmpfile}
aptitude clean >> ${tmpfile} 2>&1

#
# i get a lot of escaped new lines in my output. so the following
# removes them. this could be greatly improved

tmpfile2=$(mktemp)
cat ${tmpfile} | sed 's/\r\r/\n/g'|sed 's/\r//g' > ${tmpfile2}
mv ${tmpfile2} ${tmpfile}

#
# now send the email (and ignore output)
#
mail -s "Aptitude Upgrade $(date)" ${MAILTO} < ${tmpfile} &> /dev/null

#
# and remove temp files
#

rm -f ${tmpfile}

Auto-update Ubuntu server with email notifications - Comments