Keep GimmeSomeTune running


As a follow-up on my previous post on the question, which advocated a simple (but bad) approach to keeping GimmeSomeTune running, here's a better way! The Good Thing (tm) to do is to use OS X's built-in mechanism to start and keep processes running, namely launchd. What we have to do is simply to write a plist containing the info needed by launchd, namely: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.

Deep sleep on MacBook Air Late 2010


Apple's latest MacBook Air boasts to last 30 days on battery when sleeping. Classical sleep will power down most of the machine (display, processor, hard drive, etc) but keep the RAM powered on in order to keep the state of the OS. However, the RAM drains too much power to realistically allow more than a week or so on a single charge. The MBA feat is achieved through “deep sleep”, i.

Semibold keyboard shortcut in Pages


So… Turns out there is no shortcut to turn text to semibold in Apple Pages, from the iWork suite. There are shortcuts for bold and italic respectively, but not semibold (or light / ultralight for that matter) even for the fonts that support it. The closest thing to a solution that I found is through Character Style: Select a piece of text, make it semibold In the Styles Drawer, under Character Styles, click on the little arrow next to “none” and “Create New Character Style From Selection” Assign a Hot Key to the newly created Character Style, by clicking the arrow next to it and Hot Key.

Automatically restart applications on OS X


I use GimmeSomeTune to provide hotkeys and some other goodies for iTunes. It works alright, but is veeeery crashy – usually every dozen hours or so on my machine. How to fix that? Let's relaunch it as soon as it crashes. Simple! In a terminal: for (( ; ; )); do open -W /Applications/Multimedia/; done open is the bash command to launch applications on OS X. It works with all kinds of files: open somefile.

nginx as a reverse-proxy to Apache+Sinatra

              · ·

I was recently developing a Sinatra app that wanted to host from home — setting it up Heroku would have meant migrating from SQLite to Postgres, and I'm lazy. The problem was that I already happened to have an Apache server at home to serve some other content, specifically some calendars through the WebDAV module. The solution I used was simple: instead of having Apache listening on port 80, I set up nginx to listen to port 80 and redirect to either Apache (set to listen on port 8080 instead) or Sinatra (port 9393) depending on the URL.

Convert .approject to .aplibrary


If you ever backed up Aperture projects outside your standard library, you probably noticed the default format for exported albums changed from .approject to .aplibrary in the update from Aperture 2 to Aperture 3. The Finder correctly reports these new .aplibrary as “Aperture Library”, but it seems to have forgotten everything about the old .approject who now appear as standard folders (it appears to be a weird bug on my machine, but still).

Ye old Dock: Leopard-style Exposé under Snow Leopard


Samuel Clay shares an awesome little tweak: replace Snow Leopard's by the from a beta version of SL, and Exposé will get back to the way it acted on Leopard, i.e. the size of the thumbnail is proportional to the size of its window. And it rocks.

Can't find the PostgreSQL client library (libpq)


You might encounter this error while trying to install the pg gem (v0.10.1), or when updating from v0.10. My stacktrace on Mac OS X Snow Leopard 10.6.6 with Rubygems 1.4.2, Ruby 1.8.7 and Postgres 9.0.2 was the following: Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/local/bin/pg_config checking for libpq-fe.

Tunalysis - analyse your iTunes music library

              · ·

Tunalysis is a small(ish) Ruby script that will read your iTunes library, crunch numbers, and gives you a few interesting facts about it, such as: Total number of songs Total number of playlists Average song length Average bitrate Average play count Average skip count Total time spent listening to music Some of these statistics are already available in iTunes, but Tunalysis ultimate goal is to expand iTunes (limited) stats and to give you hindsight on your musical habits and tastes.

A bit of Terminal-fu

         ·      · ·

Yesterday, my little brother was typing something on a linux bash and suddenly went back to the beginning of the line with a simple Ctrl-a. It blew my mind. I don't know why, but it never occurred to me to look for shortcuts in Terminal (and bash in general), other than Ctrl-c for badly behaving processes. I just cursed myself and frantically typed on the left arrow key each time I typed cd instead of cp.