Wednesday, December 05, 2012


I'm a very happy Alfred and iTerm2 user on OSX.

I spent 30mins last night writing an Applescript Alfred extension to help me launch new tabs directly into iTerm and execute the ssh command directly. This means if you have ssh keys setup then it means a simple Alfred command can launch a new ssh session in a new tab in iTerm.

Applescript for the extension :

-- change this to ssh you want to run
set myCommand to  "ssh -i /Users/goul/keys/myspecialkey.pem"

-- this will send it to iTerm
tell application "iTerm"
set myterm to (current terminal)
-- talk to the new terminal
tell myterm
set mysession to (make new session at the end of sessions)
-- talk to the session
tell mysession
-- set some attributes
exec command myCommand
end tell
end tell
end tell

Monday, May 14, 2012

CURL Post a file in json format

I keep having to look this up, so putting it here ought to save some time. When attempting to post a block of JSON to a web service the Curl incantation is :

 curl -X POST  -H 'content-type: application/json'  -d @myjsonfile.txt http://some.url/param