Kacper's leet haxx

Where programming is an intrinsically orderly activity, debugging is chaotic and unstructured.

Below is some stuff I've put together that you might find useful or at least mildly interesting:

  1. Linux Kernel patches
  2. Migrate from ISC dhcpd to dnsmasq EASY
  3. Fisty adesklets breakage
  4. libwnck warning message spam
  5. PostScript to PDF/A convesion
  6. Meld open-in-existing-window
  7. DDD/Motif mouse scrollwheel bug
  8. Fancy charts
  9. ATi Radeon bollocks
  10. gDeskCal patches
  11. Boot quick with kexec
  12. String replacement in C
  13. Openbox pipemenus
  14. Kacper's debian repo
  15. Scripts for McGill SOCS lab users

Linux kernel "-lied" patchset

It's really a crying shame to say it - but there are issues with the linux kernel development process which cause otherwise fantastic technology to never reach end users. Here are some such improvements that are worth taking a good look at.

patch- We are back! And here's a good, generic config file as a starting point for a compile: config-karmic-r4-grsec. It works, I promise.
Apply to ubuntu karmic git!
  git clone git://kernel.ubuntu.com/ubuntu/ubuntu-karmic.git
My older patchsets were applied to vanilla. no more.
i686 packages are in my repo, amd64 packages coming soon!

Merging reiser4 was enough of a pain in the ass I didn't bother for a while.
So I brought back reiser4, cause it kicks ass (though Hans Reiser's in trouble). Laurent Riffard's reiser4 stuff's in there.
After a long hiatus I've emerged with new patches... swsusp2+reiser4+ck2(sd,sp). Didn't bother with the amd76x_pm due to interrupt overhead.

Apply to the indicated kernel with patch -p1, three times daily until swellings decrease.
Note: I haven't noticed anything amiss yet :-). As you can imagine, these patches aren't but tested by me, and hopefully, you. So hey, if it breaks, you get to keep all the pieces.

I've been using Con Kolivas' desktop interactivity patches for ages now, and I thoroughly recommend them. That guy has for some time been our only desktop champion on the lkml, and his patchset is great. For whatever reason, I've also been using Reiser4, (no, really - it's stable and fast as hell), and suspend2 for wicked fast booting - though both look less than likely to ever go into mainline. I'm also using the amd76x_pm patch - power management for 76x-based AMD multiprocessor systems.

So, inspired by cko, nitro, beyond and others, I threw them all together:

some scary compile warnings about exit sections - but kernel works, promise.

ISC dhcpd SUCKS. Go dnsmasq!

Convert ISC dhcpd (which sucks) to dnsmasq (which rules) with the dhcpd2dnsmasq.pl script.
Be mindful that it is best for those with a lot of host definitions, and does not support all the ISC syntax out there.

The script is also a living example of how to make simple yet powerful parser with the minimal amount of lines, using the AND-OR Waterfall method.

adesklets in feisty

The very cool adesklets package is useless in ubuntu fisty because of a bug fixed in May 2007 that hasn't been released to the general population yet. Fixed packages are available in my debian repo.

openbox+rox+TaskTray wnck warning spam

OpenBox 3.4 defines its very own pseudo-NETWM actions that libwnck doesn't understand, and the net effect is that TaskTray complains loudly in the ROX Session message log... see libwnck complains about unhandled actions (bug 431682). A fixed package is available from my debian repo.

ps2pdfa - PostScript to PDF/A converter

This one is for all you helpless Masters students struggling to convert your document to PDF/A for thesis submission.

      ps2pdfa.sh INPUT.ps [OUTPUT.pdf] [TITLE]

      Parameters in brackets are optional. If you don't specify OUTPUT then
      the output will be named INPUT (anything before the '.ps'). If you don't
      specify TITLE it'll default to OUTPUT, or INPUT if the former is lacking.

Meld: open new diffs in new tab

Meld is a sweet file difference visualizer with tab support. I've implemented DBus support to launch diffs in new tabs of an existing Meld window.
Here is the patch against meld-1.1.5. A fixed meld package is available from my debian repo.

DDD/Lesstif mouse scrollwheel bug

DDD is a decent visual debugger, but my collegues and I have been greatly annoyed at the reversed mouse scrolling bug in DDD we've observed in newer versions. I tracked this problem down to a bug in the lesstif toolkit, though I'm pretty sure DDD is the only program affected. As you might have gathered by now, I was annoyed enough to fix the problem: my lessmotif scrollwheel bugreport with two-liner fix. A fixed lesstif2 package is available from my debian repo.

Fancy chart fun with WebFX

You can make some pretty sleek charts with a bit of effort and some ugly JavaScript, as I found out. This is a shout out to Mike who felt the need for some pretty graphs but was too lazy to do it himself.

ATI Radeon driver bollocks

ATI is a royal pain in the ass on linux. And by royal, I mean Le Roi fucking Louis VII and Elizabeth the fucking sixth. ATI doesn't actually support the driver (they are as likely to answer your "Linux Driver Feedback" as you are ever to touch Mrs Jolie's bosom). Not to mention they don't provide an official forum for users, or the patent lack of changelogs that accompanies every driver release. Now really, that wouldn't be skin off anyone's back, now would it, ATI? WOULD IT? In the name of all that is holy, I used to *like* you guys. I *trusted* you not to screw me over. Now I have to tell people to avoid you like the plague!

