Tuesday, March 29, 2011

Controlling android via http(s) over usb

I've been playing with couchdb, and was playing with the paw web server for android (http://paw-android.fun2code.de/), and discovered something interesting.

* If you turn on usb teathering, then connect your phone to a linux box, it'll automatically add usb0 as a connection.
* If you grab the default route for usb0, you'll have the ip of your android phone.
* If you run paw, you'll be able to do things like send sms, control your phone, etc.
* If you run, (and tweak the config), you'll be able to connect to the couchdb on your phone
* You don't have to access these services via a web browser, (yay! SMS from emacs!)
* paw server also has stuff like "play music from phone", and "use phone as webcam", etc. etc. etc.

I suppose I knew all this was possible, but I didn't think it would be "done in 5 minutes" possible...

Monday, March 14, 2011

Python lockfiles

The python-daemon library has a nice implementation of pidfiles, much better than the standard lib lockfile. i.e.

import lockfile.pidlockfile as pidlock
lf = pidlock.PIDLockFile("/tmp/mqtask.pid")

# module methods
pidlock.read_pid_from_pidfile
pidlock.remove_existing_pidfile
pidlock.write_pid_to_pidfile