Archive for January, 2009

Python timing decorator

Tuesday, January 27th, 2009

I have been using python as my main scripting language for some time, but recently I wanted to profile some of my scripts to see why it was taking so long.

I looked at the python profiler but I keep looking for some reason.

Finally I found this code snippet (I don’t remember from where, maybe here one night at mccool s online )

You can use python @ decorator to wrap functions with timing metrics.

def print_timing(func):
  def wrapper(*arg):
    t1 = time.time()
    res = func(*arg)
    t2 = time.time()
    print '%s took %0.3f ms' % (func.func_name, (t2-t1)*1000.0)
    return res
  return wrapper

Then simply use like this

def some_func(n):
    //do work

This allows lots of control as you can put metrics on 1 or more functions.

Dans one piece ski suit

Tuesday, January 27th, 2009

I was talking to Dan recently and for some strange reason we got onto the top of one piece suits.

One piece suits for skiing to be more specific. We found some really good ones which Dan would look amazing in.

Dans 1 piece suit

I think he’d look great in the red spider man but he could get one like this one.

Dan could get a sumo suit

Heres Dan in his natural state for people who dont know him.

Dan on Thomas

St Anton 2009 Photographs

Tuesday, January 20th, 2009

Well we got back from St Anton at the weekend. It was a great week. Well it was a great week for most of us. One of our friends fractured his back. He will be ok, but he cant come to Les Arcs now.

Elgar, Sam, Will, Steve and I went for a week of snow and sun, with the odd day of white outs.

We took over 500 photos but I think I only uploaded about 460 in the end.  The full gallery is here.

rough around the edges live from madison square garden download murder is announced a movie download