The Cyclist

A couple of months ago, I bought myself a bike, and catapulted head-first in to cycling to and from work.
It hasn’t been easy – dealing with less courteous road users who try to kill me, pedestrians who walk out from between buses, cars that overtake leaving precious little room for me – it’s a very big learning experience. The benefits are worth it though – the money I’m saving on my Travelcard is going on cycling gear for the first few months, and my body is changing shape in to something rather more pleasant than “chubby”.
Within London, TfL offer free or subsidised cycle training. I took up their offer and had a couple of two-hour sessions with a qualified and knowledgeable instructor. She showed me so many techniques to help me get around safely – a couple I was already doing, others I wasn’t and should, and some – such as roundabouts – that I didn’t dare tackle.
The result is a big increase in my confidence, and the feeling that I am assertive and aware enough on the roads to make the majority of cycling fun. If you have the opportunity to do so, take the cycle training – it may not be there forever.

Converting OSGB36 (Eastings/Northings) to WGS84 (Longitude/Latitude) in Ruby

The excellent people at the Greater London Assembly have released a list of bus stops and bus routes in London. The coordinates of each bus stop are in eastings and northings, and I wanted to convert these to longitude and latitude for my Ruby on Rails application.
Using the proj4rb gem and some projection definitions from spatialreference.org – with some help from Harry Wood’s blog, I came up with the following code:

