July 28th, 2010 § 0 Comments § permalink
Xmonad is my window manager. I’ve had it configured to use dmenu as an ersatz command-line, but have been fairly unimpressed by its slowness, and by the difficulty of getting any notification of errors.
So I’m turning to yeahconsole. This is a drop-down terminal, something similar to yakuake, and hearking back ultimately to the headsup terminal in quake. To use: Ctrl-Alt-y to bring it up, type/run your command, M-A-y again to hide it.
I leave outstanding two jobs, one easy and one hard. Easy one is integrating it with xmonad, to launch on M-p. Hard one is making it vanish after executing a command; from a glance at the docs it seems this will only be possible by futzing with the source directly
July 8th, 2010 § 0 Comments § permalink
MongoDB (and nosql generally) is an appealing idea. The words written about it, though, are problematic: too much hype, too little documentation. That’ll change soon; we’re over the peak of the nosql hype cycle, into the trough. People are looking at the nosql systems they’ve eagerly implemented in recent months, noticing that they won’t solve every problem imaginable. For now, though, every blogpost with mongodb instructions is prefaced with grumbles about the lack of information.
So, i spend a ridiculous amount of time figuring out how to do grouping. Have a bunch of download logs, want to break them down by country.
The simplest way I could find of doing this is:
db.loglines.group({ ‘cond’ : {}, initial: {count: 0}, reduce: function(doc, out){out.count++;if(out[doc.country] == undefined){out[doc.country] = 0;};out[doc.country] += 1;}});
Or, the version in pymongo:
> reduce_func = """function(doc, out){
out.total++;
if(out[doc.country] == undefined){
out[doc.country] = 0;};
out[doc.country] += 1;};
"""
> l.group(key = {},
condition = {},
initial = {'total':0},
reduce = reduce_func)
[{
u'AE': 215.0,
u'AG': 23.0,
u'AM': 140.0,
u'AN': 58.0,
u'AO': 56.0,
...
u'total' : 87901;
}]
[apologies for formatting; I’ve not really figured out how to edit js within a python repl]
June 21st, 2010 § 0 Comments § permalink
on that keylogger thing….seeks the showkey utility will do everything I need, with considerably less faff and higher reliability. yay!
June 20th, 2010 § 0 Comments § permalink
Yet another linux trick I keep on forgetting…
To display a notification on the desktop from the command-line:
# apt-get install libnotify-bin
$ notify-send “hello world”
obv. “from the command-line” really means “from a script”, unless you’re in some Evil Dead situation of independently-mobile hands
[reason for looking: trying to get xmonad+dmenu to notify me when I mistype a command, rather than just failing silently]
June 20th, 2010 § 0 Comments § permalink
Since I’m spectacularly dim, it never occured to me that I can run markdown from within vim. Select your text, run !markdown, and wham! bam! everything is replaced by its technicolor HTML twin.
June 8th, 2010 § 0 Comments § permalink
A bit of Debian lore I always forget: finding which package is responsible for a certain file:
$ dpkg -S filename
e.g:
$ dpkg -S /usr/bin/lintian
lintian: /usr/bin/lintian