These pages describe things I've done which primarily involve coding. Some of these may be useful. Currently, we have hacks, mini-projects, and recipes. I also maintain a page of my Projects.
Created Wednesday, 2011-04-06 — 13:28.Last update 1 month ago.
You have a deep directory tree of files, and you need to flatten it into a single directory, so that there are no files in subdirectories, and all the files are in the same place.
all the filenames are unique. If they're not, some will get overwritten (using the cp command), or not linked (using the ln command).
==Solution==
cd $ROOT_DIRECTORY_OF_TREE
find -type f…
Created Wednesday, 2011-04-06 — 13:48.Last update 2 months ago.
You need to generate Pascal's Triangle in Python, and you're lazy (an admirable trait). Alternatively, you're looking for a Pascal's Triangle generator that can show really high-ranking rows, ones with multi-hundred-digit (or multi-million-digit) coefficients.
==Solution==
Here's the essential, unadorned code:
def pascal(n):
"""
Yield up to row ``n`` of Pascal's triangle, one row at a time.…
Created Thursday, 2011-10-13 — 20:41.Last update 2 months ago.
You run a medium-to-large size MySQL server with lots of databases, possibly for hosted websites. You've experienced performance degradation. You've fine-tuned your database engines, and no joy. Then you finally realise you need to run mysqloptimize, and the day is saved! Good on you. Of course, running mysqloptimize on a large server still takes half an ice age. Maybe you…
Created Tuesday, 2011-04-05 — 22:03.Last update 4 months ago.
A short Javascript program to improve detection of users idling or away from their keyboards, which should in turn improve how online users are detected. The file works with both jQuery and Prototype. It autodetects which is available at load time. Putting an AJAX request in one of the handlers can notify the back-end about the online state of a…
Created Wednesday, 2011-04-06 — 14:22.Last update 5 months ago.
AMANDA is a slightly unusual but outstanding network backup system. Many companies use DLTs and SDLTs for backups.
This is a heavily modified version of the DLT tape label template shipped with Amanda. There are quite a few new things here.
Better æsthetics. Helvetica makes it a bit lighter on the eye, and a few extra shades of grey make it look…