#!/usr/bin/ruby
require 'rubygems'
gem 'proj4rb'
require 'proj4'
easting = 529978
northing = 186491
srcPoint = Proj4::Point.new(easting, northing)
srcProj = Proj4::Projection.new('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs')
dstProj = Proj4::Projection.new('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
dstPoint = srcProj.transform(dstProj, srcPoint)
print "lat=#{dstPoint.lat * (180 / Math::PI)}n"
print "lon=#{dstPoint.lon * (180 / Math::PI)}n"

To convert WGS84 to OSGB36:

#!/usr/bin/ruby
require 'rubygems'
gem 'proj4rb'
require 'proj4'
latitude = 51.5623279577278
longitude = -0.126277004538848
srcPoint = Proj4::Point.new(longitude * (Math::PI / 180), latitude * (Math::PI / 180))
srcProj = Proj4::Projection.new('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
dstProj = Proj4::Projection.new('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs')
dstPoint = srcProj.transform(dstProj, srcPoint)
print "easting=#{dstPoint.x}n"
print "northing=#{dstPoint.y}n"

Facebook Data 'Leak' – it's not news, people

Security consultant Ron Bowles trawled Facebook’s public directory and published ‘data’ on 100,000,000 users. Some people are up-in-arms about the leak, crying that ‘something must be done’, but not what. Few people seem to have looked at the data and given a coherent response. In fact, there’s nothing exciting.
The data is 2.8GB and I’ve spent the last twelve hours downloading it. Good news, everybody – it’s rubbish! Your bank details, email addresses and the name of your first born child are not there. Neither is your date of birth, your location, or a photo. A telephone directory contains more information on you.
The data is simply a list of names and a large file containing URLs to entries in the directory with seemingly no relation to the names.
There’s some other data which are derived works of the original file – these are described as follows:

Filename                        Description
-------------------------------------------------------------------------
facebook.rb                     The script used to generate these files (v1)
facebook.nse                    The script that will be used for the second pass (v2)
facebook-urls                   The full URLs to every profile
facebook-names-original         All names, including duplicates
facebook-names-unique           All names, no duplicates
facebook-names-withcount        All names, no duplicates but with a count
facebook-firstnames-withcount   All first names (with count)
facebook-lastnames-withcount    All last names (with count)
facebook-f.last-withcount       All first initial last name (with count)
facebook-first.l-withcount      All first name last initial (with count)

So in summary, it’s a load of hot air.
What data appears for me? Looking through all the files – my name appears in facebook-names-unique once. And that’s it. According to Facebook’s directory, there are at least 192 people called Peter Hicks.

Getting fitter

A month and a half ago, a friend of mine went to an absolute beginners fencing class. Having done next to no regular exercise other than walking to and from the tube, four hours of activity did me in and my thighs and legs ached for the next two days. Despite the physical symptoms, I was ready for more and signed myself up for a six week course which ended yesterday. I’ve had several lessons of private tuition too – it’s great fun, hard work, but I don’t notice the physical activity so much as the technique and tactics.
In conjunction, and to get rid of the “IT Thighs” that I’ve developed after over a decade of running technology, I’ve taken up cycling. This is a great activity which is a lot faster than the bus, and exercises muscles I never before believed I had – which include my awareness of the back-streets of London.
My goal for both of these is to shape up, tone up and attain thighs of steel. If I can lose two stone, I’ll be over the moon 🙂

Importing SSL certificates on Cisco IOS

A requirement came up to use Cisco’s AnyConnect VPN on a router. For this, an SSL certificate and corresponding private key is required – I used CAcert.org.
I will deliberately skip the detail of how to generate an RSA private key, create a CSR and get this signed by a CA. Straight to the chase – here is how to import the key and certificate on to an IOS router.
Use openssl rsa -in foo.key -pubout to display the corresponding public key for your private key foo.key. This will begin with BEGIN PUBLIC KEY.
Next, ensure your private key has a password – use openssl rsa -in foo.key. If it doesn’t, encrypt it with 3DES using openssl rsa -in foo.key -3des and specify a password.
On the IOS device in question, use crypto key import rsa foo pem terminal to import the PEM encoded public key:

cr(config)#crypto key import rsa foo pem terminal strongpassword
% Enter PEM-formatted public General Purpose key or certificate.
% End with a blank line or "quit" on a line by itself.
-----BEGIN PUBLIC KEY-----
...

Ensure there is a complete blank line after pasting the public key, and the router will then prompt:
% Enter PEM-formatted encrypted private General Purpose key.
% End with "quit" on a line by itself.

Paste in the 3DES-encrypted key – it will begin BEGIN RSA PRIVATE KEY, and type ‘quit’ on a blank line at the end.
That’s it. It’s not straightforward, and I know I’ll forget if I don’t write it down!

Real-time Tube Tracking

I have a lot of respect for the folks at the Greater London Assembly, especially those who worked to get the Train Prediction API exposed and available.
Many people have seen Matthew Somerville‘s Live Map of Underground Trains which was whipped up in a frighteningly short time.
I’m working on a Rails interface to the Train Prediction API, with an ‘advanced’ mode for those who grok the tube. It’s a little rusty, and not even beta-quality, but it’s available for you to play with if you so wish.
Here’s hoping that particular box stands up to the load 🙂

Reducing Nagios' CPU load when using SNMP plugins

I have a virtual machine which has 100 hosts and 600 services being monitored through Nagios. 400 of these services are monitored via SNMP plugins.
One of our system administrators mentioned that this VM was quite CPU hungry, so I set about trying to lighten things up. I found that the simple act of adding a -M MIB-NAME switch in to a service check has dropped the load average from around 1.7 to 0.8 over 15 minutes.
Here’s how to do it:
First, look for any check_snmp plugin which uses an textual OID. Convert this to a numeric OID by using snmptranslate IF-MIB::ifOperStatus -Of. Use the numeric OID shown in place of the textual OID – this will save a few CPU cycles.
Unless you need to translate the returned values back to text – for example, if an enum is returned that needs to be translated in to text – don’t specify ‘-m’ on the command line at all. However, if you do need to translate the returned values, specify -m IF-MIB, or whichever MIB name appears before the :: when translating the textual OID to a numeric OID.
I’m happy, our sysadmin team are happy 🙂

One wisdom tooth out

I’ve had one of them out (warning: contains graphic images of an extracted tooth).
It really wasn’t painful – the most uncomfortable thing was the injection in the palatal side of the gum, and I heard a noise not dissimilar to the squeezing of a cork in a wine bottle as it came out. One suture – I think – and a bite down on some gauze for a bit, and I’m fine.
I am still a little high on the lidocaine, but that will pass.
If you’re worried about having a wisdom tooth extracted – don’t be. The worst bit is the anticipation!

A premium extraction

I suppose I was lucky to genuinely forget about having my third molars – Wisdom Teeth – removed tomorrow morning. As a result, I had a premium weekend full of fun and free from worry. I saw Everything Is Illumated on Saturday, and may be inserting the word ‘premium’ in to conversation as an in-joke. I’ve already written ‘Simples’ in a work email and affixed a Ceiling Cat to the kitchen ceiling.
With any luck, the extraction will be uneventful, and I’ll be a little sore but much happier. Maybe I’ll be able to take my newly extracted teeth with me, clean them up and take photos of them as if nobody’s even had an extraction before…

Openfire 3.6.4 on Ubuntu 10.04LTS

After installing Ubuntu Server 10.04LTS on to one of my VMs, I found I couldn’t install Openfire due to a missing dependency on sun-java6-jre. The Sun JRE has been removed from Ubuntu 10.04LTS, and its replacement, openjdk-6-jre isn’t quite up to scratch.
As reported elsewhere, here’s how to install sun-java6-jre:

  • Modify /etc/apt/sources.list and add deb http://archive.canonical.com/ lucid partner
  • Update the package database by running apt-get update
  • Install the Java runtime environment using apt-get install sun-java6-jre

Simples.