“Mark Old As Read” for NetNewsWire

Posted by Tom on November 13th, 2008 — in AppleScript, Hacks, Mac

I recently heard about an RSS reader (can’t remember which) that had a feature to mark all messages older than a certain threshold as “read”. I thought this was an incredibly useful feature, since I often forget to check my feeds for days at a time, and end up with hundreds of unread items that [...]

Open new Terminal tab in current directory (updated!)

Posted by Tom on October 23rd, 2008 — in Command line, Hacks, Mac

This is an updated shell script / AppleScript for opening a new tab in your current directory (or the specified directory). The last version was for the pre-tabbed version of Terminal.

#!/bin/sh -

if [ $# -ne 1 ]; then     PATHDIR=`pwd` else     PATHDIR=$1 fi

/usr/bin/osascript <<-EOF activate application "Terminal" tell application "System Events"     keystroke "t" using {command down} end tell tell application "Terminal"     repeat with win in windows         try             if [...]

Command line interpreter and REPL for JSCocoa

Posted by Tom on October 10th, 2008 — in C, Command line, Hacks, JavaScript, Mac, Objective-C

A few months ago I started working on a JavaScript to Objective-C bridge. We had already implemented Objective-C in JavaScript, so I figured “why not?”

Well, I never got very far, but thankfully Patrick Geiller apparently had the same idea and actually executed it: He announced JSCocoa today. It looks like it’s a solid bridge, about [...]

Useful Mac OS X-specific command line utilities

Posted by Tom on July 25th, 2008 — in Command line, Mac

One of the greatest strengths of Mac OS X, for developers in particular, is that it has a very elegant and consistent graphical user interface as well as an excellent command line interface. I’m not going to cover the basics like “ls” and “cd”, but rather point out some Mac OS X specific tools that [...]

Mac OS X, Web Sharing / Apache, and Symlinks

Posted by Tom on June 25th, 2008 — in Mac, Web

Mac OS X comes with an Apache installation which is very handy, but by default it’s configured not to follow symlinks. A lot of times I have projects in other directories which I want to share via the web server, but end up getting errors such as the following:

Forbidden

You don’t have permission to access /~tlrobinson/Editor/ [...]

Overriding library functions in Mac OS X, the easy way: DYLD_INSERT_LIBRARIES

Posted by Tom on December 21st, 2007 — in GCC, Internet, Mac, Music, Programming

Back at MacHack 2003 Jonathan Rentzsch talked about how to override functions and inject code in Mac OS X using several neat tricks. He also released a framework called mach_star which has two components: machoverride and machinject. These are great, but overkill for some simple cases.

A much easier way of doing library function overrides is [...]

Presenting GCCalc: a horrible abuse of GCC

Posted by Tom on December 14th, 2007 — in C, Command line, GCC, Hacks, Linux, Mac, Programming

Following an interesting discussion on Reddit about first class functions in C, I was inspired to see what I could do with this new-found knowledge. The result is what I affectionately call “GCCalc”, for reasons that will become clear below.

GCCalc is a simple command line calculator, much like the common bc calculator on many Unix [...]

Open new Terminal window in current (or other specified) directory

Posted by Tom on September 7th, 2007 — in Command line, Mac

A lot of times I find myself wanting to open another (Mac OS X) Terminal window in the same directory as my current one. This little shell script, which executes a little AppleScript, makes that trivial:

#!/bin/sh

if [ $# -ne 1 ]; then     PATHDIR=`pwd` else     PATHDIR=$1 fi

osascript -e "tell application \"Terminal\"" -e "do script \"cd $PATHDIR\"" -e "end tell"

Save this [...]

Mystery solved: iTeaHAL

Posted by Tom on August 17th, 2007 — in Mac

I’ve been getting strange messages in my system and console logs, or when executing certain applications from the command line. Notably iMovie and Skype:

iTeaHAL: Entering… iTeaHAL: Not iTunes, exiting.

And when executing iTunes, I get this:

iTeaHAL: Entering… iTeaHAL: Early startup… itea_hijack_init: result: 0 iTeaHAL: Early startup done. new_AudioDeviceAddIOProc:0×2281b68 link added iTeaHAL: Late startup… {length = 6, capacity = 6, bytes = 0×000a95c4a60e} itea_fx_init: result: 0 itea_menu_init: [...]

multiwhich

Posted by Tom on August 15th, 2007 — in Command line, Linux, Mac

The “which” Unix command lists the location of the first matching executable in your PATH. The GNU version of “which” has several extra features including the ability to display all matching executables in your PATH, not just the first. This is useful for finding duplicates, etc. Unfortunately, whatever version of “which” is included in Mac [...]


Home Blog 280 North SCEC-VDO Wator World X TOOBS Wikipedia Fun Kegbot EasyButton JavaScript x0xb0x XBMC iPhone