Nate's gravatar Hi, I'm Nate.

I make internet for a living as a Linux System Administrator at Blue Box Group. I like to mess around with a camera. You can find me on Twitter and GitHub or email me. I'm also getting married to a wonderful lady named Liisa.

Sleep Better with OS X 4 months ago

My mid 2012 Macbook Pro had sleep inertia. I'd wait for 10-15 seconds for the screen to turn on after opening the lid, and then upwards of another 10-15 seconds until it would accept any input. Who has 30 seconds to wait around? Those YouTube cat videos aren't going to watch themselves.

Some searching led to a variety of article describing how to "fix" how OS X sleeps with little explanation of what you actually were changing. The common thread was using pmset to modify hibernatemode.

When in doubt, read the man page.

You can view your current sleep configuration with:

nate@nirvana ~> pmset -g | grep hibernatemode
hibernatemode 3

Here's the relevant bit from the man page:

SAFE SLEEP ARGUMENTS

     hibernatemode takes a bitfield argument defining SafeSleep behavior. Passing 0 disables SafeSleep altogether, forcing the computer into a regular sleep.

     ____ ___1 (bit 0) enables hibernation; causes OS X to write memory state to hibernation image at sleep time. On wake (without bit 1 set) OS X will resume from the hibernation image. Bit 0 set (without bit 1 set) causes OS X to write memory state and immediately hibernate at sleep time.

     ____ __1_ (bit 1), in conjunction with bit 0, causes OS X to maintain system state in memory and leave system power on until battery level drops below a near empty threshold (This enables quicker wakeup from memory while battery power is available). Upon nearly emptying the battery, OS X shuts off all system power and hibernates; on wake the system will resume from hibernation image, not from memory.

     ____ 1___ (bit 3) encourages the dynamic pager to page out inactive pages prior to hibernation, for a smaller memory footprint.

     ___1 ____ (bit 4) encourages the dynamic pager to page out more aggressively prior to hibernation, for a smaller memory footprint.

     We do not recommend modifying hibernation settings. Any changes you make are not supported. If you choose to do so anyway, we recommend using one of these three settings. For your sake and mine, please don't use anything other 0, 3, or 25.

     hibernatemode = 0 (binary 0000) by default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

     hibernatemode = 3 (binary 0011) by default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

     hibernatemode = 25 (binary 0001 1001) is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

     Please note that hibernatefile may only point to a file located on the root volume.

So, "3" is a combination of sleep and hibernation where it's supposed to wake from memory like a regular sleep, but also dumps the memory to disk in case the battery dies. From my experience when I sleep for more than a few hours I consistently experienced slow wakes. I assume this is because it's waking from disk, rather than memory.

I almost never sleep my machine until the battery dies, and when I do I certainly don't leave unsaved work lying around. I just want good old-fashioned sleep.

nate@nirvana ~> sudo pmset -a hibernatemode 0

Seems to have done the trick. Sweet!

Wot Gorilla? is Pretty Awesome 8 months ago

I don't even know what I would call this other than "good."

More Wot Gorilla?

Move the Windows 7 (Vista? XP?) Recycle Bin to Computer 10 months ago

Take your desktop back and move the Recycle Bin to Computer.

You can add or remove the Recycle Bin from Computer by adding or removing this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{645FF040-5081-101B-9F08-00AA002F954E}

Then you can remove the Recycle Bin from your desktop by navigating to

Control Panel > Appearance and Personalization > Personalization > Change desktop icons

and unchecking "Recycle Bin"

Using old-style Sass syntax With Rails 10 months ago

When you're feeling the need for terseness, add this to your application.rb:

config.generators.stylesheet_engine = :sass
config.sass.preferred_syntax = :sass

All Moles Must Die! 11 months ago

As a recent first-time home buyer, I've found myself putting on a lot of extra hats lately. By far the hardest job I've come across yet is that of mole killer.

Moles are nature's assholes, existing expressly for the purpose of destroying your yard.

So far, I've tried poisons where the goal was to have them eat it, and also not to eat it, but rub against it and later, unknowingly, ingest it. Neither succeeded in anything more than a terrible stomach ache.

At this point, I immediately jumped to the obscure solutions on YouTube. For no reason at all, moth balls made the most sense to me. Moths balls are a fumigant, so why the hell not. This kept our mole at bay for a couple weeks.

When he returned, it was time to get serious. Cleaning up mole hills sucks.

Mole ultra-violence.