bartman's blog

sles 11 on kvm

I need a SLES 11 system for porting some software for a client. I got the DVD and tried to install in [kvm]{tag/kvm}. First, I was pleasantly surprised that, like [Debian]{tag/debian}, [SuSE]{tag/suse} now supports virtio disks (/dev/vda) right from the installer. So far so good. However, both SLES 11 and OpenSuse 11 fail to install because grub crashes. I tried booting the SuSE cd into “rescue” mode and tries to install grub manually using the chroot trick. Same thing, grub seg faults.

android true type font

Following a random tweet on identi.ca I upgraded my proprotional fonts on Debian/Sqeeze to ttf-droid. I expect that some day this font will be packaged by Debian, but for now I had to: wget 'http://launchpadlibrarian.net/21202254/ttf-droid_1.00%7Eb112%2Bdfsg-0ubuntu1_all.deb' sudo dpkg -i ttf-droid_1.00\~b112+dfsg-0ubuntu1_all.deb Because I am a big console junkie I don’t use proprtional fonts much, but they do look nice on the web.

popen with stdin, stdout, and stderr

I’ve look around for an open source implementation of popen() that can handle redirection of stdin, stdout, and stderr of the program executed. I was unable to find one, so I wrote my own. If you need to fork a helper process and maintain bidirectional communication wtih it, then you can use my popenRWE() (source: popenRWE.c. Here is an example of how it might be used: int pipe[3]; int pid; const char *const args[] = { "cat", "-n", NULL }; pid = popenRWE(pipe, args[0], args); // write to pipe[0] - input to cat // read from pipe[1] - output from cat // read from pipe[2] - errors from cat pcloseRWE(pid, pipe);

shrinking URLs

I wrote a short script to shrink URLs: % shorturl http://www.jukie.net/~bart/shorturl http://2tu.us/ce8 % shorturl Type in some urls and I'll try to shrink them for you... http://www.jukie.net/~bart/shorturl http://2tu.us/ce8 http://www.jukie.net/~bart/20090320214228 http://2tu.us/ce9 I am doing this as part of my new identi.ca addiction^W usage and extending GregKH’s command line micro blogging tool. UPDATE: also picked up by @vando for use with mcabber.

readlater

Instapaper is a quick way to stash things to read later. Here is a script that lets you post from the command line: readlater. $ readlater http://www.jukie.net/ This URL has been successfully added to this Instapaper account. Don’t forget to fill in the USER and PASS fields in the script :) Next, I wanted to call on this from vimperator. I wrote this vimpeator plugin to do that.

splitting patches with git

Here is a really cool workflow using git… Say you have several commits (you can think of them as patches for this exercise) in your current repository and want to split one into multiple parts. There could be various reaons like upstream request, only want to release part of it, remove debug code, etc. Anyway, there is one commit in your unpublished history that needs to be split.

creating busybox symlinks

Busybox should have a --create-symlinks-in=/sbin feature, but for now… ./busybox --help | grep 'Currently defined functions:' -A30 | grep '^\s.*,' | tr , '\n' | xargs -n1 -i{} ln -s busybox {} update on 2012/03/22: Shawn Hicks points out that this works better (unverified by me): ./busybox --help | busybox grep 'Currently defined functions:' -A30 | busybox grep -v 'Currently defined functions:'|busybox tr , '\n'|busybox tr -d '\n\t'|busybox tr ' ' '\n'|busybox xargs -n 1 ln -s busybox update on 2012/10/07: Nicholas Fearnley further updates the recipe to this:

wmiirc-lua v0.2.5 release

A kind [wmiirc-lua]{tag/wmiirc-lua} user, Sytse Wielinga (sytse on irc), had debugged an old issue in luaixp code I had written for wmiirc-lua. While this bug directly addresses raw mode (Mod4-space), I belive that this will fix a bunch of weird issues so I released v0.2.5. Since v0.2.4 there was also a small bug in the battery plugin that was fixed.

git-svn strangeness

As awesome as git-svn is, I had it fail today with this message: Last fetched revision of refs/remotes/branches/foo was r19307, but we are about to fetch: r19307! To which I said: “WTF?”. I still don’t know what it means, but I can share with you how I recovered it. It turns out that git-svn is quite capable of recovering from this. You just have to remove its meta-data for the offending branch, and resync with SVN.

installing git man pages quickly

I just upgraded git to get a fix for a diff buffer overflow. I built the git binaries, but this box is too slow to rebuild the man pages. Fortunately those are already prebuilt in a separate branch. One way to install them without rebuilding them locally is to: # in a clone of git://git.kernel.org/pub/scm/git/git.git git archive --format=tar origin/man | sudo tar -x -C /usr/share/man/ -vf - … with which I don’t have to rebuild man pages locally. Git rocks!