Chars

May 17, 2011

Firing huge 600 character mortars across each others bows,
Deafening one another with our pent up hurt,
Indignant that our opponent isn’t listening.

Here’s a thing.

You know how you’ve always felt a bit uneasy when you’ve passed a string into javascript’s new Date(), even when you know it’s in perfectly respectable ISO format?

Well it doesn’t work at all on my phone (Android 2.1 running WebKit 3.1).

Bummer.

Give new Date() a timestamp instead. Here’s some dirty python to generate just that:

    import time
    return int(time.mktime(the_date.timetuple()) * 1000)

We’ll fret about timezones later

My sleepy bunny

March 11, 2011

My sleepy bunny sleeps all day long
and whiles he sleeping he dreams up a song…
About a pirate who digs up some treasure
and whiles hes digging he starts to measure…
He starts to measure a telescope
filled with seweed and lots of hope…
The hope says “I’m not afraid
but please let me join your ambulance aid”…
The seweed said “Of course you can
but promise not to drive my little van…
Seweeds little ambulance had lots of chance
to rescue fish from the underground ants…
And the underground ants started to dance
to lots of pop and rock…
The ants like pop the best
and somtimes they wear their best VEST!

Ruby Miller

Peas with herbs and feta

September 21, 2009

Not sure of the provenance of this, I suppose it’s a bit mezze.
Oddly comforting though and a useful store cupboard standby.

Preparation time
5m
Cooking time
10m
Difficulty
1
Serves
4

I really must get a better camera

Ingredients
  • 600g frozen peas
  • 200g Feta
  • 4 tblsps nice olive oil
  • 2 spring onions
  • 1 bunch of parsley
  • ½ bunch of mint
  • ¼ bunch fresh oregano (optional)
  • Squirt of lemon
Preparation

Drop the peas in boiling water and let them come back up to the boil, leave them there for a couple of minutes, then drain.
Pour the olive oil into the warm pan and add the finely chopped spring onions. Swirl around a bit, then add the peas, the crumbled feta and the finely chopped herbs.
Add a grind of pepper and a squirt of lemon to taste.
Eat warm.

A smutty, filthy, dirty little shell script to toggle screen rotation on my netbook.

The results of xrandr -q will probably be different depending on what graphics set up you have, so adapt it to suit your needs. Compare the output of xrandr -q when the screen is in a normal rotation to it when it’s rotated right (xrandr -o 1 or xrandr -o right) and grep for the difference.

This is really useful when I want to read a long article or admire something in portrait mode. Now just need to work out how to rotate the trackpad input as well…

#!/bin/sh
if [ "`xrandr -q | grep 'current 1024 x 600'`" != '' ]
then
	xrandr -o 1
else
	xrandr -o 0
fi

We had a need the other week to churn out the skeleton of a site to see how the different areas fitted together.
As the thing was being written in Django anyway I put together this quick ‘n dirty utility that renders the reStructuredText docstring of a view to the returned response, so you can quickly put in page furniture and links to other views without having to go to the effort of creating templates.
Better still, as it’s implemented as a decorator on the method, it’s easy to swap out once you get around to writing the actual view code.


def docview(fn):
    from docutils.core import publish_string
    from django.http import HttpResponse

    r = HttpResponse(publish_string(
            source=fn.func_doc,
            writer_name='html'))
    
    return lambda rtn: r

Then decorate your method:


@docview
def fast_view(request):
    """
===========
A Fast View
===========

With links to:

 * `An even faster view </faster_view>`_
 * `Somewhere else <http://google.co.uk>`_
 
    """

Which will render something like:

A Fast View

With links to:

#!/usr/bin/env python
import sys, urllib2, twitter

def main(*args):
	try:
		t = twitter.Api('A_VALID_USER', 'A_VALID_PASSWORD')
		f = t.GetFriends(user=args[1])
		if any(u for u in f if u.screen_name == args[2]):
			print 'yup, %s follows %s' % (args[1], args[2])
		else:
			print 'nup, %s does not follow %s' % (args[1], args[2])
	except urllib2.HTTPError, e:
		if e.code == 404:
			print "soz, %s isn't a user" % (args[1])
		else:
			raise e

if __name__ == '__main__':
	if len(sys.argv) > 1:
		main(*sys.argv)
	else:
		print "who follows who?"

A hackity hack to find out if one twittard is following another.

You’ll need python-twtitter and simplejson, just do:

> python twit.py twittard1 twittard2

or stick it in ~/bin and chmod +x it, a la caolan’s suggestion

My cute and shiny little brown Acer Aspire One arrived today and very cute and shiny it is too. Did I mention it was brown? I’m writing on it right now dontcha know.

Being a twitchy geek I was switching Linux distros as soon as it came out of the box. It comes with the perfectly reasonable Linpus on it, which derives from Fedora 8. I switched to Easy Peasy though which is based on Ubuntu and has Debian packagey niceness all over it. You can find it here

It installed off a USB stick and after a moment of mild panic triggered by not being able to see any wireless networks (a reboot seemed to sort this out) everything was peachy.

One annoying thing (which is mostly the reason for this post) is that on reboot, the installer tries to do it’s thing again. This is to do with the Ubiquity installer being left in the session start up. To stop this go to System >> Preferences >> Sessions and uncheck Ubiquity in the start up programs list.

Whilst you’re there, if you want a more classical looking desktop, uncheck Maximus and Netbook Launcher.

But only if you want to you understand.

Lydell End 2050 sketches

February 20, 2009

So, I’ve failed in getting my arse in gear over this, but have come up with some  ideas which Ru and I sketched out the other day.

This is Ru’s cubist masterpiece:

ru_house

Very Braquian I thought.

Mine should be considered more of a technical illustration, coming up with a plan of attack sort of thing. Okay, so I’ll admit, hers is better than mine:

me_house

The idea behind it is, if you have friends or family staying over, you flick a switch and another storey sort of concertinas it’s way out of the roof space.

It was partly inspired by a cartoon I saw years ago, probably by Tex Avery, that described life in the future. One of the gadgets was an instant house that came the size of a matchbox, to which you just added water and pop!

Update: The cartoons were by Tex Avery and they were a series of shorts he did called “…of Tomorrow”.
More here

Updated update: actually try here and you don’t even have to add water.

Lyddle End 2050

January 27, 2009

Couldn’t really be any more exited without rupturing something.

I came across Russell Davies’ Lyddle End 2050 Challenge the other day and penned him the following (terribly polite) email:

—-

Hi Russell,

Following an extended shamble around the internet the other day, I came across the inspired Lyddle End 2050 project and wondered if I could get involved?

Having just read the latest (15th Jan) post, I understand I might be a bit late for buildings supplied by you, but was hoping you might be able to give some guidance on obtaining the materials myself as well as any particular aspect of future culture that might be missing from the diorama (or at least what has been already created, so as not to repeat efforts).

Yours in anticipation

Ben Miller

—-

He very kindly replied with advice on where to find more information and the only real restriction on materials (anything in the N Gauge, Lyddle End / Hornby range).

So I giddily went out to the model shop on saturday (which, to top it all off, was my birthday) to get me a tiny house!! LOOK AT IT!!

Small Stone House

I’ll post some sketches for ideas when I get my scanner working.

Follow

Get every new post delivered to your Inbox.