Bash history nirvana

09 October 2015 by Lincoln Ramsay

I thought I’d written about this ages ago. But it turns out I didn’t.

The default bash history handling is terrible. Run one shell at a time and always cleanly exit the shell and it’s ok, but run more than one shell at a time and abnormally exit shells and disaster will strike. The number of saved entries is relatively tiny. Duplicates are saved and you can’t really share history between running shells.

Here’s how you fix it.

First, we want to append to the history file rather than clobbering it.

shopt -s histappend

I once had a bash start and fail to read .bashrc properly. It clobbered my history. So now I use a non-standard file to keep broken bash shells from clobbering the history.


Store lots and lots of history.


I don’t want duplicates in the history. Also, I ignore commands that start with a space (eg. for those times when you have to give something sensitive like a password to a command).

#HISTCONTROL=ignorespace # start a command with a space and it doesn't go into history
#HISTCONTROL=ignoredups # ignore duplicates
HISTCONTROL=ignoreboth # both of the above

You can run history -a to dump the history immediately and history -n to import history into a running shell. I like to automate the dumping so that an abnormally terminating shell doesn’t take it’s history with it. I get bash to call a function just before showing a prompt. I do lots of other things in here, and dump history too.

    history -a # export history immediately

I don’t automate history importing.

If you’re looking for the copy+paste version, here it is.

# Don't clobber history
shopt -s histappend

    history -a

The Mysterious Cities of Gold Soundtrack

25 September 2015 by Lincoln Ramsay

I watched at least a few episodes of The Mysterious Cities of Gold (hereafter TMCoG) as a kid. More recently, the series was shown on TV and the whole family sat down to watch it. Then last weekend, an offhand comment got me wondering about the soundtrack. TMCoG has awesome music. Very 70s, French and electronic but still awesome.

Some searching quickly turned up information about an LP release that was done at the time. And apparently there was a CD for sale but I couldn’t track it down. I did find a youtube playlist that had been put together. Some of the tracks are preserved well, some not so much. Still… it’s the TMCoG music so it’s great.

Then I stumbled onto the “re-orchestration” scene. People clearly want better sounding audio and have re-made the songs. The main problem with this is that it all sounds completely different. Except for this one guy. He has gone as far as sourcing the same instruments (I’m guessing mostly old synths) so that he can faithfully re-create the music. And he totally nails it.

His site is The Grand Heritage. It’s all in French so you’ll need to run it through a translator.

This guy had a CD of re-created tracks out in 2002 (again, I couldn’t find it), then started up this site in 2011 to continue the work. There’s 88 songs there. Further than any soundtrack would normally go, he seems intent on re-creating all the music, even little incidental bits. I love it!

iMovie HD Launcher for Yosemite

20 August 2015 by Lincoln Ramsay

I have been using iMovie since version 1 on the classic MacOS. Which means I know the iMovie HD interface really well. So I was dismayed to find that it doesn’t launch on Yosemite.

But I found information that said it does run, it just can’t be launched by clicking on its icon.

I already had some Automator applets that launched apps so I modified one to launch iMovie HD and gave it an icon. If you like the idea of a clickable launcher for iMovie HD, get it here. If you don’t want to trust a random app you can open it in Automator to verify it for yourself.

Classic sci-fi radio plays in podcast form

01 July 2014 by Lincoln Ramsay

So I recently discovered some classic sci-fi radio plays on archive.org. X Minus One (and its precursor, Dimension X). The only problem is… downloading episodes from web pages sucks and my podcast app doesn’t take an M3U playlist as input. So I wrote a script to generate some podcast files and put them over here.

Balancing dice

21 April 2014 by Lincoln Ramsay

It started simply enough. Someone posted a dice balancing photo. I was at work, bored and I had some dice so…


This led to a retaliation but at home I have different dice which are harder to stack. Luckily it was Easter so I had some free time one morning.


Not bad, but I knew I could do better. I really wanted to have more than one “twisted” dice but it’s way harder to do. Many frustrated attempts later, I achieved this.


This may well be as good as it gets. I’m not sure I could get anything on top of that top dice. At least, not with only 2 hands. I could probably get more in the middle… but I’m a bit short of dice at home. Turns out our games tend not to use dice, or they use unsuitable ones. Maybe during our next sprint planning session at work…

How to automatically reclaim your IRC nick and other things (for Quassel)

21 March 2014 by Lincoln Ramsay

I use Quassel. The server runs all the time so I’m always logged in. Since the server runs at my home, I sometimes get bumped offline as my IP address changes (why? I dunno, it just does). Since the server re-connects within the normal IRC timeout period, this means it can’t take my nick. You can fix this manually when you login and notice it but… that’s a bit of a pain. Here’s how I did it automatically. more…

How to disable pingback and xmlrpc advertising

13 March 2014 by Lincoln Ramsay

I don’t know if wordpress sites respond to ping backs if you turn the checkbox off but… can’t hurt to force it off anyway, right?

So I took the instructions here but I changed one thing. I can’t just turn off xmlrpc altogether because I use the wordpress mobile app. But all the rest is good. This turns off the advertising (headers and such, references to xmlrpc.php that end up in your pages) as well as forcibly blocking any ping requests. The mobile app still works. Maybe other things don’t but… I don’t use them.

Make a directory under wp-content/plugins and a .php file to put the following into. You then have to enable the plugin from the dashboard. more…

Low memory due to leftover app_process instances

12 March 2014 by Lincoln Ramsay

I have a RAZR i with the standard UK 4.1.2 ROM. Sometimes I’ve had low memory problems or periods where the battery runs down unexpectedly. I recently started experiencing severe memory shortage every now and then. Despite my initial assumption this was related to running with data disabled, it turns out something else was the culprit. The problem came down to a large number of app_process instances hanging around, taking up 8M of RAM each. more…

Revisiting my web host backup solution

04 March 2014 by Lincoln Ramsay

So for some reason, nosupportlinuxhosting removed /usr/bin/rsync from my web host on 27 Feb. I thought about emailing them but… they do advertise how they ignore support questions.

I have a workaround anyway. This is how I backed up my site at a previous hosting company that didn’t provide rsync. It’s not quite as good but it’s a lot better than just downloading everything all the time. more…

How to shuffle an iTunes 11 playlist (using AppleScript)

10 January 2014 by Lincoln Ramsay

iTunes 11 removed a feature I used quite a bit, the ability to shuffle a playlist.

No, I don’t mean playing the songs in a random order, I mean changing the unsorted order of the songs in the playlist.

Today, this annoyance finally got the better of me so I searched for a solution. more…

← Older posts

Newer posts →