How to Stop OSX 10.9 Mavericks From Sleeping When Display Turns Off

Posted December 15th, 2013 in Uncategorized

It seems OSX 10.9 comes with a “feature” (previously off by default) whereby after 2 minutes on battery (the default display off time) the machine goes to sleep. This of course kills the wi-fi resulting in constant dropping of SSH connections, reconnection to IM clients (spamming friends) and a host of other internet related issues. It was badly thought out, badly implemented and just an all around bad choice.

In previous iterations of OSX there were two sliders; one for how long before putting the computer to sleep and the other for putting the display to sleep. Here’s a screenshot of the Energy Saver options in 10.9. Noticed the two have been unhelpfully merged:

Energy Saver Preferences in OS-X 10.9


Fixing this behavior is thankfully very simple and requires only a single terminal command:

sudo pmset -a sleep 0

Here are my power management settings after the change:

$ pmset -g
Active Profiles:
Battery Power		-1*
AC Power		-1
Currently in use:
 standbydelay         10800
 standby              1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 darkwakes            0
 gpuswitch            2
 disksleep            10
 sleep                0
 autopoweroffdelay    14400
 hibernatemode        3
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         2
 acwake               0
 lidwake              1

And with that you should be back to having a properly functioning laptop. If you ever need to revert the change for whatever reason, use:

sudo pmset -a sleep 1

Read More »

Y Mouse Axis Off in VirtualBox

Posted July 11th, 2013 in Uncategorized

I just installed Ubuntu 13.04 in Virtualbox 4.2.16 and found much to my annoyance that the VM thought my mouse was a little higher than it actually was:

Ubuntu thinks my mouse is a little higher than it actually is

It turns out this is caused by having 3D acceleration turned on in VM Settings – Display window. After doing a bit of sleuthing I came across a forum post on with a command that did the trick nicely.

Simply open a terminal and run

VBoxManage setextradata global GUI/Customizations noStatusBar

Restart your VM and voila. Perfect mouse working with 3D acceleration!

Mouse Y-Axis working as it should

Read More »

Fix Home and End Keys on Mac OS X

Posted March 18th, 2013 in Uncategorized

Disclaimer: The details of this post are shamelessly ripped from All credit to those guys, I just wanted a copy for myself for future reference.

On every OS ever, Home, End, Pg Up and Pg Down keys work like so:

- Home -> move the cursor to the beginning of the line
- End -> move the cursor to the end of the line
- Pg-Up -> move the cursor up the length of the viewport
- Pg-Dn -> move the cursor down the length of the viewport

But OSX in all its infinate wisdom decided that doesn’t make sense. Instead they should work like so:

- Home -> move (nothing, not even the cursor, just your view) to the beginning of the DOCUMENT
- End -> move (nothing, not even the cursor, just your view) to the end of the DOCUMENT
- Pg-Up -> move (nothing, not even the cursor, just your view) up the length of the viewport
- Pg-Dn -> move (nothing, not even the cursor, just your view) down the length of the viewport

Now I’m not one to criticise… but that’s stupid and anyone who likes it is stupid ;)


How to Fix

There’s a really useful open source utility out there called DoubleCommand which is highly recommended and I’m sure broadly used. If you want a non-application solution there are also some config files to edit to get the job done.

Most Applications

Create a file
/home/<username>/Library/KeyBindings/DefaultKeyBinding.dict and add the following:

    "UF729"  = "moveToBeginningOfLine:";
    "$UF729" = "moveToBeginningOfLineAndModifySelection:";
    "UF72B"  = "moveToEndOfLine:";
    "$UF72B" = "moveToEndOfLineAndModifySelection:";
    "UF72C"  = "pageUp:";
    "UF72D"  = "pageDown:";


Terminal preferences

Terminal preferences

Open Terminal – Preferences – Settings – Keyboard. Edit each of the following setting their action to ‘send string to shell’.

