I'm migrating my site to ikiwiki. This page is deprecated in favor of the new code feed.


(You can see some of my experiment-specific code.)

Please email me with any question, advice, bugs,... or just to let me know you're using my software.


Moved here.


Moved here.

Debugging macros

I've put together a set of macros to make debugging easier. One day I'll learn how to use gdb, but until then...

Stem and leaf plotter

Clean, compact histograms in ASCII. stem_leaf.c


Moved here.

Simple alarm

Moved here.

Search PDF files

Grep on PDF files. grep_pdf

Sort by date

Where did I put that file I was working on yesterday? Your friend ls has lots of nice sorts built in.

find ~ | ls -lt

Setup passwordless SSH logins



Bundle the activity for publishing a Git repository to a remote HTTP server into a single script. The easier it is to publish, the more likely I will be to do it ;). You'll need Git installed on the remote machine as well for git --bare update-server-info.

git-publish ~/src/repo username@publichost:./public_html/code/git/


Moved here.


Monitor a directory for new datafiles. When a new file is written, generate a png from the data, and do something with it (e.g. display, scp to web server, ...). Useful for watching the data come in while remotely logged into the experiment computer, and a simple example of inotifywait in action. monfold



I've tweaked Shane Hathaway's daemon.py example for cleaner logging. I added rotating logfiles. I also added a nice piece of work by Peter Parente at Jambu which also shunts errors printed to stderr into the logging system. daemon.py


Moved here.

Plot click locations

Moved here.

Splittable **kwargs

It is very convenient to define python functions that take the argument **kwargs (see this tutorial for an explanation of the syntax and example 2b for an example of why it is useful). However, if your chain of **kwargs functions branches (e.g. a() calls b() and c()) you need some way of splitting kwargs into a dict for each child function. This module is how I do it.

Easy install

easy_install -f http://www.physics.drexel.edu/~wking/code/python/ splittable_kwargs

or Git

git clone http://www.physics.drexel.edu/~wking/code/git/splittable_kwargs.git splittable_kwargs

or tarball.


Moved here.

Quick hull

Calculate convex hulls of points in two dimensions and determine if new points are inside the hull or not. Derived from the LiteratePrograms version.

Easy install

easy_install -f http://www.physics.drexel.edu/~wking/code/python/ quickhull2d

or Git

git clone http://www.physics.drexel.edu/~wking/code/git/quickhull2d.git quickhull2d

or tarball.


Moved here.


Access and edit grades in a Google Docs Spreadsheet from the command line. Not much going on here, since the GData Python client does most of the heavy lifting.

Show all the columns in the spreadsheet PHYSICS 101 Grades, worksheet Physics101Grades. Log in using google account jdoe.

ggrade.py -u jdoe -s 'PHYSICS 101 Grades' -w 'Physics101Grades' -L

Show grades for all students on the assignment Week1.

ggrade.py -u jdoe -s 'PHYSICS 101 Grades' -w 'Physics101Grades' Week1

Enter some Week1 grades

echo -e "Jack Sprat\\t0\\nMiss Muffin\\t1\\nMother Hubbard\\t1\\n" > grades
ggrade.py -u jdoe -s 'PHYSICS 101 Grades' -w 'Physics101Grades' Week1,grades

Ubuntu claims to package python-gdata, but it was broken for me, so I had to install the 1.30 source on my own (which is not difficult, see here).



Access and edit grades in an Open Office compatible spreadsheet from the command line. The interface is almost identical to that for GGrade, so however your professor/department wishes to keep track of grades, you don't have to leave the command line ;). I'm still trying to find a way to do this without needing and X-server running...


My wife is resistent to mounting our home fileserver over NFS, but she wants to be able to browse through my picture directory. This script generates simple HTML gallery pages with thumbnails to replace Apache's default list o' files.

$ tree
|-- some_directory
|   |-- a_picture.jpg
|   |-- another_picture.jpg
|   |-- ...
|-- another_directory
|   |-- a_picture.jpg
|   |-- captioned_picture.jpg
|   |-- captioned_picture.jpg.txt
|-- ...
$ gallery.py some_directory another_directory ...
$ tree
|-- some_directory
|   |-- a_picture.jpg
|   |-- another_picture.jpg
|   |-- ...
|   |-- <GALLERY>
|   |-- <THUMBDIR>
|   |   |-- a_picture.png
|   |   |-- another_picture.png
|   |   |-- ...
|   |-- <PAGEDIR>
|   |   |-- a_picture.html
|   |   |-- another_picture.html
|   |   |-- ...
|-- ...



Image click locations

Moved here.


Simple page format package

Moved here.

Assorted useful macros

Moved here.

Problem set writing package

Moved here.



Simple sticfigure class. Currently just waves arms in sync. No knees, elbows, etc. All the sizes and ratios are easy to change.

import stickfigure;
StickFigure s = StickFigure(standsOn=(1cm,2cm));
s.armAngle = 20;



Useful functions for drawing Physics 101 figures.

Mechanics.asy (also the test suite Mechanics-test.asy and the test output)


Useful functions for drawing Physics 102 figures.

ElectroMag.asy (also the test suite ElectroMag-test.asy and the test output)


Useful functions for drawing circuit diagrams.

Circ.asy (also the test suite Circ-test.asy and the test output)