Skip to content

Instantly share code, notes, and snippets.

View gleitz's full-sized avatar

Benjamin Gleitzman gleitz

View GitHub Profile
# CommitBot
# An interface for audibly broadcasting commit messages
# Tested on OSX
# Created by the friendly team at Hunch.com (sharing is caring!)
#
# Installation
# 1. replace USERNAME, PASSWORD, and HOSTNAME below
# 2. ...
# 3. profit!
;; load customization packages
(let ((base "~/.emacs.d/"))
(dolist (f '("my-general.el" "my-lint.el" "my-external.el" "my-local.el" "my-optional.el"))
(let ((name (concat base "/" f)))
(if (or (not (file-exists-p (byte-compile-dest-file (expand-file-name name))))
(file-newer-than-file-p (expand-file-name name) (byte-compile-dest-file (expand-file-name name)))
(equal (nth 4 (file-attributes (expand-file-name name))) (list 0 0)))
(load (expand-file-name name))
(load (byte-compile-dest-file (expand-file-name name)))))))
import urllib
import urllib2
from BeautifulSoup import BeautifulSoup as bs
def get_backgrounds():
base = 'http://thefoxisblack.com/category/the-desktop-wallpaper-project/page/%s/'
for x in range(0, 36):
get_images_from_page(base % (x + 1))
@gleitz
gleitz / gist:2494941
Created April 26, 2012 01:03
Shortcuts.py
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import render_to_string
from django.template import RequestContext
from django.utils import simplejson
JSON_CONTENT_TYPE = 'application/json'
JAVASCRIPT_CONTENT_TYPE = 'text/javascript'
def json_response(data):
@gleitz
gleitz / gist:2494965
Created April 26, 2012 01:08
NExtStep info
def nextstep_test(request):
students = [{'name': 'Facundo',
'pizza': 'cinnamon bananas',
'has_won_lottery': True},
{'name': 'Ryan',
'pizza': 'cabbage',
'secret_ability': 'elephant whispering'},
{'name': 'Luke',
'pizza': 'watermelon',
'secret_ability': 'freestyle sleeping'}
@gleitz
gleitz / TardyParty.py
Created June 24, 2012 17:41
Examines a private Google Groups RSS feed to determine who has and has not posted during the week
import difflib
import re
import time
import urllib2
import xml.etree.cElementTree as ET
from datetime import datetime, timedelta
GOOGLE_TIME = '%a, %d %b %Y %H:%M:%S UT'
XML_FETCHER_URL = 'http://localhost/GoogleGroups2Rss/index.php?group=oxidized-bismuth-blogger'
@gleitz
gleitz / gist:3777517
Created September 24, 2012 18:35
Blacklist
var swears = /(ahole|anus|ash0le|ash0les|asholes|AssMonkey|Assface|assh0le|assh0lez|asshole|assholes|assholz|asswipe|azzhole|bassterds|bastard|bastards|bastardz|basterds|basterdz|Biatch|bitch|bitches|BlowJob|boffing|butthole|buttwipe|c0ck|c0cks|c0k|CarpetMuncher|cawk|cawks|Clit|cnts|cntz|cock|cockhead|cock-head|cocks|CockSucker|cock-sucker|crap|cum|cunt|cunts|cuntz|dick|dild0|dild0s|dildo|dildos|dilld0|dilld0s|dominatricks|dominatrics|dominatrix|dyke|enema|fuck|fucker|fag|fag1t|faget|fagg1t|faggit|faggot|fagit|fags|fagz|faig|faigs|fart|flippingthebird|fuck|fucker|fuckin|fucking|fucks|FudgePacker|fuk|Fukah|Fuken|fuker|Fukin|Fukk|Fukkah|Fukken|Fukker|Fukkin|g00k|gay|gayboy|gaygirl|gays|gayz|God-damned|h00r|h0ar|h0re|hells|hoar|hoor|hoore|jackoff|jap|japs|jerk-off|jisim|jiss|jizm|jizz|knob|knobs|knobz|kunt|kunts|kuntz|Lesbian|Lezzian|Lipshits|Lipshitz|masochist|masokist|massterbait|masstrbait|masstrbate|masterbaiter|masterbate|masterbates|MothaFucker|MothaFuker|MothaFukkah|MothaFukker|MotherFucker|MotherFukah|Mo
@gleitz
gleitz / _.md
Created January 30, 2013 16:29
simple globe canvas
@gleitz
gleitz / MIDI_scales.js
Last active February 11, 2024 06:17
MIDI scale arrays in Javascript
var scales = {
'natural major': [0,2,4,5,7,9,11,12],
'ionian': [0,2,4,5,7,9,11,12],
'major': [0,2,4,5,7,9,11,12],
'chromatic': [0,1,2,3,4,5,6,7,8,9,10,11,12],
'spanish 8 tone': [0,1,3,4,5,6,8,10,12],
'flamenco': [0,1,3,4,5,7,8,10,12],
'symmetrical': [0,1,3,4,6,7,9,10,12],
'inverted diminished': [0,1,3,4,6,7,9,10,12],
'diminished': [0,2,3,5,6,8,9,11,12],
@gleitz
gleitz / reload.js
Last active May 7, 2019 21:48
Reloading modules from the repl in Node.js
// Reloading modules from the repl in Node.js
// Benjamin Gleitzman ([email protected])
//
// Inspired by Ben Barkay
// http://stackoverflow.com/a/14801711/305414
//
// Usage: `node reload.js`
// You can load the module as usual
// var mymodule = require('./mymodule')
// And the reload it when needed