Skip to content

Instantly share code, notes, and snippets.

View GeorgeErickson's full-sized avatar

George Erickson GeorgeErickson

View GitHub Profile
javascript:(function()%7Bfunction%20makeParam(key,value)%7Bkey%3Descape(key)%3Bvalue%3Descape(value)%3Bvar%20clean_url%3Ddocument.location.href.split(%22%3F%22)%5B0%5D%3Bdocument.location.search%3D%27%3F%27%2Bkey%2B%27%3D%27%2Bvalue%3B%7Dvar%20username%3Dprompt(%22username%20to%20impersonate%22)%3BmakeParam(%27__impersonate%27,username)%3B%7D)()%3B
@GeorgeErickson
GeorgeErickson / get_7012
Created December 16, 2012 00:27
Shitty script to download 7.012 lectures at 2x speed
#!/usr/bin/python
# shitty script to download bio lectures so I can watch them at 2x speed.
# Requires rtmpdump (http://rtmpdump.mplayerhq.hu/). Can install via homebrew
import subprocess
LECTURES = {
'dec': [3,5,7,10,12],
'nov': [2,5,7,9,14,16,19,21,26,30],
@GeorgeErickson
GeorgeErickson / ssh_icloud.sh
Created November 19, 2012 20:37
iCloud ssh config generator
#!/usr/bin/env bash
#
#Shitty script to create a ssh config entry for icloud
HOSTNAME=$(echo show Setup:/Network/BackToMyMac | scutil | egrep "[0-9]{1,}.members.btmm.icloud.com" -o)
COMPUTER_NAME=$(scutil --get ComputerName)
RED=$(tput setaf 9)
RESET=$(tput sgr0)
@GeorgeErickson
GeorgeErickson / debug_url.py
Created August 28, 2012 14:52
Serving static files in django for development
from django.conf import settings
from django.conf.urls.defaults import patterns, url
import os
urlpatterns = patterns('',)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.getcwd()})
)
@GeorgeErickson
GeorgeErickson / gist:2869852
Created June 4, 2012 17:55
script loading
class app.view.ProfileListView extends Backbone.View
events:
"click li.js_profile": "select_click_person"
"click li.js_next_page": "next_page"
"click li.js_prev_page": "prev_page"
"click .close": "filter_x_click"
"click .order_buttons button": "order_by"
initialize: ->
@loading_overlay_el = $('#js_overlay_'+@options.name)
insert('This is a line added by the user. \n This is another line added by the user.', A, B)
insert('This is yet another line added by the user.' B, null)
@GeorgeErickson
GeorgeErickson / decorators.py
Created November 10, 2011 15:56
useful python snippets
import time
def log_timing(func):
def wrapper(*arg):
t1 = time.time()
res = func(*arg)
t2 = time.time()
print "%s took %d ms" % (func.func_name, (t2-t1)*1000.0)
return res
return wrapper
@GeorgeErickson
GeorgeErickson / sencha_events.js
Created November 3, 2011 22:00
Log all events in SenchaTouch 1.1
Ext.util.Observable.prototype.fireEvent =
Ext.createInterceptor(Ext.util.Observable.prototype.fireEvent, function() {
console.log(this.name);
console.log(arguments);
return true;
});
@GeorgeErickson
GeorgeErickson / gunicorn
Created September 28, 2011 22:28 — forked from suda/gunicorn
Gunicorn init.d script (debian/ubuntu)
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn server
# Description: starts gunicorn using start-stop-daemon
@GeorgeErickson
GeorgeErickson / normal.css
Created September 24, 2011 20:29
personal css normalize
/* HTML5 ✰ Boilerplate
* ==|== normalize ==========================================================
*/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
audio:not([controls]) { display: none; }
[hidden] { display: none; }
html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }