2010-02-05

Suppressing key change warnings at the end of a line

Lilypond by default prints key cancellation and then prints the new key signature, even when at the end of a line. No doubt these are helpful to musicians or something, but they look horrible, and can get out of control. It turns out it's relatively complicated to get rid of the cancellation and the new one without removing the normal signature from the following line. However, the following code does what is necessary:


\relative c' {
    \key ces \major
    ges'1 ges1 \bar "|." | \break
    \once \override Score.BreakAlignment #'break-align-orders =
        #(make-vector 3 '(instrument-name
                          left-edge
                          ambitus
                          span-bar
                          breathing-sign
                          clef
                          key-signature
                          time-signature
                          staff-bar
                          custos
                          span-bar))
    \bar "||:"
    \set Staff.printKeyCancellation = ##f
    \set Staff.explicitKeySignatureVisibility = #begin-of-line-visible
    \override Staff.KeySignature #'break-visibility = #begin-of-line-visible
    \key ais \minor
    gis1 eis1 | \break
    gis1 eis1 \bar ":|" |
}

2010-01-12

Barnes and Noble Human Resources phone number

The Barnes and Noble Human Resources phone number is 1-800-799-5335.

That is all.

2009-12-23

PrBoom WAD names

PrBoom works with multiple released versions of Doom, but has particular naming conventions you must follow if you want the Launcher to see the WAD file.

Doom
doom.wad
Ultimate Doom
doomu.wad
Doom II
doom2.wad
TNT: Evilution
tnt.wad
The Plutonia Experiment
plutonia.wad
Freedoom
freedoom.wad

This is particularily important because the Steam version of Ultimate Doom has the WAD file named doom.wad.

2009-10-13

Using a NextWindow touchscreen with Ubuntu

This should work for any X.org based Linux system. The key is to point it at the right event id as follows in /etc/X11/xorg.conf :

Section "InputDevice"
        Identifier "touchscreen"
        Driver "evtouch"
        Option "Device" "/dev/input/by-id/usb-NextWindow_Touchscreen-event-mouse"
        Option "DeviceName" "touchscreen"
        Option "MinX" "1"
        Option "MinY" "1"
        Option "MaxX" "32768"
        Option "MaxY" "32768"
        Option "ReportingMode" "Raw"
        Option "Emulate3Buttons" "false"
        Option "Emulate3Timeout" "50"
        Option "SendCoreEvents" "On"
        Option "CorePointer"
EndSection

Note that this is for the newest 2150 versions. Without the /dev/input/by-id line, the event number seemed to change somewhat randomly on reboot.

2009-09-04

Routing a port through a machine that's not the default router

I have an OpenVPN machine on my network that hosts a VPN, but it is not the default router for the network. I wanted to forward a port for the OpenVPN clients so that they could see another machine on the local network. To do this requires a number of steps.

First, the machine that they'll be connecting to needs a default route added for the OpenVPN network, or the packets will never return. My OpenVPN network is 172.31.4.0 and my local network is 192.168.200.0 in these examples. The OpenVPN server is 172.31.4.1 and 192.168.200.70 on tun0 and eth0 respectively; the machine I want my OpenVPN clients to be able to connect to on port 6666 is 192.168.200.10.

route add -net 172.31.4.0 netmask 255.255.255.0 gw 192.168.200.70 dev eth0

This allows the server to return TCP. Of course, the machine must have its firewall set to allow port 6666 in, but that's simple.

Then, the OpenVPN server needs its forwarding enabled. The commands that worked for me were:

iptables -t nat -A PREROUTING -p tcp --dport 6666 -j DNAT --to 192.168.200.10
iptables -A FORWARD -p tcp -s 192.168.200.10 --sport 6666 -j ACCEPT
iptables -A FORWARD -p tcp -d 192.168.200.10 --dport 6666 -j ACCEPT

This allows the communication in, and the response back out. I had also added these lines to my INPUT and OUTPUT chains; I'm not sure if they were needed:

iptables -A firewall-input -p udp --dport 6666 -j ACCEPT
iptables -A firewall-output -p tcp -m state --state NEW -m tcp --dport 6666 -j ACCEPT

If not, they don't hurt anything.

2009-08-26

Using SSH to connect to a link-local IPv6 address

It turns out that the self-assigned IPv6 addresses you see are not unique; they're only guaranteed unique on each interface. To ssh to one, you'd need to run:

ssh fe80::21c:c0ff:fe52:c5ec%eth0

for example, where %eth0 specifies eth0.

2009-08-13

Using command line switches in bash scripts

I have a number of bash scripts that do useful things to lists of items, such as this:

./install_stuff.sh 10.0.0.2 10.0.5.3

By using shift, I can have the script run through various IP addresses, for example. But I wanted more. I wanted the same command to sometimes take -t tag as an option and do something different. It turns out there's a relatively easy way to do this using the getopts builtin in bash. However, while it easily found the option (if present), it ruined the shifting feature, until I figured it out. Here's a snippet that sets TAG if -t tag is present, and then is ready to be shifted through as normal.

while getopts "t:h" OPTIONNAME; do
case "$OPTIONNAME" in
t) TAG="$OPTARG";;
[?]) help;;
esac
done

shift $(($OPTIND - 1))

At this point, you can use $1 as normal; it will be the first non-option parameter. Additional options can be specified in a similar manner.

Bypassing SSH host key checks and the SSH agent

Sometimes you have too many SSH keys loaded, and trying to SSH to a box will fail. Sometimes you're trying to SSH to a box that's been rebooted into another OS or from a rescue CD.

The following command will disable key-based authentication, and ignore your known_hosts file:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o'RSAAuthentication=no' -o 'PubkeyAuthentication=no' 127.0.0.1

2009-07-30

Xen recovery on CentOS

I had a Xen domain crash, and it was a file image based LVM system. To mount the system manually in the host, I had to do:

losetup /dev/loop0 /storage/image.disk
kpartx -a /dev/loop0
vgchange -ay
lvscan
mount /dev/VolGroup00/LogVol00 /mnt

This allowed me to access the LVM volume. To unmount it, I needed to do:

umount /mnt
vgchange -an VolGroup00
kpartx -d /dev/loop0
losetup -d /dev/loop0

Now I could attempt to boot the domain again.

2009-05-19

bzr error on BranchHooks

On one Ubuntu 8.04 system, I was getting the following error:

0.031 looking for plugins in /root/.bazaar/plugins
0.031 looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
[ 7744] 2009-05-19 09:37:54.672 WARNING: 'BranchHooks' object has no attribute 'install_hook'
[ 7744] 2009-05-19 09:37:54.673 WARNING: Unable to load plugin 'dbus' from '/usr/lib/python2.5/site-packages/bzrlib/plugins'
0.093 Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/bzrlib/plugin.py", line 231, in load_from_dir
exec "import bzrlib.plugins.%s" % name in {}
File "", line 1, in
File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/__init__.py", line 76, in
install_hooks()
File "/usr/lib/python2.5/site-packages/bzrlib/plugins/dbus/hook.py", line 30, in install_hooks
Branch.hooks.install_hook('set_rh', on_set_rh)
AttributeError: 'BranchHooks' object has no attribute 'install_hook'

Everything else worked fine, but it was reporting an issue with install_hook. I tracked it down, and fixed it by deleting the dbus directory in /usr/lib/python2.5/site-packages/bzrlib/plugins - not sure where it had come from, but other systems didn't have it.