sleep snippets

How to put the run loop to sleep

Tagged sleep, runloop, objective-c  Languages objectivec
NSDate *stopDate = [NSDate dateWithTimeIntervalSinceNow:2];
[[NSRunLoop currentRunLoop] runUntilDate:stopDate];

My Mac won't go to sleep

Tagged mac, pmset, sleep  Languages bash

If your Mac won’t go to sleep, try this:

pmset -g assertions

Check the output for details on which processes and voodo magic is keeping your iMac up all night:

Listed by owning process:
   pid 4627(cloudd)...
Idle sleep preventers: IODisplayWrangler

Things you can try:

  • Resetting the printing system (CTRL+click in the left pane of the Printers and scanners settings)
  • Unplugging external devices (USB, bluetooth, etc)
  • Voodoo


Procfile dependencies

Tagged dependencies, foreman, overmind, procfile, sleep  Languages bash

You can use the sleep command as a way of specifying dependencies in a Procfile even if dependencies are not explicitly supported.

For example:

redis:        redis-server
sidekiq:      sleep 5; bundle exec sidekiq
rails:        sleep 5; bundle exec rails
proxy:        sleep 10; haproxy -c haproxy.cfg