Skip to content

Instantly share code, notes, and snippets.

@tomcritchlow
tomcritchlow / 7books.py
Created November 9, 2010 23:23
The main code for 7books (www.7bks.com)
import cgi
import os
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.api import memcache
from google.appengine.api import urlfetch
@tekacs
tekacs / show
Created April 20, 2011 17:55
This does something essentially equivalent to showoff.io if you have a publicly facing server...
# Usage: show <local-port> <subdomain>
function show() {
DOMAIN=".tekacs.com"
REMOTE="$2$DOMAIN"
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}
private static long REPROVISION_RESET = 6 * 7 * 24 * 60 * 60 * 1000;
private static long LICENSE_EXPIRATION = 3 * 7 * 24 * 60 * 60 * 1000;
@atuttle
atuttle / gist:959038
Created May 6, 2011 14:23
A shell script for getting stats about your git repo (lines committed in HEAD by comitter)
#!/bin/sh
# this script requires GNU-SED for the "-r" option.
# Get it via: sudo brew install gnu-sed
# command found at: http://stackoverflow.com/questions/4589731/git-blame-statistics/4590487#4590487
echo "Lines in HEAD by Committer:"
git ls-tree -r HEAD|sed -re 's/^.{53}//'|while read filename; do file "$filename"; done|grep -E ': .*text'|sed -r -e 's/: .*//'|while read filename; do git blame "$filename"; done|sed -r -e 's/.*\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/' -e 's/ +$//'|sort|uniq -c
@kirpit
kirpit / release_info.py
Created August 28, 2011 13:07
Returns first level namespace (package import name) of a setuptools distribution
#! /usr/bin/env python2.7
'''
http://stackoverflow.com/questions/7184375/how-to-find-import-name-of-any-package-in-python
'''
import distutils.core
import sys
import os
@pcardune
pcardune / .gitignore
Created September 5, 2011 04:55
Facebook command-line client helper
.fb_access_token
.fbconsole.py
#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
@panicsteve
panicsteve / gist:1641705
Created January 19, 2012 18:26
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@bostwick
bostwick / FacebookWordCloud.py
Created February 11, 2012 04:00
Facebook News Feed Word Cloud
#!/usr/bin/env python
import sys
import urllib2
import json
from collections import defaultdict
from nltk import word_tokenize
IGNORED_WORDS = ["!", ".", ",", "(", ")", "'s", ":", "?", "...", "$",
@lg
lg / gist:1851003
Created February 17, 2012 05:44
Monitor Converse's website for available shoe sizes on a given sku and send an email when changed
curl --silent 'http://www.converse.com/handler/Products/ProductDetailHandler.ashx?sku=129331C' | xpath '/ProductDetailHandler/Product/ShoeSizes/ShoeSize/Size[@type="US Mens"]/text()' 2>&1 | sed 's/-- NODE --//'| sed 's/Found.*//' | egrep '.' > /tmp/lastsizesLATEST ; if ! diff /tmp/lastsizesLATEST /tmp/lastsizes > /dev/null; then $( cat /tmp/lastsizesLATEST | mail -s 'shoe sizes changed' 'youremail@gmail.com' ); else echo 'not changed'; fi; rm -f /tmp/lastsizes; cp /tmp/lastsizesLATEST /tmp/lastsizes