RichardNeill.org

Scripts and Source Code

Introduction

I've written quite a lot of bits of software: this page collects them in one page.

Linux Utilities:

  • help_to_man - write documentation once, inline in the program ("myprogram -h"), then autogenerate manpage from the Makefile.
  • trashcan - a trashcan script (use "cn" instead of "rm").

Hardware control:

  • PulseBlaster - a driver, utilities, and parser for the SpinCore PulseBlaster digital timing device.
  • NI 4462 - National Instruments NI4462 - in C, under Linux. Data-capture code and lots of experimental notes.
  • Arduino delay - manage a variable-length FIFO delay-line via an Arduino, from the Linux command-line
  • FTDI245 module - bit-banging a USB 8-bit parallel-port in C.
  • QuickUSB module - Linux Kernel driver for a USB 2.0 fast 16-bit parallel-port device.

Physics PhD:

  • Maths - some Python programs to plot data to graphs, with optional FFT and linear-regression.
  • IRCamera - control utilities (for my PhD camera, not widely useful elsewhere).
  • Cam2Tiff - convert the .cam format to a .tiff file (may be useful as an example of using libtiff)
  • Filterctl - control the filterwheel (purely for documentation of my PhD camera system, no use to anyone else!)
  • Hawaii simulation - simulate the Hawaii sensor (purely for documentation of my PhD camera system, no use to anyone else!)
  • Hawaii sensor - characterise the Hawaii sensor (purely for documentation of my PhD camera system, no use to anyone else!)
  • See also hardware control: PulseBlaster, NI4462, Arduino, FTDI245 and QuickUSB.

Fun stuff (toys):

  • Dinner Dog Daemon - a Wifi enabled Raspberry Pi mealtime announcer, with Phone app. Self-contained and complete.

Odds and Ends (one-off hacks):

  • RioFix - create the required misdirected-playlist structure to make .m3u playlists work rightly on the Rio Karma MP3/Ogg player.
  • ADSL Watchdog - monitor script to automatically reboot the Comtrend Nexuslink 5631 router when it hangs.

All of this is Free Software, which you are welcome to use, repackage and distribute. It's mostly GNU GPL v3+, though some are GPL2 or GPL2+; check the relevant README.



Linux Utilities

help_to_man (generate man pages from -h)

Introduction: Manpages are really important and frequently neglected. This script makes it really really easy to automatically generate well-formatted man pages in your Makefile. This is an "improved" version of help2man.

Download: help_to_man has the full details, an example, and a howto.


cn (a trashCaN script)

Introduction: How many times have you typed 'rm somefile', and then wished you hadn't? Do you want something more helpful than merely the advice to keep regular backups?
cn is an alternative to rm: this is a much safer habit (it also improves on the habit of expecting alias rm="rm -i" which isn't always present on all machines).
This shell-script with the Freedesktop.org trash specification, so it works with the KDE and GNOME GUIs, and it prompts exactly once, no matter how many files/dirs you are trashing.

Download: cn-1.21.tar.bz2, then untar, make, sudo make install. Invoke as cn and see man cn.

Update: you can achieve almost the same effect by adding this line to your ~/.bashrc:
function cn(){ /bin/mv -f --backup=numbered -- "$@" $HOME/.local/share/Trash/files ; }


Hardware Control

PulseBlaster

Introduction: this is a driver, utilities, and parser for the SpinCore PulseBlaster digital timing PCI device. The PulseBlaster can drive 24 TTL lines with very high precision with pulse lengths from 90ns to 2 years.

Download: full details are here.


NI 4462

Introduction: The National Instruments NI4462 is a 4-channel 24-bit 200 ksps data-capture device. Here's how to drive it in C under Linux. Data-capture code and lots of experimental notes.

Download: full details are here.


Arduino delay

Introduction: This is the interface between the Linux command-line and some hardware (a variable-length FIFO delay-line) via an Arduino.

Download: full details are here.


FTDI245 module

Introduction: the DLP-USB245M module is a USB 8-bit parallel port, which can be bit-banged from Linux. (Most of the work is done by libftdi).

Download: full details are here.


QuickUSB module

Introduction: the QuickUSB module is a fast USB 2.0 16-bit parallel-port (with additional GPIO). This is a kernel driver to drive it from Linux.

Download: full details are here.


Physics PhD

Maths

Introduction: some Python programs to plot data to graphs: dataplot, fftplot (does FFT) and linregplot (does OLS linear-regression).

Download: full details are here.


IRCamera

Introduction: These are control utilities for my PhD camera (not widely useful elsewhere).

Download: full details are here.


Cam2Tiff

Introduction: convert the .cam format to a .tiff file (may be useful as an example of using libtiff).

Download: full details are here.


Filterctl

Introduction: control the filterwheel in a dewar (purely for documentation of my PhD camera system, no use to anyone else!)

Download: full details are here.


Hawaii simulation

Introduction: simulate the Hawaii sensor (purely for documentation of my PhD camera system, no use to anyone else!)

Download: full details are here.


Hawaii sensor

Introduction: characterise the Hawaii sensor (purely for documentation of my PhD camera system, no use to anyone else!)

Download: full details are here.


Fun stuff (toys)

Mealtime announcer (Dinner Dog Daemon)

Introduction: What do you get when you cross a Raspberry Pi with a Bliso, and a smartphone? Answer: a wireless desktop gadget that announces when meals are ready. This complete project was originally designed as a birthday gift; now you can make your own...

Download: dinnerdog describes the project, with photos, and the source-code.


Odds and Ends (one-off hacks)

rio-playlist-fix.sh - fix the playlists for a Rio Karma

Introduction: The otherwise excellent Rio Karma music player has a bug in playlist handling causing it to look in the wrong directory.

Download: rio-playlist-fix.sh then chmod +x and run it. Read the source first: it's straightforward, but it does hardcode "MUSIC_DIR" in the script, and it assumes that you do not have spaces in any of your filenames.


adsl_watchdog.sh - automatically reboot a router via the telnet interface

Introduction: The Comtrend Nexuslink 5631 (line bonding ADSL router) can get stuck; it's useful to monitor and automatically reboot it. The problem is explained here.

Download: adsl_watchdog.sh then change the "ROUTER_PASSWD" value, chmod +x and run it. To invoke it from cron, add a line such as this to your crontab:
01 * * * * /home/[YOUR_USERNAME]/bin/adsl_watchdog.sh
[Make sure your router has the telnet port accessible from the LAN.]