Skip to main content

Posts

Showing posts from October, 2007

OLPC Telepresence update... Now known as Fido?

Albert suggested I call this project Fido. LGTM. I made a lot of progress on Fido this weekend. It now has an Arduino on board to control all sorts of fun things. Most importantly, it controls a working headlight (a fancy 100 lumen LED flashlight) and a relay to cut power between the OLPC and the Create. I made a custom end cap for the flashlight out of a PVC cap and some flexible black tubing that fits snuggly over the light so that I could hook it up to a transistor switch. I also committed many enhancements to PyRobot to support logging on the web UI, soft resets, and some bug fixes and error handling that improve robustness. For pictures, have a look at my Picasa Web album .
Read more

PyOpenDHT

I spent a little time today playing with OpenDHT and put together a little Python module for using it. I think it will make a great bootstrapping service for a darknet application. import sha import xmlrpclib # Other gateways listed at http://opendht.org/servers.txt. This gateway uses # OASIS (http://oasis.coralcdn.org/) to find the nearest node. GATEWAY = 'http://opendht.nyuld.net:5851/' # Application ID. APP_ID = 'PyOpenDHT'# Response code to human-readable code mapping. RESPONSES = {0: 'Success', 1: 'Capacity', 2: 'Again'} # Time to live for puts and removes. TTL = 3600 class OpenDht(object): def __init__(self, gateway=GATEWAY): self.server = xmlrpclib.ServerProxy(gateway) def _EncodeHash(self, value): return xmlrpclib.Binary(sha.new(value).digest()) def Put(self, key, value, ttl=TTL, secret=''): key = self._EncodeHash(key) value = xmlrpclib.Binary(value) if secret: secret = self._EncodeHash(secr
Read more

OLPC Telepresence, now with night vision!

I added night vision (aka flashlights) to my robot. I used an inverted Gorillapod to mount the lights. The next step is to get some relays so I can turn them on and off with the Arduino . From Fido
Read more

Whoopee! A blinking LED!

I just got my Arduino today and set up was pretty easy. My box is running Ubuntu Feisty. Download arudino-0009.tgz and extract it. Install avrdude, avr-libc, binutils-avr, gcc-avr, and uisp. Execute arduino-0009/arduino. Java was already set up in my case and I'm pretty sure not all of those avr related packages are necessary. But, it worked for me :) Update: I just discovered the Arduino Playground which has some nice articles on how to set up your Arduino on different platforms.
Read more

BOOM HEADSHOT!!!

FPS Doug: "Somtimes I think, maybe I want to join the army. It's basically like FPS but better graphics. But what happens if I get lag out there?? I'm dead! I mean, I even heard there's no respawn points in RL!"
Read more

The Pertelian, PyPert, and Xbox Live

I've published my code for controlling the Pertelian X2040 USB LCD display on Google Code Hosting as a new project PyPert . I've also included a script that uses PyPert to display your online Xbox Live friends.
Read more

Scraping Xbox Live

The ingredients in this BeautifulSoup are mechanize and ClientForm . You'll need to link your gamer tag to your Windows Passport at xbox.com before this will work. from BeautifulSoup import BeautifulSoup from mechanize import Browser WINDOWS_PASSPORT_LOGIN = 'youremail@yourdomain.com' WINDOWS_PASSPORT_PASSWD = 'yourpasswd' FRIEND_TABLE_CLASS = 'XbcProfileTable XbcFriendsListTable' GAMER_TAG_CLASS = 'XbcGamerTag' GAMER_PRESENCE_CLASS = 'XbcGamerPresence' br = Browser() br.open('http://live.xbox.com/en-US/profile/Friends.aspx') br.select_form(name='f1') br['login'] = WINDOWS_PASSPORT_LOGIN br['passwd'] = WINDOWS_PASSPORT_PASSWD br.submit() # Submit login form. br.select_form(name='fmHF') response = br.submit() # Submit redirect form. friend_list = response.read() soup = BeautifulSoup(friend_list) friend_table = soup.find('table', {'class': FRIEND_TABLE_CLASS}) for row in friend_t
Read more

Sample GSD App

"""Record and display shout outs for the life of the server.""" import gsd TEMPLATE = """ <html> <head> <title>Shout Outs!</title> </head> <body> <form action="/" method="get"> <input name="shout"> <input type="submit" value="Shout!"> </form> <? for shout in self.shout_outs: print shout, '<br>' ?> </body> </html> """ class ShoutOuts(gsd.App): """A simple GSD app that records shout outs for the life of the server.""" def __init__(self): self.shout_outs = [] def GET_(self, shout=None): """Display shout outs and form to add new ones.""" if shout is not None: self.shout_outs.append(shout[0]) self.Render(TEMPLATE, locals()) def GET_reset(self): """Reset the list of shoutouts.&
Read more

A different sort of web framework.

I present to you getshitdone , or GSD for the prudish. GSD is a web framework for those of us that just don't have time for those other frameworks. GSD Goals: An implementation in about 50 lines of code. Minimal work, maximum flexibility. No dependencies outside the Python standard library. GSD Non-Goals: Performance. Standards compliance. Working with Apache, Lighttpd, whatever. Here's a simple GSD Hello World app. import gsd class HelloWorld(gsd.App): def GET_(self): self.wfile.write('Hello World!') app = HelloWorld() app.Serve('localhost', 8080) GSD also has its own templating language. It's called Python. # Template helloworld.html <? self.wfile.write('Hello World!') ?> # GSD App class HelloWorld(gsd.App): def GET_(self): self.Render('helloworld.html', locals()) More documentation and examples to come on the project page.
Read more