Skip to content

Instantly share code, notes, and snippets.

View jrk's full-sized avatar

Jonathan Ragan-Kelley jrk

View GitHub Profile
@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 / 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>
-- 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
#include <CoreServices/CoreServices.h>
static void callback(ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[]) {
exit(0);
}
#!/bin/bash
#
# gitwait - watch file and git commit all changes as they happen
# via http://stackoverflow.com/questions/420143/making-git-auto-commit/965274#965274
#
while true; do
inotifywait -qq -e CLOSE_WRITE ~/.calendar/calendar
@jrk
jrk / httpd.conf
Created September 25, 2009 20:27 — forked from al3x/gist:187147
Alex Payne web productivity hack: redirect distracting domains to a local page which pops up Things.
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@jrk
jrk / .profile.functions
Created October 7, 2009 18:13
Tools for easily and automatically initializing/renewing Kerberos tickets with launchd and from command-line scripts on Snow Leopard.
# Initialize or renew Kerberos tickets. Assumes password for the requested principal is stored in the
# keychain, which is now automatically used by Snow Leopard kinit.
# This is useful to define globally in your shell profile, for easy use within other scripts and
# from the command-line.
function ker {
kinit -R 2> /dev/null
if [[ $? = '0' ]]; then
echo "renewed..."
klist
else
@jrk
jrk / gist:214476
Created October 20, 2009 18:16
Convert a p12 certificate export to raw OpenSSL pem format, including private key and certificate.
function p12topem {
# Convert a p12 certificate export to raw OpenSSL pem format, including
# private key and certificate.
# via http://www.gridsite.org/wiki/Convert_p12
openssl pkcs12 -in "$1" -nodes -out "$2"
# Make it readable only by you:
chmod 0400 "$2"
}
[github]
token = !security 2>&1 >/dev/null find-generic-password -gs "github.token" | ruby -e 'print $1 if STDIN.gets =~ /^password: \\\"(.*)\\\"$/'
@jrk
jrk / gist:226604
Created November 5, 2009 01:35
Minimalist painting in HTML5 canvas + Javascript.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function draw() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "black";
ctx.beginPath();