Plan Zero

Hello, there!

Blog

Showing posts from 2012. Filter to May, April, January.

A slice of Raspberry Pi

Published

Raspberry Pi unboxedMy Raspberry Pi arrived on Tuesday! It's now Thursday and I haven't had much time to play around with it yet, but I have installed the Debian image and checked that everything is in working order.

Raspberry Pi booting upThe thought that my Pi may be DOA crossed my mind shortly after it arrived when I installed Debian onto the SD card, plugged everything in, and nothing seemed to happen. The power light was active, but the "OK" light remained dark. After doing some troubleshooting I found out that the 8GB SanDisk Class 10 SD card I was using is known to be a problem SD card and won't work with the Pi due to a bug in the Broadcom bootloader. Luckily, the SD card in my camera was compatible, so I swapped them over and installed Debian. This time both the power and "OK" lights lit up, along with the network lights a few seconds later.

The problem I now faced is that I had no HDMI to DVI cable so I couldn't actually see anything. Debian uses DHCP to get an IP on boot so I tried a quick network scan with nmap, but SSH wasn't open on the Pi; it turns out it's disabled by default for security reasons. Probably a good idea given the default username and password and keenness to connect to the network. I plugged in my old Happy Hacking keyboard and took a stab at blindly enabling SSH, which worked. For anyone in the same position, enter pi followed by raspberry to log in, then sudo /etc/init.d/ssh start to start the SSH server.

Uploading any file to Google Docs with Python

Published

I recently had a discussion with a client of mine who mentioned that they manually upload backups of their website to Google Docs, that they had always wished that there was a way to FTP them up to save time. That's an interesting idea, said I, I just happen to have written a Google Docs API interaction class in PHP which can be used to upload files to Docs. I wondered whether I could do the same thing in Python and automate the whole backup process…

It turns out that it's actually quite a simple thing to do using Google's GData Python library and a little patience with Google's API documentation.

System uptime in Python, a better way

Published

I've been working on a system monitoring tool which needs determine whether the uptime of a Linux slave machine has changed since it last reported in. I looked through Python's online documentation and it turns out that there isn't a function among the standard modules for doing this (not even in the handy os module).

I did some searching around to see how people were getting the uptime of a host in Python and a surprising number of people advocate launching a subprocess and calling Linux's uptime command, then parsing the output. But there's a much better way!