Skip to content

Instantly share code, notes, and snippets.

View zthomae's full-sized avatar

Zach Thomae zthomae

  • Goldman Sachs
  • Chicago, IL
View GitHub Profile
@zthomae
zthomae / maddotcomlinker.user.js
Created April 27, 2012 03:27
Userscript to link headlines on madison.com blogs
// ==UserScript==
// @name "On Campus" linker
// @namespace http://twitter.com/zthomae
// @description Adds links to madison.com blog posts
// @include http://host.madison.com/wsj/local/education/on_campus/
// @include
// @include http://host.madison.com/wsj/local/education/extra-credit/
// @include http://host.madison.com/lifestyles/faith-and-values/religion/
// @include http://host.madison.com/wsj/business/technology/biotech/
@zthomae
zthomae / klouchebag_min.js
Created May 1, 2012 01:23
A stripped-down version of the Klouchebag script, putting scores in localStorage
function fetchTweets(user) {
$.ajax({
type : 'GET',
dataType : 'jsonp',
url : 'http://api.twitter.com/1/statuses/user_timeline.json',
data : { screen_name: user,
count: 200,
include_rts: 1,
@zthomae
zthomae / bookmarklets.html
Created May 30, 2012 00:33
My bookmarklets
<html>
<head>
</head>
<body>
<a href="javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function()%7Bif(!b&&(!(d=this.readyState)%7C%7Cd==%22loaded%22%7C%7Cd==%22complete%22))%7Bh((f=e.jQuery).noConflict(1),b=1);f(c).remove()%7D%7D;a.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,%221.7.2%22,function($,L)%7Bdiv=document.getElementById(%22overlay%22).parentNode;div.removeChild(overlay);div.removeChild(gatewayCreative);document.getElementsByTagName(%22html%22)%5B0%5D.style.overflow=%22scroll%22;%7D);">Kill NYTimes Paywall</a>
<a href="javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onrea
@zthomae
zthomae / GenTester.py
Created August 19, 2012 01:21
Gen Tester - See how many random numbers need to be generated to have created every number in range n
#!/usr/bin/python2.7
import pickle, os, sys
from sets import Set
from random import randrange
from shutil import make_archive, rmtree
from time import time
def SetGenCount(input_length):
"""
@zthomae
zthomae / snippets.py
Created August 19, 2012 01:23
Python snippets
## SPLIT AROUND SPACE ##
import string
# All forms of whitespace except the space
whitespace = string.whitespace[:-1]
# Split a string around its whitespace, with words and whitespace being entries in a list
def split_around_space(string):
new = []
@zthomae
zthomae / tumbltweet.rb
Created August 19, 2012 01:25
Get recent tweets and put them on tumblr blog
require "twitter"
require "tumblr4r"
require "date"
# Construct Twitter instance
t = Twitter.new
# Define screen_name.
screen_name = "zthomae"
@zthomae
zthomae / follower_map.rb
Created August 19, 2012 01:26
Get a "map" of your twitter followers for useful RTs - See which of your followers are following people that you also follow.
require "twitter"
# Set sample size (pick this percentage of your followers)
SAMPLE_SIZE = 0.25
# Construct Twitter instance
t = Twitter.new
# Add screenname to params
screen_name = "zthomae"
@zthomae
zthomae / app.js
Created August 30, 2012 17:09
FRED toolkit in node.js - The beginning
var express = require('express');
var app = express();
require('./core.js')(app, {'namespace': 'api', 'api_key': 'abcdefghijklmnopqrstuvwxyz123456' });
app.listen(3000);
@zthomae
zthomae / .screenrc
Created October 13, 2012 19:01
Shell scripts for remote screen on ec2
hardstatus on
hardstatus alwayslastline
startup_message off
termcapinfo xterm ti@:te@
hardstatus string "%{= kG}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
screen -t shell 0
screen -t irc 1
screen -t code 2
screen -t etc 3
@zthomae
zthomae / make-feed.py
Created October 24, 2012 16:35
A script for turning an ugly class webpage into a podcast rss feed
from pyquery import PyQuery as pq
import urllib2
from datetime import datetime
import PyRSS2Gen as rss
d = pq(url='http://www.ssc.wisc.edu/~wright/Sociology-125-podcasts-2012.htm')
URL_ROOT = 'http://www.ssc.wisc.edu/~wright/'
items = []