Python

pyku

5 comments

It is semi-late.
I am semi-tired. Here's
my semi-haiku.

A haiku written
in python. My invention.
It is a "pyku".

if (self._blah and
    time.localtime() is late):
    self.go_to_bed()

That was pretty fun
plenty more of those to come
now I'm really done

New blog software

3 comments

You may not notice right away, but my blog is no longer running the proprietary
movabletype... it's now using shrubxery.

I finally got around to doing it this weekend. If you notice any problems with
the commenting system, links, etc. please let me know... please!

And yes, I will also be changing the look of my blog shortly too. One thing
at a time.

Happy birthday in python

2 comments

In a fit of genius while I was surfing the net, I came up with a python implementation of the song "Happy Birthday". It's totally sweet!

you = Person()

for i in range(0, 4):
    if i == 2:
        you.name = happy_birthday
    else:
        you = happy_birthday

Sometimes my genius is a little subtle, so here's how it works:
- 'you' is an instance of a 'Person' object.
- The 'you = happy_birthday' is assigning "happy_birthday to you".
- The third time through 'happy_birthday' is assigned to the person objects 'name'. So if the person objects name was 'Scott', this would be assigning "happy_birthday to Scott".

And just for fun, I wrote a one liner that will print out the happy birthday song, using python:

for i in range(0, 4): print "Happy Birthday", ((i == 2 and ("Dear Scott",)) or ("to you",))[0]

Shrubxery - A python implementation of blosxom

7 comments

So Leslie emailed me the other day asking for some help with setting up a blog for her that would let her run a photo blog, I guess her current blogger didn't allow for images. So we decided to setup blosxom. I had been meaning to base one of my projects at work on blosxom's plugin architecture, only blosxom is a perl script and I'm doing my work in python. So after looking at blosxom a bit more I was thinking about how hard it might be to re-write it comletely in python, and I had some free time this weekend so... I translated the code into python.

Shrubxery is a basic blogging system adapted from blosxom. The main idea is that the blogger is only a single, simple script that can basically only display text files, which are the blog entries. But the plugins give the blogger its power, and the plugin architecture allows the plugins to be powerful. It's pretty cool, really.

I started a sourceforge project here and the shrubxery home page is here. I'm still writing most of the documentation.

btw, did I mention that I plan on replacing this movable type install (that's what all the buffmuther blogs run off of) with the shrubxery...?