WhiteSpace faces in Emacs 23

This is a good old case of RTFM, but since I spent a couple of hours figuring it out, I thought I’d blog about it anyway…

The WhiteSpace package in Emacs allows you to visualize whitespace in your code. The overall settings of the package are controlled with the ‘whitespace-style’ variable. Before Emacs 23 you didn’t need to include the ‘face’ option to make different faces work. However, since Emacs 23 you need to have it set.

Now I can keep obsessing about whitespace with an up-to-date version of Emacs, and maybe publicly posting stuff like this will help me remember to RTFM in the future also :)

Written by Sakari Bergen, Posted , last modified

Multiuser screen made easy

The idea for this all started with someone mentioning

it’d be good if there was some magic thing which did some SSH voodoo to get you a shell that the person on the other end could watch

So, I took a quick look around and noticed that Screen can already do multiuser sessions, which do exactly this. However, controlling the session requires writing commands to screen, which is both relatively complex for beginners and relatively slow if the remote user is typing in ‘rm -Rf *’ ;)

So, I created a wizard-like python script, which sets up a multiuser screen session and a simple one button GUI (using PyGTK) for allowing and disallowing the remote user access to the session. It also optionally creates a script which makes it easier for the remote user to attach to the session.


Known issues:

  • The helper script creation process for the remote user does not check the user input and runs sudo. Even though the script warns the user, it’s still a potential security risk
  • If the script is terminated unexpectedly, the screen session will stay alive, and will need to be closed manually before this script will work again

Resolving the issues?

Fixing the security issue would be just a matter of more work. However, the lingering screens are a whole different problem: I tried to find out a way to get the pid for the screen session, but failed to find a way to do this in python. This would have made the lingering screen sessions less harmful, as all the communication could have been done with <pid>.<session> instead of simply <session>, which it uses now. The subprocess.Popen object contains the pid of the launched process, but the actual screen session is a child of this process, and thus has a different pid. If anyone can point me toward a solution to this, it’d be greatly appreciated!

Written by Sakari Bergen, Posted , last modified

New site up!

I finally got the work done, and here’s the result! I moved from Dupal to WordPress, as it feels better for my needs. So far I’ve enjoyed it more than Drupal.

I didn’t keep all of the content from my old site: I recreated most of it and added some new content. I also went through links to my site with Google’s Webmaster Tools, and added redirects to urls which are linked to from other sites (and resurrected one blog post).

It’s been a while since I did any PHP, HTML or CSS. I almost got frustrated for a moment, but after reading this article, things progressed much easier. Thanks to the author, Andrew Tetlaw! I was also inspired by David Robillard’s site, which is mostly based on the Barthelme theme. However, I started out with Automattic’s Toolbox theme, customizing most of it.

If you find something that looks or feels strange, please comment!

Written by Sakari Bergen, Posted , last modified

Shell statistics

I picked up this meme from the summercode IRC channel via myrtti. (You can follow it back quite far from there…)

sbergen@jt7-153 ~ $ history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -nr |head -n 10
155 ./sconsi
91 gtk2_ardour/ardev
65 sudo
23 cat
20 cd
19 svn
18 gtk2_ardour/ardbg
11 scons
10 mysql
9 ls

You can clearly see what I’ve been doing lately, and I thus suggested that this would be part of next year’s summercode applications ;)

Written by Sakari Bergen, Posted , last modified