I’m in the process of trying to make available code I’ve written and related technical material like useful configuration files that might be of use to others. All code is under the BSD3 license (which I’ll get around to adding to everything at some point), so you can do whatever you want with it. Descriptions and links for browsing or download follow:
Some (mostly standalone) Java utility classes that I use frequently. For more information, see here.
The beginnings of a library for working with RDF in Haskell.
For more information, visit the project page.
A program and an associated library supporting bulk file and directory name normalization.
For more information, visit the project page.
A module with various commonly used math functions that I’ve accumulated over the years while doing Project Euler problems and throwaway calculations.
A program for locating and identifying broken PDF files.
pdfchecker.py takes one or more directory args, and it recursively processes each directory, checking each PDF file found. For each PDF file, it tries to open the file and to retrieve a few random pages. It writes to stdout the paths of all PDF files that were identified as broken. It depends on the poppler-python project, which provides Python bindings for the Poppler library.
A module providing some basic linear algebra operations.
The functions cover the standard basic operations on vectors and matrices. If you are looking for an efficient and complete linear algebra module, this isn’t it. This module is intended just as a simple (no install, no dependencies) way of double-checking some of the more tedious linear algebra stuff as I worked my way through a linear algebra text.
A trivial Django app that can be added to a Django project to provide an HTML page that displays all currently loaded modules, useful perhaps for determining that a module is no longer used and may be deleted.
See the README inside the tarball for more info.
An in-progress library of generic data structures and algorithms for C, currently providing list, stack, heap, vector, hashtable, binary search tree and randomized binary search tree, with algorithms including select n, partition, and heap sort. See the README for more info. It still needs lots of work (release early, release often), so I wouldn’t recommend using it yet unless you don’t mind the occasional debugging session and aren’t using it for anything critical.
The library can be built with the usual configure and make commands, and there is also a check target to run the tests and an install target to install. There are also targets to uninstall and to generate the API documentation (make doxygen-doc).
At some point, when it’s been tested more and is stable enough, I’ll make a real release. For now, the latest version of the code is available via Darcs at http://protempore.net/~calvins/code/c/cdsa/. After checking out the Darcs repo, you’ll have to first do something like the following: autoreconf --install, followed by the usual configure...
Split a large text file or text stream into 2 files. This is functionally equivalent to doing 2 passes over a file with the standard head and tail Unix programs but does it in one pass. It is written in C99 and should be portable.
As compared to the standard GNU split program, which allows you to split a file into multiple same-sized pieces, this program allows you to split a file into just 2 pieces, but the pieces can be any size. This isn’t possible using GNU split unless the size of the first file is at least half the size of the total (original) file.
The following are the source and header files, as well as a required configuration header file. The tar.gz download is for all of the above as a project, including a configure script and a Makefile. The program can be installed via the usual ./configure; make; make install routine, and there is an uninstall target too. If you want to install it as a non-root user, substitute ./configure --prefix=$HOME for the configure step.
An ebuild for installing Python bindings to the Poppler PDF library.
Get the ebuild here. To install the library, do something like:
DIR=/usr/local/portage/dev-python/python-poppler
mkdir -p ${DIR}
cd ${DIR}
curl -O http://protempore.net/~calvins/code/scripts/python-poppler-0.10.0.ebuild
ebuild python-poppler-0.10.0.ebuild digest
echo '=dev-python/python-poppler-0.10.0' >> /etc/portage/package.keywords
emerge -av =dev-python/python-poppler-0.10.0
An in-progress Zyzzyva ebuild for the Zyzzyva program, which is a word program relating to Scrabble and vocabulary building.
The ebuild is not working at the moment, but I don't have more time to work on it. Perhaps someone will find it useful as a starting point, since it is almost working. Problems are described in the ebuild file itself.
A configurable script that reads login information, using `last`, and verifies that all logins came from expected IP addresses. If there was a login from an unknown IP address, it emails the admin with information about the unknown login.
I use this to notify myself when my home dynamic IP address changes (which is quite infrequent). The first time I ssh into my server, it sends me an email with my new address. I run it via cron every half hour.
portageconfedit.sh is a script that allows users of Gentoo Linux to allow non-root users to edit certain very commonly edited configuration files (/etc/portage/package.keywords and friends) in a reasonably secure manner, using sudo and sudoedit. Look inside it or save it and run ./portageconfedit.sh --help for more details.
exec_shell_function.sh is a script that can be used to expose a user-defined shell function to non-shell processes as if the function were an executable. For example, to expose a function called update_confs, you would create a symlink to this script with the name run_update_confs. The script would then invoke the function update_confs (with any arguments being passed through) as if it were a normal executable. See script for more details. This is especially useful if you use something like dzen, which provides a simple way of invoking any executable but only knows about executables on the PATH and not any user-defined shell functions.
The following is what I use for shell initialization. It provides a ton of aliases and convenience functions, and provides a way for user-defined additions. I still need to clean things up a bit more when I have time, but I’m putting it up as now because it might be of use to others already, even if for nothing but finding some functions and aliases that can be reused.
So what does it provide?
If you have keychain installed and define SSH_KEYFILE to point to your OpenSSH pub key file, then keychain will be started automatically if not already running. If you additionally define SSH_KEY_APPS as a space-delimited list of program names like "ssh scp rsync darcs hg cvs", then aliases will automatically be defined for each of these apps so that when you invoke the app, your keyfile is added to ssh-agent if not already added and not expired yet. You can set a default timeout for each username@hostname combination you want, since you might want your laptop key to expire much sooner than your desktop key, or root user to expire much quicker than a non-root user. This saves you from having to remember to manually call ssh-add to register your key, and makes using ssh pub key authentication as convenient as it can be without doing something silly like using no passphrase on your key.
The keychain app also starts a gpg-agent process, which I don’t have any configuration options for yet.
See the documentation inside the script for other stuff that it provides.
This site is valid XHTML+RDFa, CSS.