I Eat Rainbows

The random ramblings of a self-professed rainbow eater

Archive for February 2009

Ramdisks, Firefox, and the speeding up thereof

without comments

So this idea has been going around the internet, of putting your firefox profile directory into tmpfs, to get around sqlite’s insistence on reliability when speed is more important.

I implemented this, and liked it. Speed, nom.

But! I happen to be using an ailing old laptop, with roughly as much RAM as a toaster. It could just handle the extra load, but the profile directory was constantly spewing expletives at me – most notably, failing silently when trying to install addons.

There did exist RamFS, which grew and shrunk in RAM as needed. Still, that’s a lot of memory…

And, well, the idea itself didn’t seem that elegant to me. Storing an extra copy of your profile directory? and resynchronising it with the harddisk copy every so often? This is Linux, after all, the OS that gives you fine-grained control of your system should you so desire – surely there must be a cleaner way.

And then … from what I understood, SQLite was IO bound in writes. Reads shouldn’t really need locks or suchlike, right?

This is what I did:

$ x=[random junk firefox uses]
pushd
cd ~/.mozilla/firefox
mv $x.default $x.default.fs
mkdir $x.default.tmp
mkdir $x.default
echo firefox.tmp $(pwd)/$x.default.tmp ramfs noauto,user,exec 0 0 | sudo tee \
    -a /etc/fstab
echo firefox.cow $(pwd)/$x.default aufs \
    dirs=$(pwd)/$x.default.tmp:$(pwd)/$x.default.fs=ro,noauto,user,exec 0 0 | sudo \
    tee -a /etc/fstab
sudo sed -i 's/exit 0//' /etc/rc.local
echo "mount firefox.tmp\nmount firefox.cow\nchown -R $(whoami): \
    $(pwd)/$x.default.tmp\nexit 0" | sudo tee -a /etc/rc.local
echo rsync -av --delete $(pwd)/$x.default/ $(pwd)/$x.default.fs/ > ~/bin/cpfox
chmod +x ~/bin/cpfox
popd

Then crontab -e and add cpfox to it, maybe once every halfhour.

Neat, huh? At least the intent – aufs layering a dynamically growing ramfs on the filesystem, and the changes being synced across every so often. I’m not too sure if the actual implementation does what I want it to, and it could probably do with a ram-clear every now and then.

If anyone has any tips, please! Meanwhile, I hope this will help some people out there.

Written by Sohum

20.02.2009 at 21.53.46 (954)

Posted in linux, technology

Tagged with , , , , , ,

They Fight Crime! 1: The Republican Assassin

without comments

He’s a suicidal Republican assassin trapped in a world he never made. She’s a psychotic impetuous lawyer with an incredible destiny. They fight crime!

This time, it would all be worth it.

He fired his grapple hook, and moved carefully up. Fourth … fifth … sixth. There. He carefully sliced some glass out, and slipped in.

He padded inside, carefully finding the bedroom. He’d been careless once before, but this was not the place for those thoughts.

He took a moment to look around. The standard donkey, the smiling blackface, that insipid slogan. His source had been right on the money – this was another of the fanatics. Volunteered day in day out at the local center, no doubt – it made him sick, and not just the exploitation of the system.

He looked at the mark. Stupidly beatific smile on his face, cuddled up. Safe and secure in his own dream world.

He sighed. This was always where he got second thoughts. Not because of any sympathy, no, absolutely not. But because the missions were all that gave him focus, drive, purpose. He had no desire to regress to listlessness.

He shook his head, and carefully assassinated the mark. He watched himself do this dispassionately – where’d the drive and zeal he’d once had gone?

He left via his getaway car, and drove away to the prebooked motel, already feeling drained.


The next day’s news. Happy shiny people talking about happy shiny policies and happy shiny ideas and happy shiny futures. He looked at his bag, and at the twist of rope sticking out, but didn’t even seem to have the energy to attempt it. What kind of life was this to lead? Why on earth was he doing this, when all it did was be sensationalised a little, never stopping or even giving pause to the country’s slow inexorable slide into its own destruction?

He kicked himself back into the bed. No, he just couldn’t take it. He could not force himself to live longer in this horrible, corroded country and world. He would simply -

His cellphone rang.

He hit answer and speaker. “Yes?” There was no need for names.

“Another specimen of the virus has been found. Head over to Shangri-La, and you’ll be given the details, and your payment for the last strain.”

He nodded listlessly, and, realising, spoke. “Yes.”

Maybe this time it would all be worth it.


“Police have found the dead bodies of prominent local Democratic supporters, Asheet Narjwal and Timothy Clyde, in their homes this morning. The state has offered protection to any other campaign leaders, and most have taken up the offer. Noted local libertarian Bartholomew Ressinger has turned down this offer, however.”

“Heh. I’ve got so much protection of my own that I’m confident I won’t need anything else. Heck, apart from all the tech, I’m a licensed gun owner! The killer’d have to be bloody suicidal to come after me…”

Written by Sohum

03.02.2009 at 20.42.40 (904)

Posted in writing

Tagged with ,