Anyways, the newest (8.27.10 & 8.28.8 & 8.31.5) ati drivers don't work with 3D on Debian/sid (and possibly Ubuntu) systems. Why? Because the libGL.so.1.2 that ATI shipped expects fglrx_dri.so and atiogl_dri.so to be in /usr/X11R6/lib/modules/dri, while the package installs these files into /usr/lib/dri. Idiotic, isn't it? The clue? Running this:

LIBGL_DEBUG=verbose glxinfo >/dev/null

Fix it by either making a symlink from one to the other with:

$ mkdir -p /usr/X11R6/lib/modules/ && cd /usr/X11R6/lib/modules && ln -s /usr/lib/dri 

OR you can be more risqué and patch libGL.so.1.2 to use the right path from the start, with your favorite hex editor. Just how one does that is left as an excersise for the reader.

That's presuming nothing else went wrong while installing the driver - I had to compile in agpgart and agp chipset support because them modules didn't work, got an ENODEV error!

Not only have these problems not been fixed - ATI has clearly not tested package generation on debian, as 8.31.5 is broken in several ways, making it a royal pain to get fglrx running on debian. Ugliness.

gDeskCal bugfixes

gDeskCal is a nice and easy calendar that sits on my desktop. It broke, so I fixed it. More specifically, a time parsing bug (#295644) and most pygtk deprecations (#383732) are fixed. At the prompt, enter the gdeskcal-0.57.1 source directory and do:

$ patch -p1 < gdeskcal-0.57.1-deprecations+timeparse.diff

After some correspondence with Martin Grimme, the creator of gDeskCal, I realized the time parsing in my previous patch would generate events every 4 weeks for things that are supposed to happen on a montly basis .. not exactly correct. I quickly hacked up a fix for my fix, which you can apply to debian's gdeskcal-0.57.1-2 or on top of the first patch:

$ patch -p1 < gdeskcal-0.57.1-2-fix_time.diff

a fine Kexec script indeed

Kexec is a linux kernel facility that lets you boot straight into a kernel from a running system. This means no more wasting your life away while that BIOS POSTs. It's been around for quite some time, but only those gentoo bastards have the scripts to automagically take advantage of it. So I wrote a script:

First, make sure you have kernel support for kexec - it's been available since version 2.6.13 or so, but you might not have it compiled in. Check by doing

$ grep kexec /proc/kallsyms

If you see nothing, panic!
Then make sure you have the userland tools with a

$ which kexec

This would be another good spot to panic, but there's usually an easy way to install the kexec-tools package. On Debian and Ubuntu, all you need to do is

# apt-get install kexec-utils

Once you've made sure you have the kernel support and the kexec command should you get the kexec init script. It can be used stand-alone, but better yet make it one of your startup scripts. Newer debian and ubuntu systems now have a working kexec script system, but I like mine better. It should drop in as a replacement for the kexec-load script. On sysv5-based (debian et al) distros, you do:

# mv kexec /etc/init.d
# chmod +x /etc/init.d/kexec-load

Set it up so that it gets run on startup:

# update-rc.d kexec-load start 39 S .

This will load the kernel "/boot/vmlinuz-`uname -r`" for boot. Now, modify your /etc/init.d/reboot script so that it reads

 kexec -e  # boot into new kernel - this line inserted
 reboot -d -f -i

near the top. Now check if everything is working as it should by issuing

# /etc/init.d/kexec-load start

Next time you reboot your system, it should jump straight into another kernel instead of rebooting the machine. To reboot normally, all you need to do is run

# /etc/init.d/kexec-load stop

before issuing a reboot.

String replacement in C

strrep.c quick C string replacement, sadly missing from the standard C library.

Openbox pipemenus

Get the openbox pipe-menu file browser, and put it somewhere in your $PATH.
Usage: put

<menu id="browse" label="Browse" execute="browse ~" />

in .config/openbox/menu.xml, and you'll find it in the right-click openbox menu. The thing will by default execute 'rox' when you click on an item, so be sure to have that installed.

Quick-fix debian archive

Presently my archive is a hodge-podge of architectures and releases of patched versions of various packages, so just grab the .deb files you need. Source packages are available through:

deb-src http://kacper.doesntexist.org/debian source/

SOCS Lab scripts

Lab dwellers, log in to mimi and type

passwd -r nis -e

and change your shell to /usr/local/bin/bash Then get a good .bash_profile and corresponding .cshrc. Remember to 'source ~/.bash_profile' in your .bashrc.
Why would I want to do this? You can thank me later.

searchusers.sh: a script to find out who's logged on where in the (McGill SOCS) labs.

Random Crap

Come check out the spectacular WebStore! This was part of an assignment for COMP-202:Intro to Software Systems, Summer 2003 at McGill. Beware, I am not a designer, nor am I an artist. I spent maybe a day on the whole thing. It's supposed to be funny, not ugly, but don't blame me if it succedes at being both.

Back to home
Copyright copyleft copywrong carboncopy kacperw-AT-online.no
Valid XHTML 1.0! Valid CSS!