Tuesday, 17 May 2011

Biking at Sneck Yate Bank

Saturday, we went biking. For the first time, we went Mountain Biking, at somewhere other than a prepared trail centre.

This was something of a revelation, as it's the first time we've done any trails that weren't specifically built for biking. Turns out that that there's a lot of ups. And then some more ups. And then a bit more.

The route we chose was from the rather excellent North York Moors Mountain Biking by Tony Harker. (Buy it here http://www.amazon.co.uk/North-York-Moors-Mountain-Biking/dp/1906148082 No, really, do it's excellent).

The book has an accompanying CD (buy that too), that has handy printable PDFs of all the routes, including the directions and the maps. The one thing that's missing is a GPS track of the route.

So, we chose route '9'. Sneck Yate Bank. It lead to views like this:

P1040640

The route was very easy to follow, and the guides very clear. Some climbing, then a shortish section of singletrack downhill (that was a bit churned up by horses, but still perfectly ridable.)
On to some more up, then an awesome gentle descent on open fire road, stopping only to let the lambs get out the way.

The final result, looks a bit like this:

Google_earth_map

A great day out, and a great guide.

Attached is a GPS track of our ride, should you want some technological assistance or reassurance.

2011-05-14-10-31-11.gpx Download this file

Posted via email from Tom's posterous

Monday, 28 March 2011

Using Fabric from Celery in Django

Recently, I’ve been experimenting somewhat with Celery, Django and Fabric.

These fit really nicely together if you want stick a web interface on system management tasks, such as deploying some code.

There’s a couple of gotchas with the way Celery uses fork to run a task though, as it removes the environment that the Celery task is running in.

1. RNG must be re-initialized after fork(). Hint: Try Random.atfork()

If you do this:

@task
def update():
run('ls')

It’ll fail with the above error. The fix is to do what the error says:

from Crypto import Random  
    @task 
    def update(): 
        Random.atfork() 
        run('ls')

This will initialise the Random Number Generator sufficiently for the paramiko ssh library that fabric is based on to connect.

2. raw_input(“No hosts found. Please specify (single) host string for connection: ”)

You’re using fabric as an api, rather than using the fabric runner. This means the usual technique of doing:

from fabric.api import *  
env.hosts = ['192.168.0.1']

Won’t work, as there is no processing done on the env. The fix looks like this:

from fabric.api import *  
@task 
def update(): 
     Random.atfork() 
     env.host_string = 'ubuntu@192.168.0.1' 
     run('ls')

If you need to connect to multiple hosts, you’ll have to do your own flow control.

3. disable_known_hosts

This is more of a tip, and not a brilliant one at that. If you’re doing a lot of work with pregenerated VMs (such as the cloud providers), then destroying a VM on an IP, then rebuilding it, will cause the host key to change. Fabric uses your local .ssh/known_hosts for it’s connections, so this will probably cause the connection to fail as the keys will not match your previous one.

from fabric.api import *  
@task 
def update(): 
    Random.atfork() 
    env.host_string = 'ubuntu@192.168.0.1' 
    env.disable_known_hosts = True run('ls')

disable_known_hosts will disable this behaviour, at the cost of some security, as you are no longer verifying that you are connecting to exactly the same machine. The current alternative seems to be that every time you rebuild a VM, you must remove it’s line from your known_hosts.

Each and every Celery task you use with Fabric, must set these variables, or it’ll fail. I’d recommend either inheriting your tasks, or creating a helper method to pop them all in, and call that at the start of your task.

Hope this helps someone.

Posted via email from Tom's posterous

Monday, 3 May 2010

Some more smoke art

Had some free time today, and a sunny day to get some more light.
Decided to revisit some smoke photographs.

Pleasantly surprised to find that the new beta of Lightroom 3 can tether a 400D (despite the release notes saying it can't). Also some twiddling with Pixelmator, rather impressive program.

Got lots to experiment with, these are the first 4 off the press.

Posted via email from Tom's posterous

Sunday, 11 April 2010

Gadget Show Live and Cannock Red Trail

This weekend was the Gadget Show Live.
Lots of stalls and a live show. The stalls were fairly good, with some good discounts on stuff, and lots of stuff to play with. I got some more crazy shoes. The show was reasonably disappointing. Worth going too, but very little in the way of tech was discussed, and it seem to mostly be aimed at 10 year olds winning prizes. Although the flying penguins were rather cool.

Sunday was biking at Cannock Chase. 10.5 k, in 1:11. Not too shabby, and good fun. Much more technical trail than Sherwood Pines.

Posted via email from Tom's posterous

Sunday, 4 April 2010

Biking in the red.

Today, we went to Sherwood Pines again.
We attacked the Red route for the first time, which turned out to be a surprisingly enjoyable 15.5 km slog through some very, very muddy terrain.
Also, for the first time I got a decent GPS track of the event.

The Red is a decent trail, no huge climbs as the gradient of the terrain is fairly flat, but a good mix of up and down, and some 'swoosh'. Which today, mostly went 'Swoo-Splat'. Couple of jumps and dropoffs, which we mostly ran way from. Decent way to spend 3 hours.

Posted via email from Tom's posterous

Biking in the red.

Today, we went to Sherwood Pines again.
We attacked the Red route for the first time, which turned out to be a surprisingly enjoyable 15.5 km slog through some very, very muddy terrain.
Also, for the first time I got a decent GPS track of the event.

The Red is a decent trail, no huge climbs as the gradient of the terrain is fairly flat, but a good mix of up and down, and some 'swoosh'. Which today, mostly went 'Swoo-Splat'. Couple of jumps and dropoffs, which we mostly ran way from. Decent way to spend 3 hours.

Posted via email from Tom's posterous

Saturday, 3 April 2010

Kittens meet the Outside. Take 2.

In the ongoing quest to make sure the kittens can at least attempt to find their way home once they're properly released into the outside world, they have been out under close supervision again.
Mostly, there was a lot of panicking that they'd hid under cars, and were going to jump the fence.

No kittens escaped, and they were both successfully brought back in by the promise of feeding time.

More to come.

Posted via email from Tom's posterous