Golden Gate Bridge and Downtown viewed from Marin at sunset, San Francisco, CA.
Home / Code

Code Libraries for Public Consumption

Creative Commons License
(Some rights reserved. All code licensed under a Creative Commons License.)

Here are some libraries I've written for various projects. They are not guaranteed in any way; use them at your own risk. Feel free to distribute them but please credit me where appropriate and make sure to note any changes you make to the libraries so that I am not held responsible for work I didn't do. If you improve upon any of these libraries, please send me a copy!

For the Perl scripts, set tabstops to 6 spaces or you'll get lines longer than 80 and some alignment failures... I can't remember what's right for MatLab stuff, probably the default for the MatLab editor, which I think is 3 spaces?

VIM syntax highlighting for Igor Pro

Very simple syntax highlighting for Igor Pro. I will probably continue to update this, so check back for more updates. To get working, follow instructions in :help new-filetype. Last update: April 18, 2007

Fast Search Shorthand Regedit for Internet Explorer and Firefox

Okay, it's not a library, it's a RegEdit, but it could be useful for a lot of people. Microsoft Internet Explorer has a search shorthand mechanism built into it, much like the "keyword search" function in Mozilla. IE has had this functionality since verion 5.5, it just hasn't been publicized much (probably because you have to edit your registry to get it to work).

The upshot is that you can do nice, fast searches in IE just by typing, for example, "w opera" into the url bar; if your registry is configured appropriately, this will send you straight into a search for opera on Wikipedia, or wherever you configure it to look when it sees "w".

Newer versions of FireFox will automatically import these settings from your registry when you run Import IE Favorites.

Here, you can download my SearchUrl.reg file that I've compiled of search shorthands I find useful: google, amazon, wikipedia, library of congress, copac, hubmed, yahoo finance, etc. If you download and double click this on a windows machine, it will install my shorthands to your registry directly. I suggest that before you do this, you read through the file in notepad and get an idea for how it works, check to see what shorthand I picked for different sites, change them if you'd like, etc. Once you've read through the file, you can probably figure out how to add more search functions. Feel free to email me with any questions.

I update this file once in a while, so check back for more useful searches. Last update: April 17, 2006

Windows Explorer launch script for CygWin users

A simple perl script to launch a Windows Explorer window at a given directory. Relies on the CygWin utility 'cygpath'.

Another useful tip for cygwin users:

alias ie '/cygdrive/d/Program\ Files/Internet\ Explorer/iexplore.exe'
This is particularly useful if you are using a fast search regedit, as described above.

CStruct library for MatLab 5.3

I wrote this library to allow easy, flexible reading of complicated structures in MatLab 5.3. It is modelled on the struct system in ANSI C. My MatLab libraries were written for MatLab 5.3 and may have bugs in later versions.

CStruct library zip file

Neuroscan library for MatLab 5.3

This is the bulk of the functions I used for my undergraduate honors thesis analysis. They import NeuroScan software's proprietary .CNT and .EEG formats into MatLab 5.3, as well as provide some tools for typical ERP analysis. The Neuroscan library requires the pre-installation of the CStruct library.

Neuroscan library zip file

Serial PHP library for PERL

These functions allow for PHP serialized string data to be read into PERL referenced hash tables and vice versa.

Serial PHP PERL file

Library renewal script

A PERL script I wrote to renew library books automatically. Will login to a user account with provided $login and $passwd and report whether there are any items due in the next few days (within the $dueGraceDays). If a $renewGraceDays is also provided, the program will also attempt to auto-renew any materials due within that period and report the new due date or warn of renewal failure. Ideally can be invoked by the cron daemon or some comparable scheduler to run once every day.

Currently in version 0.51. Should be readable IMHO. Error handling is minimal and designed to die gracefully and quietly as we don't want a bunch of crap printed to cron in most cases. Currently works for San Francisco Public Library and UCSF Library. Many other libraries should be easily implementable so long as they have comparable patron interfaces. See libdex for directory of other libraries with Innovativearchitecture interfaces.

SFPL Renewal PERL File

PERL classes for stop parsing for San Francisco MUNI on

The website can be used to get instantaneous GPS information for a number of public transit agencies. Since the web is our only access to the info this company provides, I wrote an OO Perl package to interact with the web site (i.e. a screen scraper). The Agency class can be built up dynamically by determining the routes and stops for a particular agency using the Nextbus class, or you can use a prebuilt representation of the Agency, e.g. the SFMUNI helper class. The Agency object will know a lot of information about the agency as implemented on the Nextbus website, allowing you to make GPS queries with GET arguments appropriate to the Nextbus web interface. Only an early alpha/beta version right now, so not much documentation, no error checking, etc...


All content licensed under a Creative Commons License.
XHTML 1.0 Validated and CSS Validated by the WWW.
WAI AAA and Section 508 Approved by Bobby.CAST.
Creative Commons license button ' XHTML certification button ' CSS validation button ' AAA certification button