Saturday, June 07, 2008

Frustrated that bash completion isn't giving you anything?

It can be frustrating when the normally-amazing bash_completion (on ubuntu at least) doesn't complete anything, because you're working with a file that's named slightly differently than normal. (Like trying to mplayer a media file with an unusual or nonexistant extension). As a quick hacky fix, put this in ~/.bashrc:

complete -p | grep '\-o filenames' |p -v '\-o default' | grep -v '\-o bashdefault' | while read i; do eval "$i -o bashdefault"; done

Wednesday, May 14, 2008

Ubuntu OpenSSH vulnerability: how to update host keys

So there was a key generation weakness in Ubuntu openssh packages. The upgrade process regenerates your host keys. But now all of your other machines complain that the host key has changed. And Ubuntu hashes your known_hosts file (HashKnownHosts yes, in /etc/ssh/ssh_config), so you don't know which line to remove. Clean out your whole known_hosts file?

No. To find the hashed key, use:
ssh-keygen -F hostname
ssh-keygen -F ip_address
Remove both of the matching lines from ~/.ssh/known_hosts.

Now you're connecting to your server box and it prompts you if you want to accept the new key. Is that signature correct, or is there a man in the middle? You did keep an ssh session open to the machine while upgrading, right? So on the server, run:
ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
(or _dsa_key, perhaps). If that fingerprint matches, you're set. If not, you've probably got a man in the middle. Or you just checked the fingerprint on the wrong machine ;)

Thursday, May 01, 2008

sipb-xen

It has come to my attention that some people don't know about sipb-xen.

Anyone with an MIT login can get a private virtual server with up to 50 GB disk and 512 MB RAM, free. You have to be comfortable installing an OS yourself, but it's not hard, and there's a clone option for getting a Debian machine. Once up, your server will be accessible at servername.servers.csail.mit.edu.

Tuesday, April 29, 2008

Right mouse button mapping on Linux Tablet PC

The pen button is much more useful as a right click than a middle, but it defaults to middle.

I thought I could fix it with xinput, like:
xinput set-button-mapping stylus 1 3 2
but this turns out not to work.

What actually works (from the Ubuntu bug) is:
xsetwacom set stylus Button2 3
I added this to the GNOME session (system->preferences->session).

Thursday, April 17, 2008

Dvorak Spanish keyboard layout (xkb)

Here's a basically US-English Dvorak layout, with right Alt meta mapped to give you Spanish characters right where you'd expect them: meta-vowel is accented vowel, meta-n is ñ, meta-1 is ¡, and meta-/ is ¿.

Add the following to your /usr/share/X11/xdb/symbols/us file:

partial alphanumeric_keys
xkb_symbols "dvorak-spanish" {

name[Group1]= "USA - Dvorak with Spanish extras";

include "us(dvorak)"

key <ae04> { [ 4, dollar, EuroSign ] };

key <ad04> { [ p, P, udiaeresis, Udiaeresis ] };

key <ac01> { [ a, A, aacute, Aacute ] };
key <ac02> { [ o, O, oacute, Oacute ] };
key <ac03> { [ e, E, eacute, Eacute ] };
key <ac04> { [ u, U, uacute, Uacute ] };
key <ac05> { [ i, I, iacute, Iacute ] };
key <ac09> { [ n, N, ntilde, Ntilde ] };

key <ae01> { [ 1, exclam, exclamdown ] };
key <ad11> { [ slash, question, questiondown ] };

include "level3(ralt_switch)"
};
Then say 'setxkbmap us dvorak-spanish'.

Tuesday, April 15, 2008

Lisp: IMAP SSL

I've found two IMAP libraries in Common Lisp: mel-base and Franz's postoffice. Neither supports SSL as far as I can tell. Most IMAP servers now require SSL. Do I take that to mean that no one is doing IMAP in LISP anymore?

btw, mel-base currently doesn't work with Allegro.

But you may find this optimization helpful.

Wednesday, April 09, 2008

Recovering a Toshiba M200

The Toshiba M200 is a relatively unimpressive tablet PC that I've borrowed for an extended period. The Windows install on it was performing terribly (I also have Linux on it), so I decided to recover it from the recovery DVD.

Two days later...

Here's what didn't work:
  1. Booting the DVD from GRUB (it doesn't know how).
  2. Booting from a Philips SPD3100 external DVD drive.
  3. Booting the floppy image from that disk (geteltorito helps here). (hung forever loading the USB driver usb20.dev)
  4. Booting from a FreeDOS image. Okay, I admit it's because I gave up trying to find a single-floppy image.
Finally I've found something that seems to be working. Outline:
  • Network boot floppy (yes, networking in DOS) from NU2
    • loaded on an SD card in the internal reader (name the floppy image file '$tosfd00.vfd')
    • The network card is e100 compatible, so the drivers are included. phew.
    • Generally just follow the menu prompts in the boot floppy
  • SMB shared CD
    • I used Mac OS 10.4: enable Windows Sharing under System Preferences-Sharing
    • Get your computer's real SMB/NetBIOS name (it's not the name the control panel tells you, but rather a shortened, munged version of the 'Computer Name' at the top of the window): bring up a terminal, then 'grep netbios /etc/smb.conf' and you'll see it.
    • Otherwise, follow the instructions in the second part of this guide (ignore the stuff about the PXE boot server; we got around that by booting off the SD card
The instructions only overwrite your first partition, so your other data isn't destroyed, and neither is your bootloader. Back up anyway. I got around 120 MB/min transfer rate, so it took around 15 minutes to restore.

On first boot, part of Windows XP Setup runs. It asks some simple questions like Administrator password, then reboots. You'll log in as Administrator.

Unplug your network and enable the firewall (Control Panel/Network/Network Connections/Local Area Connection/Properties/Advanced/Internet Connection Firewall). Then plug in and visit Windows Update immediately. My recovery CD was SP1, so it'll need to fetch SP2. You'll probably want to create a normal user account for yourself too, so you're not running as Administrator.

PS - the Toshiba Software Updates thing is useless. Remove it and use Microsoft Update. You can also remove Toshiba Registration, SurfHere, Zinio (delete the folder in C:\) and who knows how many other things you won't ever need.