Skip to content

Instantly share code, notes, and snippets.

View jrk's full-sized avatar

Jonathan Ragan-Kelley jrk

View GitHub Profile
-- Sets the style of the current Terminal.app terminal
-- via http://blog.omnigroup.com/2007/11/03/terminal-scripting-in-105/
-- v2, Updated for 10.6 (Snow Leopard)
on run {MyTTY, MySettingsName}
set TTYTab to my find_tab_for_tty(MyTTY)
if TTYTab is missing value then
return -- Bail if we got confused rather than making it worse
end if
@jrk
jrk / gist:156901
Created July 28, 2009 03:19
Recursive wget with link rewriting to point to local/relative paths
# Recursive wget with link rewriting to point to local/relative paths
wget -rk <url>
@jrk
jrk / scpi.pl
Created July 22, 2009 08:03
An improved replacement for scp, with resume and advanced compression support. By Andrei Alexandrescu.
#!/usr/bin/env perl
# Via: http://erdani.org/code/scpi.html
################################################################################
## Copyright (c) 2006 by Andrei Alexandrescu
## Permission to use, copy, modify, distribute and sell this software for any
## purpose is hereby granted without fee, provided that the above copyright
## notice appear in all copies and that both that copyright notice and this
## permission notice appear in supporting documentation.
## The author makes no representations about the
@jrk
jrk / draggable.html
Created June 13, 2009 22:48
A bookmarklet to redirect your current browser page through MIT's Proxy, useful for browsing ACM Portal, etc. Drag it to your bookmarks toolbar, and click it on any page to view that page through the MIT proxy.
<a href="javascript:location.href='https://libproxy.mit.edu/cgi-bin/ezpauth?url='+location.href">MIT proxy</a>
@jrk
jrk / front_finder_window_shell_utilities.sh
Created June 3, 2009 01:25
Shell aliases for quickly acting on the frontmost Finder window.
# Define front_finder_window_path to return the POSIX path string to the frontmost Finder window
alias front_finder_window_path="osascript -e 'tell application \"Finder\" to get URL of target of front Finder window' | sed 's/file:\\/\\/localhost//g'"
# cd to the front Finder window path
alias cdf='cd `front_finder_window_path`'
# pushd to the front Finder window path
alias pushdf='pushd `front_finder_window_path`'
alias pushf=pushdf
alias pdf=pushdf
#!/bin/bash
# The CommandLineFu.com is a great web site to exchange knowledge about shell usage and command line
# magics. But if that is about command line will be to have a command line interface to access this
# knowledge.
# The clfu-seach is the usable proof of concept to think seriously on this idea.
# via http://www.colivre.coop.br/Aurium/CLFUSearch
# This is a Free (as in freedom) Software licenced under the last GPL.
function gr {
## If the current working directory is inside of
## a git repository, this function will change
## it to the git root (ie, the directory that
## contains the .git/ directory), and then print
## the new directory.
git branch > /dev/null 2>&1 || return 1
cd "$(git rev-parse --show-cdup)".
pwd
@jrk
jrk / newpost.rb
Created May 5, 2009 06:48 — forked from al3x/newpost.rb
Creates a new Jekyll post, opens it in TextMate, and adds to the git index
#!/usr/bin/env ruby
require Dir
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
blog_root = "/Users/jrk/proj/blog"
@jrk
jrk / camper.rb
Created May 2, 2009 18:53
Simple Campfire-Jabber relay daemon in Ruby
# The MIT License
#
# Copyright (c) 2008 Jared Kuolt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jrk
jrk / pdf_slide_share.sh
Created April 1, 2009 19:34
Quick and dirty PDF slide sharing: converts a PDF to PNGs and spits out HTML+JS to browse them.
#!/bin/sh
# Quick and Dirty PDF Sharing
# Converts a PDF to PNGs (using Image Magick)
# and spits out HTML+JS to browse them.
# By John Resig (ejohn.org)
# Distributed under the MIT License
# Home: http://ejohn.org/projects/easy-pdf-sharing/
# Input: