[an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive]

Nick's (often bad) Code Collection

I've been known to write code from time to time. On occassion, I may even post it here....

Python Code

  • Easy Timezone Converter (v0.1) ASLv2
    A simple commandline tool to convert between timezones. Ask it for "time WHERE in ELSEWHERE" eg "11am IST in Sydney" and it'll convert the time for you. Handy for quick queries.
  • Maemo AddressBook DB to vCard Exporter (v0.1) ASLv2
    Exports contacts from a Maemo (eg Nokia N900 / N9) addressbook db file to vCard contact files, for importing into other systems.
  • Munin ADSL Router plugins - Connection Speed and Noise/SNR - ASLv2
    Netgear DG834G
    Netgear DGN2000
    All of these require the telnet interface to be enabled on the router, the telnet login details to be given in the munin settings, and a suitable symlink to toggle between Speed and SNR/Attenuation/etc. See the script headers for more details.
  • S60 Python GPS Info Viewer (NMEA Bluetooth and S60 Location) (graphical) (v0.28) GPL (blog post)
    A graphical python program that talks to your gps, and does useful things with the information. It is able to talk to a bluetooth GPS (parsing the nmea data strea), or on S60 v3 phones with the LocationRequestor module, an internal GPS.

    The program displays your current location, speed and heading, satellites in view, satellite signal strength, the time, distance and direction to a point, and more. It optionally also dumps positions to a file, which you can later get off to see where you went (see upload_track). It can take photos, and add the Geo Exif headers to tell you where you were when you took it (requires PExif). Can also log GSM location, for use with gsmloc.org. Config menu coming soonish (maybe...), but for now the configuration is in the first few lines of the program.

    .sis files for end users:
    These .sis files include all the dependencies (eg geo_helper.py), and give you a meny entry for the program. However, you miss out on a lot of the configuration, which is still only in the code.
    You'll need to know what version of series 60 your phone runs. This page should help you.

    1st Edition / 2nd Edition: nmea_info_028.sis
    You need to have installed Python for Series 60 before you can use the application.
    3rd Edition: nmea_info_v3_028.sis (self signed - normally use this one)
    nmea_info_v3_028_opensign.sis (suitable for symbian open signed)
    nmea_info_v3_028_devcert.sis (devcert / open signed offline only)
    You need to have installed Python for Series 60 1.4.1 (or later) before you can use the application. To use an internal GPS, you will also need to install LocationRequester. Those of you with a devcert / open signed offline, you can get the sis from here. Those of you using open signed online need a sis file from the test UID range, which you can get from here. Either way, you need to ensure that both LocationRequestor and NMEA Info get signed for your phone with the full set of permissions.
    Those using open signed offline will probably want to use Ensymble, rather than crappy Windows tools, since the latter seem not to work reliably!
  • Track uploader for nmea_info.py (graphical) (v0.12) (blog post)
    This uploads tracks recorded with nmea_info.py (see above) via Bluetooth. It can upload either the raw NMEA capture, or a GPX file. It provides a nice way to offload your collected tracks to your computer via Bluetooth. GPL.

    End users will first need to install Python for Series 60, and can then download the following, to give them a nice menu entry:
    upload_track_012.sis (1st Edition / 2nd Edition)
    upload_track_v3_012.sis (3rd Edition, self signed)
  • Turn your S60 phone with an internal GPS (eg your N95) into a Bluetooth GPS (graphical) (v0.02) (blog post)
    Possibly slighty crazy, but there are times when you want to turn your expensive, GPS enabled S60 phone into a Bluetooth GPS unit. This python script will do that for you, allowing you to accept connections to the phone, or make an outgoing bluetooth connection. Once connected, constructs the NMEA sentences, and sends them off to the other device. GPL.
    You will need to have installed LocationRequester from here (open signed offline) or from here (open signed online), Python 1.4.x, and signed LocationRequester with your devcert / open signed online (get the right versions though!), and then either sign the s60_as_bt_gps sis file, or install it as a .py and ensure you've signed the python scripting shell.
    s60_as_bt_gps.py - use with a signed python scripting shell
    3rd Edition SIS file for dev cert - you will need to sign this with your devcert.
    3rd Edition SIS file for open signed online - you will need to upload this to symbian open signed online.
  • Location Requestor with testing UID range, for symbian open signed online
    This is a version of the LocationRequester .sis file, suitable for use with symbian signed online.
  • Python helper library for Geo Functions (v0.06). A python library for transforming lat+long into X,Y,Z (and back again), from lat+long in one co-ordinate system to another (Helmert transform), from lat+long into OS easting and northing (and back again), and so on. Very handy when writing GPS related code. Supports WGS84, OSGB and OSIE. Also does some limited stuff with Cassini-Soldner projections. Unit tests are here. GPL.
  • S60 Python NMEA Location Viewer (console) (v0.01). A script that displays your current location, based on the output from a NMEA bluetooth gps. Optionally also dumps position to a file. Doesn't do any fancy graphics stuff - just outputs to the python console. Useful base for more advanced programs. GPL.
  • S60 Python NMEA dumper (v0.01). A very basic script that displays the NMEA output of a bluetooth gps to the screen. Useful intro to NMEA bluetooth stuff. Public Domain.
  • S60 Python Lat/Long URL Loader (v0.02). Waits for a valid fix from a NMEA bluetooth GPS, then opens up a specified URL, including the lat and long as URL parameters. Useful to fire up location aware moblogging websites. You will need to customise the URL before uploading to your phone! Requires webbrowser.py (see below). GPL.
  • S60 Python webbrowser.py (v0.03). An implementation of webbrowser.py for series 60 python. Allows you to open the web browser to a given URL. (Must be installed as a Python Lib Module). GPL.
  • Planet.OSM powered "where am I" (v0.08). Uses a local planet.osm database to find nearby places or roads to your current location, returning them as XML or HTML. Depends on geo_helper.py (see above) and mini_osm.py and osm_io_helper.py. Latest versions now held in OSM SVN.
  • Planet.OSM powered "where is it" (v0.05). Uses a local planet.osm database to find where places (eg towns or cities) are, returning them as XML or HTML. Depends on geo_helper.py (see above) and mini_osm.py and osm_io_helper.py. Latest versions now held in OSM SVN.

Perl Code

  • My patches etc for PhotoPub
    PhotoPub is a GPL'd Photo Gallery program in perl
  • NMEA 0183 groker (v0.03). A basic script that accepts NMEA 0183 (the standard format for GPS data), and decodes it. Useful for showing you everything that your GPS is offering (which your software might ignore), and as a starting block for developing your own perl based NMEA programs. GPL.
  • An IMAP interface (v0.04) to SpamAssassin
    This uses Mail::IMAPClient to connect to your IMAP server, and filter all new mail through a local SpamAssassin. It can then optionally tag the mail, and / or move it somewhere. Now supports SpamAssassin 3.xx. Artistic Licence.
    You probably want to configure this to be run every 5-15 minutes by cron or similar.
    This version now supports multiple accounts. If you only have one, then only have one entry. Otherwise, define a username and password per server.
  • An IMAP interface to sa-learn (v0.06)
    This uses Mail::IMAPClient to connect to you IMAP or IMAPS server, and pass the mails through sa-learn, the Bayesian filter learner for SpamAssassin. It allows you to train the filter using mail located on a remote IMAP(S) server. Now supports deleting spams after learning. Artistic License.
  • Powerful IMAP interface to sa-learn (v0.02)
    Much like imap-sa-learn.pl, only with many more options. These new options give greater chances to delete all your email, but also allow for saving learnt messages to other places etc. Artistic License.
  • How to Mail Mail::IMAPClient play nicely with SSL (v0.01)
    This shows you how to get the perl Mail::IMAPClient to log into an SSL server (not quite as easy as it should be). Could also be used as a starting point for a TLS version. GPL/Artistic dual license.
  • Show IMAP Headers on the command line (v0.01)
    Useful if you think your imap server is loosing headers when using one of the SpamAssassin scripts. Shows you the contents of a "get the whole message" command, and also the contents of "get me every header" command. Artistic license.
  • CGIAuthHandler.pm (v0.01), a simple pure perl user authentication scheme. Uses an Apache password file to check usernames and passwords, then sets cookies to verify repeat request from a client. Suitable for use in very minimal environments, such as being cut and paste into a SafePerl script. GPL'd.
  • Safeperl script de-moduler (v0.01). Turns a script into something that might work in a safeperl environment. Locates modules that are used, and tries to roll these in. Tweaks sort calls, works around a few known issues relating to "foreach my" etc. Handy if you want to write safeperl friendly scripts but using some pure perl modules, and only pull it all together when you put the script live. GPL'd.
  • X509 Certificate Splitter
    If you have a X509 certificate file with several certificates in the file, then this code will seperate them out.
  • HTML on Asimov's site to plain text converter (v0.02)
    Turns the stories from Asimov's archives into a plain text file suitable for sending to palms, mobile phones etc for easy offline reading. Now supports many accents (uses ISO-8859-1 as the character set, as that's what my phone and my laptop both use).

Random Stuff

Nick Burch <code@gagravarr.org>

[an error occurred while processing this directive]