More Fun with KeyRemap4MacBook

Recently I wrote a post on how to remap your Caps Lock key in a context sensitive way using KeyRemap4MacBook. Since then (just now) I have started to use my Mac laptop with an external keyboard. Not anticipating any issues, I got a little scared when the key remap I’d spent a while investigating and setting up didn’t work. It is with great relief that I now post the solution. You also get a bonus tip if you make it to the end of the post.

Continue reading

Caps Lock for Terminal Junkies Using OSX

It’s been a couple of years since I’ve owned a Mac, but now I’m happily back in Apple’s clutches. During the intervening period between owning my last Mac and this one, I fell in love with remapping the Caps Lockkey to be another control key. Given that I spend a fair chunk of my day in Vim and a terminal, this saves alot of strain on my pinky finger and puts an otherwise useless key to good use. However, now that I’m back in Mac land I faced a dilemma: should Caps Lock be the control key, or the command key. You see, I’ve become very use to hitting caps+c/v to copy and paste, but Apple, bless their infinite wisdom, have a command key that is used for this purpose. What’s a geek todo?

Continue reading


While at home sick today I fired up Firefox to watch some videos on my media centre PC and was quickly disappointed to hear the audio coming from the laptop’s speakers rather than through my television. XBMC on this machine uses HDMI for audio out, and has since I set it up, so I was confident that it was just a matter of configuration. After some messing around trying to find config windows in XFCE and searching the world wide web, I found a post mentioning pavucontrol. Hoping pavucontrol offered a solution I installed it and launched it from the command line. It gave me a nice GUI as seen below, and more importantly, allowed me to configure the output device that PulseAudio should use by default.

screen capture of choosing HDMI output in pavucontrol GUI

After I’d enjoyed my video, I thought I should try and gain at least a cursory understanding of what I’d just done. Wikipedia came to the rescue with a high level description of PulseAudio, and a helpful diagram that shows where it sits in the grand scheme of things. One thing that really caught my eye was the following; “One of the goals of PulseAudio is to reroute all sound streams through it…”. With that in mind I’m guessing that a fair few applications on my system are using Pulse, but I’d just never noticed the issue because I could configure XBMC to use a specific output (it has an independent sound system?). In any event, I hope this helps some other confused soul to get their audio pumping through HDMI.

XBMC on Linux Mint Debian Edition

Since I built my file server (now running FreeBSD after a stint with Mythbuntu) I’ve used a variety of front ends to view all of the juicy media stored on it. My second most recent front-end was a re-purposed Lenovo Thinkpad Edge with a broken screen. It ran Windows 7 with Windows MCE and a Microsoft MCE remote. It was dead easy to setup, requiring only that I plugged in a HDMI cable and the IR receiver, and provided some media locations from the comfort of my couch. Unfortunately, the terrible WiFi performance meant that video often lagged for brief periods of time, or at its worst, stopped playing altogether. After a few months of frustration, I decided to try out Linux Mint Debian Edition to see if it performed better, given that all of the other WiFi connections in the house worked well. It did. So far I’ve been very happy with the whole system, so I thought I’d share how I got here. A warning now: if you’re not comfortable with basic Linux commands and editing configuration files by hand, then you should probably stick to Windows or Mac. Having said that, attempting things beyond your current skill level is how you learn. If you get really stuck, you can always post a comment and I’ll see if I can help you out.

Continue reading

Swearing at your File System

Recently I was working on a Solaris box remotely and lost my temper.  I can’t remember why, and it’s not relevant.  What is relevant is that in my rage, I swore at my file system.  I know it was childish, and I definitely know better, but in the heat of the moment, I made a mistake.  Unfortunately, I was in the process of naming a file in Vi, and I ended up with a file name full of punctuation marks.  Realising my mistake, I immediately tried to remove the offending file.  To my surprise, while I could see the file by issuing a simple ls, I couldn’t remove it. Bash issued a syntax error, interpreting the punctuation marks as special symbols. I now realise that I could have very easily escaped the offending characters, but I wasn’t that smart at the time, so what follows was my rather roundabout solution. While these steps may not be useful in this scenario, parts of the solution may prove useful for others.

Remembering back to my systems architecture classes at university, I started thinking of how I might get to my file via its inode rather than its file name.  A quick search of the man page for ls revealed that I could list all of the inodes in a directory. Success; I now had another method of accessing the file.  Checking the man page for mv and rm, I couldn’t see any way to rename or delete the file via its inode.  Having recently done some work with find I knew how versatile and useful a tool it is.  Checking its man page, I was pleased to find that I could search for files by their inode number.  Combining this with the exec flag, I was able to rename my file to something sensible.  The code snippet below gives an example of how this all fits together.

ajmccluskey@solaris $ ls
^()$@  Documents
ajmccluskey@solaris $ ls -i
264015 ^()$@    262180 Documents
ajmccluskey@solaris $ find . -inum 264015 -exec mv {} test \;
ajmccluskey@solaris $ ls
test  Documents

So there you have it. My lacking knowledge of Bash will never get in the way of me solving a problem; albeit in a very roundabout manner.