Tim Hatch

Weblog | Photos | Projects | Panoramas | About

Sane (bash-like) Tab Completion in Vim 08 Oct, 2008

Oct 08 18:09:34 <berto->	when i'm looking for a file in vim (say using :tabe), i'd like the tab completion to behave like bash; is this possible?
Oct 08 18:21:35 <LaoLang_cool>	berto-, :help wildmode
Oct 08 18:21:50 <LaoLang_cool>	something like this: set wildmode=longest:list,full
Oct 08 18:21:56 <LaoLang_cool>	you can adjust it for you
Oct 08 18:28:58 <berto->	LaoLang_cool: AWESOME!
Oct 08 18:29:29 <LaoLang_cool>	berto-, yes, vim is awesome

— irc.freenode.net#vim today

Very Amusing Development 08 Oct, 2008

Any line that starts to the right of the current margin is treated as verbatim text.

simple_markup.rb

That is very interesting, Ruby’s documentation format uses significant whitespace.

Extending Python fnmatch for curlies 07 Oct, 2008

fnmatch2.py contains a modified translate function. With this you can convert {one,two}* fnmatch expressions into regexes successfully.

The Hills are Green 02 Oct, 2008

My $JOB is near the Santa Barbara airport, and about a week ago we started noticing lots of single-engine planes casting shadows on our skylight. It turns out they’re barely clearing the palm trees around the building, laden with something called “hydromulch” to prevent flooding this winter in the area that burned. The Independent is reporting that floods are expected for Goleta, and has a more in-depth article on the hydromulching progress.

An Exercise in Futility 01 Oct, 2008

A project called busybox is commonly used on tiny computers to give them usable versions of the standard utilities you’re used to on a GNU/Linux system. We use it at work, and it’s also used for all of the Linux router projects (DD-WRT, OpenWRT, etc). Its primary claim to fame is that most of the utilities are actually in one binary, so they can share a lot of code. Here’s the one we use at work:

$ ls -l /bin/
lrwxrwxrwx    1 root     root           14 Jan  1  1970 addgroup -> /bin/tinylogin
lrwxrwxrwx    1 root     root           14 Jan  1  1970 adduser -> /bin/tinylogin
lrwxrwxrwx    1 root     root            7 Jan  1  1970 ash -> busybox
-rwxr-xr-x    1 root     root       668428 Jan  1  1970 busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 cat -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 chattr -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 chgrp -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 chmod -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 chown -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 cp -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 cpio -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 date -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 dd -> busybox
lrwxrwxrwx    1 root     root           14 Jan  1  1970 delgroup -> /bin/tinylogin
lrwxrwxrwx    1 root     root           14 Jan  1  1970 deluser -> /bin/tinylogin
lrwxrwxrwx    1 root     root            7 Jan  1  1970 df -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 dmesg -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 dumpkmap -> busybox
lrwxrwxrwx    1 root     root            7 Jan  1  1970 echo -> busybox
...

The fun part is when I used a DD-WRT micro build for the first time, which uses busybox but has a number of useful commands disabled. ls is one of them.

BusyBox v1.9.2 (2008-05-24 15:04:29 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

\u@\h:\w\$ ls /
-sh: ls: not found

ls is pretty easy to get around, just do echo * and it’ll show you a list of files. echo */ will list directories. cat is a little more interesting, I just had to go through all the commands on the system (before you ask, there’s no perl or python). Turns out the easiest way is to grep -v SDLFJKHSDLJFHS $filename (that is, grep out some impossible string, which works surprisingly well).

\u@\h:\w\$ echo /*
/bin /dev /etc /jffs /lib /mmc /mnt /opt /proc /sbin /sys /tmp /usr /var /www
\u@\h:\w\$ grep -v SDLFJKHSDLJFHS /tmp/hosts
127.0.0.1       localhost
10.123.1.1      border.hq.nutricateonline.com
...