Scratch Code


Here are some code snippets that are too small to warrant their own section, but might be worth looking at for whatever reason.

Xbox 360 USB Controller Digital Trigger Mod


This is a mod to the Linux xpad driver for Xbox / Xbox 360 controllers. I had some problems with the analog shoulder triggers on the Xbox 360 controller, where it seemed to get stuck in some of the programs I used, so this mod changes the driver to treat the analog shoulder buttons like digital buttons to try to work around those issues. I couldn't find info on the Xbox 360 controller operation, so this is basically a guess of how the data for the triggers is collected, but it solved the issues I had, so I guess it works. You can try twiddling the values where it switches from on to off, and I imagine that will let you press the button in further before it switches on. You'll need to edit the makefile and all that for it to compile on your system, so do a search for compiling the xpad 360 driver for whatever distro you use. Here is one for Ubuntu.

Xbox 360 Gamepad Digital Trigger Linux Driver

Continued fraction and resistor network calculations


These are some utilities I wrote up to verify some of the stuff I was working on related to some resistor calculations and continued fractions. res.py calculates the resistance of the network and the value of the continued fraction for a given number of terms to verify they are the same, and could easily be twiddled with to get other useful calculations. tocf.py takes a decimal number and returns the continued fraction coefficients of it.

res.py
tocf.py

Hexdrills


These are some drills for practicing converting between hexadecimal and decimal and arithmetic with hexadecimal numbers. They keep track of how well you do over time. Check the readme for more details. They're written in Python.

hexdrill.tar.gz