Essential Mac OS X tools: NoSleep extension

macosx-nosleep-extension – The MacOS X kernel extension, preventing sleep when you close the lid. – Google Project Hosting.

Very useful, especially when watching a movie on a projector using HDMI directly, instead of using AirPlay with an Apple TV. Thanks to NoSleep, you can close your MBA’s/MBP’s lid but still stream the movie to the projector.

If I were Apple, I’d be a bit embarrassed that such a setting is not already built-in.

macvim – Vim for the Mac

When using Mac OS X, I used to use the CLI vim by the excellent Homebrew package manager.

Now I’ve just stumbled over macvim, which is kind of a “deluxe vim” for Mac OS X, including adjusted key bindings for the Mac and a GUI menu, supporting Cocoa file dialogs, among others.

It’s highly recommended if you want to have the best of both the CLI and GUI editor worlds.

Download

Using IRC on the go

Running the console IRC client weechat (not to confuse with the wechat messenger) in a screen or tmux session on a Linux (or Mac OS X) server and accessing it trough mosh is a great way to use IRC on the go, i.e. with a unsteady Internet connection.

P.S. Thanks to Devaux and rmeyer for the hints

Mac OS X: Reduce/increase workspace switching delay

Does dragging windows to the adjacent workspace in Mac OS X feel sluggish? Try lowering the according delay, e.g. to 0.1 seconds. For a persistent change, enter the following in a terminal:

defaults write com.apple.dock workspaces-edge-delay -float 0.1; killall Dock

If you’d like to have a longer delay, try setting a value of 1.0 or even 2.0.

System information on Mac OS X

Mac OS X comes with a pretty useful tool to list all the details about your system:

# system_profiler

E.g. to find out whether your RAM supports ECC:

# system_profiler|grep ECC
          ECC: Disabled

Or wether your SSD supports TRIM:

# system_profiler|grep TRIM
          TRIM Support: Yes

Some helpful Git resources

A friend recently told the following joke:

“The idea that git can be used offline is an illusion – you still need connectivity for googling which arguments to pass to what command.”

That’s an exaggeration, of course, but as always, there’s a grain of truth in it. So here we go:

Delete duplicate e-mail messages

If you need to delete duplicate e-mail messages on an IMAP server, take a look at this useful IMAP de-duplicator script:

IMAP de-duplicator – IMAPdedup

As IMAPdedup is a command line interface tool (a python script), it’s particularly useful for:

  • automated deletion of duplicates (as it can be called from other scripts)
  • extraordinarily big mailboxes or if you have many subfolders (as there’s no intervention by the user required)
  • if you have console/shell access to the IMAP server (as you can then run the script on the server itself, speeding the de-duplication process further up)

I also found that it deals relatively well with failures (e.g. when a folder is read-only and hence messages can’t be deleted): It simply reports them on the screen and carries on.

Here’s a quick’n’dirty bash script to de-dup the inbox and all subfolders of the specified account:

#!/bin/sh
# Delete all duplicate messages in all folders of said account.
# Note that we connect through SSL (-x) to the default port.

SERVER="my.server.com"
USER="mylogin"
PASS="mypass"

for folder in `imapdedup.py -s $SERVER -x -u $USER -w $PASS -l`;
do
 imapdedup.py -s $SERVER -x -u $USER -w $PASS $folder
done

If you only have to de-duplicate messages in a small folder, you could also use the following de-duplication add-on for Mozilla Thunderbird:

Remove Duplicate Messages Add-on for Thunderbird

Note however that the ‘Remove Duplicate Messages’ add-on is intended for interactive use only, not for batch processing. I also noticed that it fails at cleaning big mail folders (e.g. containing 50’000 messages).