countertony.org.uk

Python Scripts

So far, the vast majority of 'for fun' coding I've done has been in the Python scripting language. I first got started on it when I was working at NPL, where along with its Win32 extensions it allowed to me to automate document creation in Microsoft Word relatively painlessly.

While I was learning how to use Python, I made a number of 'toy' scripts - ones that performed small tasks, usually to automate repetitive jobs - such as batch file renaming, which I found to be inordinately difficult to do in Windows. In some cases, the purpose of a program was merely to do extremely basic, though tedious, mathematical calculation (for example, if I walk x metres on a world of circumference y metres, then how much further has my head travelled than my feet, given that I am 178 cm tall?).

The listings linked to here provide a few examples as plain text. Feel free to use, extend or modify them as you wish - if you think I might be interested in the resulting creation then give me a shout.

This script generates a file in the current working directory containing the compton scatter distribution at energy arg[1] at filename arg[2].

This script outputs your computer's (local) IP address and host name.

This script is a basic metronome.

This script provides reference pitches for tuning.