Key		Escape Sequence
Home		33[1~
End		33[4~
Page Up		33[5~
Page Down	33[6~

Now open /home/<username>/.inputrc and add:

"e[1~": beginning-of-line
"e[4~": end-of-line
"e[5~": history-search-backward
"e[6~": history-search-forward
"e[3~": delete-char
"e[2~": quoted-insert
"e[5C": forward-word
"e[5D": backward-word
"ee[C": forward-word
"ee[D": backward-word
set completion-ignore-case On

Other notes

Restart your machine for changes to take affect. Restarting individual applications also works if you can’t restart for whatever reason. I hear Firefox needs its own changes – if you happen to know what those are comment below and I’ll add them in.

Read More »

How to get CodeIntel working in Sublime Text on OSX

Posted November 24th, 2012 in Uncategorized

SublimeCodeIntel is perhaps the most useful and heavily installed package for Sublime Text but it’s also very difficult to get working. The most common issue people run into is the dreaded endless

Info: processing `PHP’: Please wait…

This can be fixed by navigating to the SublimeCodeIntel package directory and running For to compile we first need to install two things: pcre and XCode Command Line Tools. Annoyingly this is around 1.6GB of files!


Installing XCode Command Line Tools

Head over here and click View in Mac App Store. Hit install and watch your progress in the Purchases tab.

Once installed open it up and go to XCode – Preferences – Downloads – Components and install Command Line Tools.


Installing pcre

This little script is required by the scintilla package of SublimeCodeIntel. First install MacPorts then run:

sudo port install autoconf
sudo port install pcre
sudo cp /opt/local/include/pcre.h /usr/include/

You’re done! Navigate to the SublimeCodeIntel package directory and run sh src/ If all goes well at the end of compilation you’ll see a done! message. Restart Sublime Text and you’re good to go.

Read More »

How to Remove Ctrl+L Key Binding from Pidgin

Posted October 27th, 2012 in Uncategorized
Removed 'Clear Scrollback' shortcut

Removed ‘Clear Scrollback’ shortcut

This would have to be far and away the most annoying ‘feature’ of Pidgin.

In just about every web browser, Ctrl+L is used to highlight the URL bar allowing easy navigation via the keyboard. In pidgin it’s used to clear the scrollback of the active window. As a web developer I’m always hitting Ctrl+L in the browser however every now and then I won’t take notice to which window is active on my desktop at the time and use it while Pidgin is active, clearing out the conversation I’m having with my contact at the time. Frustrating!

There was a bug post here about it but as usual the devs don’t particularly care and instead just pointed to their FAQ page. For convenience here’s how you remove the shortcut:

Open ~/.purple/accels and change

; (gtk_accel_path "<PurpleMain>/Tools/Preferences" "<Primary>p")


(gtk_accel_path "<main>/Conversation/Clear Scrollback" "")

Remember to remove the semicolon at the start of the line!


Read More »

How to Fix Strange Web Page Widths on Android Browser

Posted August 5th, 2011 (Updated 29 Oct 2011) in Linux, Uncategorized

I’m currently working on a mobile version of an existing website utilizing the Responsive Web Design paradigm. One problem I instantly came across was a perplexing page width issue on Android. Even with a blank, HTML5 webpage, the page width was appearing at almost twice the width of my phones native resolution (and 2.5x that of my browsers width). For the record, I’m using Android 2.3.3 vanilla with the default browser on a Nexus One.

Firstly an example:

<!DOCTYPE html>
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src='' />
<script type='text/javascript'>
	$(document).ready(function() {
		document.body.innerHTML = $(window).width();

The above code gives a blank, HTML5 webpage that will display the pages width on load. When loaded, it would print ’800′ on the screen – indicating the page was set to an 800px width. This was clearly wrong.

I quickly noticed that using the following doctype:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "">

gave me the width I was expecting – 320px. Obviously this isn’t an acceptable solution for responsive web design and so another was needed. Meet viewports. With the addition of a simple META tag I was able to fix the issue (albeit losing the ability to zoom in the process). Simply add the following to your HEAD tag and you should be good to go:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />

With this line added, my page now prints 320 to the screen as it should.

For more information, please see this StackOverflow post on the issue.

Read More »

S3 Extension for Google Chrome with File Upload Support

Posted June 26th, 2011 (Updated 29 Oct 2011) in Uncategorized

I’ve been frustrated for a while now at Chromes lack of a decent Amazon S3 extension. Firefox has S3Fox but the closest Chrome users come is S3 which only lets you browse and not modify the files in your buckets. Well that’s just changed!

Over the weekend I finally gathered up enough free time to add support for creation and deletion of files/buckets. While I was in there I made a few other modifications to improve performance and clean things up a bit.

Download the latest version (and the source: Github repo)

Adding a bucket
Adding a bucket
Deleting a bucket
Delete link when hovering over buckets
Adding files
Multi-select file browser for uploading files
Uploading Files
The uploading window
File delete
The confirmation you see when deleting files
Deleting a bucket with files in it
Error you see when attempting to delete a bucket with files in it

Read More »

Updating Samsung F4 EcoGreen Firmware Without a Floppy Drive

Posted May 10th, 2011 (Updated 29 Oct 2011) in Uncategorized

A while back Samsung released a line of relatively cheap “EcoGreen” 2TB hard drives. Being the storage hungry IT nerd that I am, I picked up 2 of the things before finding out their firmware contains a known data write bug requiring a firmware patch best summed up with the following:

“It [the drive] will “forget” to write out its buffer if certan SMART commands are sent to the drive. This is the very definition of silent data corruption.”
- source

Samsung has released a patch but it requires booting into DOS which is incredibly difficult to do on todays floppyless PCs. After a bit of googling I came across the following two solutions to get the job done:

Bootable ISO image

This is the easier solution of the two but it is also the one that didn’t work for me. Michael has created a FreeDOS image with the patch merged in. For the download and installation details, see this post.

Bootable USB image

After trying and failing the above, I settled for a bootable USB image instead. User ZDOS has written up a handy tutorial here which I’ve detailed a bit more in depth below:

  • Download the Windows 98 system files (at the top) and HP USB Disk Storage Format Tool from here and F4EG.exe from here.
  • Install the HP Format Tool and run it with administrator privileges (right click – Run as Administrator).
  • Extract the Windows 98 system files.
  • With the HP Format Tool, format your USB drive (quick format should be enough) as Fat32 making sure you use the Windows 98 system files where it offers.
  • Once done, copy F4EG.exe to your USB drive.
  • Shutdown and unplug all HDDs besides your unpatched Samsung drive
  • Boot your PC and enter the BIOS by pressing Delete during startup. Ensure that your HDDs are set to run in AHCI mode.
  • Reboot either ensuring USB-HDD is selected as your top boot device or press F12 during startup to visit the One Time Boot Device page (results may vary – check your motherboard documentation).
  • You should see a Windows 98 logo flash on the screen for a split second and then a command prompt. In the prompt type F4EG and press enter. Your drive should flash itself.

For plenty more useful information on this issue, I found this forum thread very helpful.

Read More »

Save Firefox 4 Tabs on Close

Posted May 7th, 2011 (Updated 29 Oct 2011) in Uncategorized

It seems firefox 4 has stupidly removed the option to save tabs on exit however there’s a way to get this very useful functionality back. Here’s how:

  1. Type about:config in the URL/Location/Address bar and press the Enter key
  2. Accept the warning message (promise to be careful)
  3. The preferences page/list will open
  4. Filter = browser.tabs.warnOnClose
  5. If its value is set to false, double-click on it (in the lower panel) to toggle its value to true
  6. Repeat steps 4 and 5 for these following 3 preferences also:
    • browser.warnOnQuit
    • browser.warnOnRestart
    • browser.showQuitWarn

Taken from mozilla support. A big thank you to user Helper7677 for this solution!

Read More »

Use .htaccess to Block Pages Based on IP

Posted April 29th, 2011 (Updated 29 Oct 2011) in Uncategorized

Due to the antics of some douchebag (IP address I’ve had to look into blocking pages based on IP address with .htaccess files. This may come in handy to others out there so I figured I’d write up my findings.

To block everyone except specific IPs here’s what you’ll need (more info):

order deny,allow
deny from all
allow from <ip address>

To apply this restriction only to specific files, wrap the above code in the <File> tag:

<Files wp-login.php>
	order deny,allow
	deny from all
	allow from <ip address>

Thanks to user NuclearMeltdown on the #httpd channel on Freenode for his assistance.

Read More »

Page 1 of 212