hisham hm

I hate plagiarism

Cover of an album by Sorriso Maroto, a Brazilian “pagode” group (a crappy commercial byproduct of samba) blatantly rips off the cover of Linkin Park’s Minutes to Midnight:


90s nostalgia

After all the 80s nostalgia of the past decade, with synth-driven music and pixelized graphics everywhere, this year we started to see 90s nostalgia — yes, right at the beginning of the decade. It’s amazing how well “timed” these things happen (or maybe it’s gradual but we’re inclined to think in “round numbers”).

Today, #why90srocked is a trending topic on Twitter. These days, I saw this tribute to the 16-bit era of videogames. Yes, all this makes me feel somewhat old, but at least I can still get the references. I will really feel old when tributes to the Playstation 1, Nintendo 64 and the like start to pop up.

In the mean time, let’s enjoy the upcoming wave of 256-color graphics in all their glory…


htop 0.9

Today I announced version 0.9 of htop, after a week of release candidates posted to the htop-general mailing list.

I had a number of changes committed to SVN for a few months but I wanted to take some time to clean up some rough edges and make sure everything was okay for a release. So I decided to take some time last Saturday to work on htop again and run through the bug tracker to check any pending issues, and I ended up spending the whole day from 2PM to 1AM working on it. It was a long time since I last coded non-stop for that long, and it was really fun.

(By the way, why doesn’t sf.net send me an email whenever someone posts a bug? If this feature is available, I never found it — in fact, their interface keeps changing; I admit it took me a while today to find how to release a file. Granted, the new procedure is much much simpler than the old one.)

The tool is pretty stable now and I don’t want to spend a lot of time on it, so it’s natural that the time between releases is growing. For this reason, it’s especially important to make good releases. The series of release candidates was great to catch silly bugs (inserted during Saturday’s coding rush, of course) — for that I’m thankful to the folks from htop-general.

This release brings a feature I wished for a long time: the ability to collapse and expand subtrees. I don’t know if I’ll actually use it that much, but for some reason I always missed it. Another improvement is that it now displays cmdlines of arbitrary length (actually, up to 4096 bytes, which is the kernel’s limit). No more truncated argument lists.

I think the only annoyances left in htop now, as long as I’m concerned, are the lack of search and save in strace view and the lack of history in process search. I think when I get all these done I’ll call it 1.0. Don’t hold your breath, though: it took me one and a half year to go from 0.8.3 to 0.9… :-)

On the subject of stability, I did catch one ridiculous off-by-one error in an array access which may be the cause for the random segfaults that were reported by a few users over the years. Amazing that it sat there for so long, but well, so is life coding in C.


LPEG Cheat Sheet

I once felt that every time I think LPEG is the solution to my problem I spend so much time trying to learn it that I lose focus from the actual problem.

The concept is admirable, though, so for once I decided to struggle through and actually get the job done using it. I learned a few tricks along the way, so I decided I should write them down (because I know I’ll certainly need them in the future).

These assume the one-letter functions are loaded into locals (e.g. P = lpeg.P).

Match a pattern exactly n times

local function X(p,n) return n == 1 and p or p * X(p,n-1) end

Match anything not in a set

(1 - S"abc") -- [^abc]

Match a string converting backslash escape sequences

-- match backslash and capture following char,
-- then convert match to captured char
local escape = (P"\" * C(1)) / "%1"
-- match anything but backslashes and spaces, or escapes
-- turn everything into a capture, replacing inner captures
local pathname = Cs( ( (1 - S"\ ") + escape ) ^ 1 )

Capture a number as a number

local num = (R"09" ^ 1) / tonumber