i ching

Throw a ching. Look it up online. I managed to get an i[ching] list into it.

ching : python

blag engine

It seems I like writing blag engines more than I like writing in them, anyway I just cleaned this one up a bit and you can check out the source if you like.

blag : python (printing itself, sort of quiney)

bash revision control

For some reason I ended up writing a little revision control system. It's kind of silly but I'm sort of proud of it.

Some of its features:

  1. It works with individual files, not directories. I've occasionally wanted something that does this, and i don't like the only one I've found (RCS), so I tried writing something I might like to use.
  2. It's a bash script, using diffutils.
  3. The revision control file is itself a bash script, which can be directly executed to recreate any revision of the file. It installs with its own repository!
  4. Supported operations:
    • commit [commit message] - there is no separate init step
    • checkout [revision] - any revision to file.revision
    • diff [revision] - with any revision
    • log [revision]

I wrote it for a while, checked it into itself as soon as I could, and put its revision control file onto github so it's versioned while it's versioning and you can install it with itself, dawg.

rvn : bash (github)

thinkpad mouse scroll hal udev

Successive versions of Ubuntu have moved farther and farther from using xorg.conf to do stuff. In Karmic, to get (vertical and horizontal) scrolling with middleclick+mouse on my x61t, I had to write a magic hal policy file:

OLD AND BUSTED:

In /etc/hal/fdi/policy/10-mouse.fdi (or something):

<match key="info.product" string="TPPS/2 IBM TrackPoint">
 <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
 <merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
 <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
 <merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
 <merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>
 <merge key="input.x11_options.EmulateWheelTimeout" type="string">200</merge>
</match>

In Lucid, hal is old and busted, and udev is the new hotness. hal is gone, so of course scrolling broke. It took a while to find the udev way:

NEW HOTNESS:

In /etc/udev/rules.d/99-local-xorg.rules (or something):

ACTION!="add|change", GOTO="xorg_local_end"
KERNEL!="event*", GOTO="xorg_local_end"

ENV{ID_INPUT_MOUSE}!="1", GOTO="xorg_local_end"
ATTRS{idProduct}!="TPPS/2 IBM TrackPoint", GOTO="xorg_local_end"

ENV{x11_options.EmulateWheel}="true"
ENV{x11_options.EmulateWheelButton}="2"
ENV{x11_options.YAxisMapping}="4 5"
ENV{x11_options.XAxisMapping}="6 7"
ENV{x11_options.Emulate3Buttons}="false"
ENV{x11_options.EmulateWheelTimeout}="200"

LABEL="xorg_local_end"

It was hard to find a lot of useful information on udev rules, these urls helped, especially the kubuntu link:

https://wiki.ubuntu.com/X/Config/Input
http://daniel.hahler.de/hal-configuration-fdi-for-kingsis-peripherals-evoluent-verticalmouse-3
https://wiki.kubuntu.org/X/InputConfiguration

The tool you use to get some sort of idea what udev stuff is udevadm. I dunno a lot about it, but here's some of the kind of stuff you do with it ...

UDEVADM EXAMPLES:

udevadm info --query=all --attribute-walk --name="/dev/input/event7
udevadm info --query=all --attribute-walk --name="/dev/input/by-path/platform-i8042-serio-1-event-mouse
udevadm info --query=all --path="/devices/platform/i8042/serio1/input/input7"
udevadm info --query=all --attribute-walk --path=/sys/class/input/mouse1
private wildcard tld apache dnsmasq
# Dynamic domains on a private tld
#
# butts.lol will map to /home/user/lol/butts
# haha.butts.lol will map to /home/user/lol/haha.butts/
#
# So all you have to do to get <name>.lol is mkdir /home/user/lol/<name>
#
# 404 handling is a bit tricky, cause just mapping to /404.html would cause
# a request to haha.butts.lol to look for /home/user/lol/haha.butts/404.html
# So we define a directory with an Alias, so /404/ will always map to a
# single directory.
#
# The idea is that any url that maps to a nonexistent path will hit /404/,
# Then create and delete subdirectories as needed and they resolve nicely.
#
# basic structure is
# /home/user/lol
# /home/user/lol/404
# /home/user/lol/logs

# DNS
# we need to be running a local nameserver to handle requests to the .lol
# tld. other requests get passed through to the normal nameservers. We'll
# use dnsmasq. Mac people might want to look at:
# http://www.macosxhints.com/article.php?story=2005110220352084

dnsmasq:
    dnsmasq.conf
        # send all requests to a .lol to localhost
        address=/.lol/127.0.0.1
        # only listen to localhost
        listen-address=127.0.0.1

dhcp:
   dhclient.conf
        # puts our dns server before any others
        prepend domain-name-servers 127.0.0.1;

# APACHE

# Load the vhost_alias module

cd /etc/apache2/mods-enabled
ln -s ../mods-available/vhost_alias.load .

# Configure a virtual host in /etc/apache2/sites-enabled/

<VirtualHost *>
        ServerAdmin user@localhost
        ServerAlias *.lol
        ServerName .lol

        DocumentRoot /home/user/lol/
        VirtualDocumentRoot /home/user/lol/%-2+

        ErrorDocument 404 "/404/index.html"

        <Directory /home/user/lol/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        Alias /404/ /home/user/lol/404/
        <Directory "/home/user/lol/404">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        LogLevel warn
        ErrorLog /home/user/lol/logs/error.log
        CustomLog /home/user/lol/logs/access.log combined

        ServerSignature Off

</VirtualHost>