This is a read-only archive!

156 Posts in Category 'Linux' RSS

Productivity Booster

I came up with a great way to increase my productivity recently. You need a locally-running Apache server for this to work most effectively.

First you need to set up a redirect for 404 requests to localhost. On my system I determined that DocumentRoot is /srv/http, so I set this up in /etc/httpd/conf/httpd.conf:

<Directory "/srv/http">
    AllowOverride All

Next I edited /srv/http/.htaccess to redirect 404's to a main index page:

ErrorDocument 404 /index.html

Then I created /srv/http/index.html:

        <title>GET BACK TO WORK, YOU HOBO</title>
        <style type="text/css">
            html {
                background: #f00;
            h1 {
                color: #0f0;
                font-family: sans-serif;
                text-align: center;
                margin-top: 100px;
                font-size: 64pt;
        <h1>GET BACK TO WORK, YOU HOBO</h1>

Almost done; the final step is to edit /etc/hosts:

Now I see this. Image hidden behind a link to spare the eyes of my readers.

If this doesn't work, you could try making the background color flash quickly between red and green, or add a background MIDI and some animated GIFs.

October 08, 2010 @ 8:09 AM PDT
Cateogory: Linux

Git info in your ZSH Prompt

Recently I discovered vcs_info recently. This nicely replaces the horrible hack I was using previously to show current Git status. vcs_info works with VCSes besides Git, and it handles some of the magic and keeps your .zshrc clean, so those are nice benefits.

I used some Unicode to display colored circles. Green if there are staged changes, yellow if there are unstaged changes, and red if there are new untracked-yet-unignored files. Below is a picture.

I like this because I'm constantly forgetting to git add newly-created files. Then I have to add them and amend my commit, and so on. I like a prompt that reminds me that new files showed up that need to be added or ignored.


autoload -Uz vcs_info

zstyle ':vcs_info:*' stagedstr '%F{28}●'
zstyle ':vcs_info:*' unstagedstr '%F{11}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
precmd () {
    if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
        zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{blue}]'
    } else {
        zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{red}●%F{blue}]'


setopt prompt_subst
PROMPT='%F{blue}%n@%m %c${vcs_info_msg_0_}%F{blue} %(?/%F{blue}/%F{red})%% %{$reset_color%}'


ZSH and Git


As you can see in the screenshot, when you have a brand new Git repo (no commits yet), vcs_info fails to show you that there are files staged. It works OK after you have at least one commit though.

vcs_info doesn't (yet?) handle showing untracked files. So I hacked a function to support it.

Finding a good Unicode symbol that displays nicely in monospace font was annoying. If I ever change fonts, I'll likely have to pick a new symbol. It also doesn't display too well in a real tty. Or over SSH when using Putty. So I may have to scrap the stoplights and use plus-signs or something. Sigh.

September 10, 2010 @ 6:31 AM PDT
Cateogory: Linux
Tags: ZSH, Git

X automation with xte

I learned today (via a great blog post) about xte. This program lets you simulate X Windows mouse and keyboard events from the commandline. How much more awesome can you get?

Hans illustrates how to integrate xbindkeys and xte to make KDE4 effects activate. I wanted the KDE4 "Desktop Grid" to appear when I press a mouse button (because my new mouse has a lot of buttons to spare), so this is exactly what I was looking for.

xte is the kind of glue that makes Linux awesome. KDE lets you set global keyboard shortcuts for lots of things. xbindkeys lets you assign shell commands to mouse buttons. And xte ties the two together. Possibly none of the programmers on these three tools knew about the others, but they interact perfectly to let you do anything you want.

You may be thinking, "If you want to work with KDE from the commandline, why not use DBUS?" That's what I tried to do first. But I can't for the life of me figure it out. There's some indication that we might be able to do this somday, like so:

qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut ShowDesktopGrid

Or maybe it's already in the latest version of KDE and I haven't upgraded yet. Either way.

By the way: could DBUS possibly have a more verbose or cryptic interface? I was hunting through the available DBUS commands looking for something that would show the Desktop Grid, and I ended up having to scan through lists of crap like this:

~ % qdbus org.kde.kwin /KWin                         
method Q_NOREPLY void org.kde.KWin.cascadeDesktop()
method void org.kde.KWin.circulateDesktopApplications()
method bool org.kde.KWin.compositingActive()
signal void org.kde.KWin.compositingToggled(bool active)
method int org.kde.KWin.currentDesktop()
method QList<int> org.kde.KWin.decorationSupportedColors()
method void org.kde.KWin.doNotManage(QString name)
method Q_NOREPLY void org.kde.KWin.killWindow()
method QStringList org.kde.KWin.listOfEffects()
method void org.kde.KWin.loadEffect(QString name)
method QStringList org.kde.KWin.loadedEffects()
method void org.kde.KWin.nextDesktop()
method void org.kde.KWin.previousDesktop()
method Q_NOREPLY void org.kde.KWin.reconfigure()
method void org.kde.KWin.reconfigureEffect(QString name)
method void org.kde.KWin.refresh()
signal void org.kde.KWin.reinitCompositing()
signal void org.kde.KWin.reloadConfig()
method bool org.kde.KWin.setCurrentDesktop(int desktop)
method void org.kde.KWin.showWindowMenuAt(qlonglong winId, int x, int y)
method Q_NOREPLY void org.kde.KWin.toggleCompositing()
method void org.kde.KWin.toggleEffect(QString name)
method Q_NOREPLY void org.kde.KWin.unclutterDesktop()
method void org.kde.KWin.unloadEffect(QString name)
method bool org.kde.KWin.waitForCompositingSetup()
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()

This is line noise to me.

August 06, 2010 @ 6:03 AM PDT
Cateogory: Linux
Tags: Hardware, KDE, Xorg

Clementine: A triumph of Free Software

Ages ago, in the long-forgotten days of 2008, there was Amarok 1.4. And it was good. Then KDE4 came along and Amarok was rewritten, reshaped, becoming something... different. Something unsettling. Something not altogether pleasant.

Fear not. Today we have Clementine.


I consider Clementine a triumph of Free Software. A great project fell off the rails, so someone else picked up the pieces, forked it and kept the spirit alive.

July 13, 2010 @ 4:48 AM PDT
Cateogory: Linux

Sorry for the downtime

This isn't the kind of email I like to see when I wake up:

Our backend monitoring system has detected an error on the host where your Linode resides which could lead to a failure condition. In order to protect your Linode, we have scheduled an emergency migration to a different host which will commence shortly. Please note that there is currently no issue with your Linode - this is a proactive measure we are taking to avoid an issue in the future.

We apologize for any inconvenience this may cause. Should you have any questions or concerns, please do not hesitate to reply to this ticket.

The server rebooted and my sites didn't come back up, so there was some downtime. Sorry about that.

July 08, 2010 @ 1:29 AM PDT
Cateogory: Linux
Tags: Linode

Screenshot June 2010

I haven't posted one of these in a while. I've been in an 8-bit kind of mindset for a while:


What I actually stare at for 8 hours every day:


KDE4, Buuf icons, QtCurve, wallpaper is from somewhere on the internets.

June 08, 2010 @ 5:27 AM PDT
Cateogory: Linux

Clementine: looking great

Amarok is looking really good these days:


Hold on, that's not Amarok! It's Clementine, a Qt4 port of Amarok 1.4, aka "my dreams finally come true", aka "what Amarok 2 should've been". It's functional right now, not quite as fully-featured as Amarok 1.4, but all the major bits are there, and it's being actively developed.

Once again I am amazed at and eternally grateful for the number of choices of media players there are in Linux. It seems like I write a new blog entry every other week saying how great some media player is. The reality is that there really are tons of great options. And this is yet another.

But Amarok 1.4 was special. And I really hope Clementine succeeds.

March 06, 2010 @ 6:59 AM PST
Cateogory: Linux

Exaile: The best Amarok since Amarok 1.4

Like a sad dumb dog who still hopefully visits the grave of his dear, departed master, every once in a while I try Amarok 2 again. Unfortunately, there has been no improvement in usability since the last dozen times I checked.

But have you seen Exaile lately? This is what the bleeding edge version looks like:


It's pretty nice. It's about as close as you can get to a stable, fully-functional Amarok 1.4-ish player nowadays.

Aside from looking good, Exaile is good at handling ID3 tags (a few Japanese tags that Amarok 2 displays as ????????, Exaile displays properly) and it's pretty fast to rescan my collection nowadays, which is nice. It does fairly sane grouping of multi-artist albums under "Various artists". It supports moodbar and song lyrics and cover art fetching and such, if that's the kind of thing you enjoy. It even splits the library display by the first letter of the artist names, just like Amarok 1.4 did, which is awesome.

I did have some problems installing the dependencies (python bindings for webkit?) for some of the plugins, but oh well. I figured it out.

Today I went so far as to install gnome-settings-daemon and gnome-control-center just so Exaile wouldn't look like crap. I use KDE4, and I haven't touched Gnome or any Gnome libs in a few years, so this is saying something.

Mark Kretschmann, an Amarok dev, recently wrote an article about the paradox of choice, in which he said (probably correctly) that being presented with too many options and too many choices end up paralyzing people and making them miserable.

Sorry, but the irony was overwhelming...

Exaile Explained

Amarok2 Explained

I really do believe there's a good program buried somewhere in that mess of controls, desperately wanting to be free.

This post is related to Exaile
February 12, 2010 @ 10:29 AM PST
Cateogory: Linux
Tags: Amarok, Exaile

Virtualbox looking good

I blathered on a bit about VMWare a while back, and lots of people recommended VirtualBox. I'm trying VirtualBox 3.1.2 with Windows 7 host and Linux guest, and it works surprisingly well. I've used it successfully to hack on a bunch of projects while I'm stuck on a Windows laptop (shudder).

Installing was essentially self-explanatory. I never read any docs, except when it came to installing those "Guest Addition" programs to allow better mouse-handling. And I had to look up how to go about sharing folders between host and guest. But the documentation was clear, I found a short description how to set up the share and then and a command to run to mount the host folder:

sudo mount -t vboxsf ShareName /mnt/mountpoint

I'm using Gnome in my guest, because I haven't used it in a long time and I was curious what'd changed. I'm amazed even Compiz works in the guest. I recall a time in the very recent past when my computer couldn't even handle Compiz natively, let alone in a virtual machine.

Perhaps the best part about VirtualBox compared to VMWare is that there is one product called "VirtualBox" and one download link that took me a matter of seconds to find. Fancy the thought.

This post is related to VMware: What's in a name?
January 20, 2010 @ 4:08 AM PST
Cateogory: Linux


In my ongoing quest for a good audio player (after becoming an Amarok exile and refugee) I settled on aTunes. aTunes is really good except for two quibbles...

One, it's a Java app (a Swing app as far as I can tell?) and the GUI is enormous and unresponsive and certain parts of it really behave strangely. Like clicking in text fields to focus them sometimes requires multiple clicks. It's just annoying enough to constantly throw me off.

The second problem is that it crashes all the time. Music keeps playing but the GUI disappears. pkill java has become necessary far too often lately.

So now I'm trying Exaile. It's very Amarok 1.4-like. I can overlook the fact that it's GTK because it's otherwise so nice. Best part, when asked if Exaile is going to go the way of Amarok 2, the dev has this to say:

Never ever ever ever ever ever.

I'm having a hard time coming up with any deficiencies in Exaile so far. Everything in the GUI is laid out nicely. No crashes yet.

One of these days I'll find an acceptable app... Most of these apps are good, but I'm too picky. I love how Linux lets me be picky. There is a wealth of options, and everything is free. I am spoiled.

November 28, 2009 @ 3:22 AM PST
Cateogory: Linux