Hacks

This page is to document some of the little tricks, hacks and scripts I've come up with. Most of this is inspired by, and heavily borrows from lot's of sources out there, so it's only fair to share it.

There are also some of my older projects on my blog, I might eventually move them all here.

A quite big hack is my integration of BibDesk, DokuWiki and Skim to create an “academic workflow” / “personal knowledge management system” I call researchr.

Mac integration

I've recently discovered AppleScript through Ruby, and have played with making little scripts that use a keyboard shortcut, Ruby and AppleScript together.

All these scripts can generally be found in my github repository folders2web, together with unfinished scripts. Most depend on a bit of tinkering to get them to work on your system.

Prerequisites

All of these tools are written in Ruby, simply because I am most comfortable with it. They can be found in this github collection (together with lot's of other half-baked scripts).

Appscript

rb-appscript let's me talk to other Mac applications through AppleScript, and it has really changed how I do things – I typically only need one or two lines of AppleScript in a script, and being able to write everything else in Ruby. The one disadvantage is that you have to convert from the AppleScript syntax to Appscript, which sometimes isn't obvious, and you end up with lines like these:

dt = app('Google Chrome')
url = dt.windows[1].get.tabs[dt.windows[1].get.active_tab_index.get].get.URL.get

Which gives you the URL of the currently open tab in Chrome

I have tried to collect all my Appscript snippets.

Growl

Growl is a tool that shows quick notifications. It's a great way for a command line tool to display information in a non-intrusive way. (I also use this for a kind of “menu”). If you have brew, you can install the command line interface with

brew install growlnotify

Keyboard Maestro

I need to be able to launch my scripts using keyboard shortcuts. (I could also turn them into Services with ThisService, and assign them keyboard shortcuts using the Control Panel). I use Keyboard Maestro, which costs a little bit of money, but has been very useful so far. I really like the fact that I can isolate shortcuts to specific applications, so that for example Cmd+E does one thing in Skim, and another thing in Chrome.

See more about my researchr keyboard shortcuts.


What you’re looking for is probably ssh. It’s installed by default and opens an encrypted connection to a shell on a remote server. You probably know it. What you don’t know perhaps is that you can pipe stuff there:

cat File.markdown | ssh user@host markdown | less

Outsourcing computations to larger machines has been ingrained in the UNIX philosophy for quite a while now :) Bash as a Service | Guillermo Rauch's Devthought