Skip to content

Instantly share code, notes, and snippets.


Allison Parrish aparrish

View GitHub Profile
cyberdelia /
Created Apr 3, 2010
Fabric deploy script with : south migrations, rollback and maintenance page.
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = ""
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
brendanberg /
Created Aug 24, 2011
Lisp list functions in CoffeeScript
cons = (h, t) -> (m) -> m(h, t)
car = (x) -> x((h, t) -> h)
cdr = (x) -> if x then x((h, t) -> t) else null
map = (ls, f) ->
cons (f car ls), if cdr ls then map cdr(ls), f else null
foldl = (ls, f, n) ->
f (car ls), if cdr ls then foldl (cdr ls), f, n else n
dariusk / canvas2Xscale.js
Created Aug 29, 2011
Artifact-free screen scaling for a canvas game, limited to 1X, 2X, 4X
View canvas2Xscale.js
// Adapted from Zachary Johnson's Commander Clone 0.2 screen scaling example
// Modified to strictly choose 1X or 2X or 4X scaling as appopriate, so we don't end up with screwed up scaling artifacts.
// NOTE: uses jQuery for the DOM load event
$(function () {
window.addEventListener('resize', fullScreenify, false);
function fullScreenify() {
malarkey / Contract Killer
Last active Mar 8, 2021
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

mcleonard /
Last active Feb 27, 2021
A vector class in pure python.
import math
class Vector(object):
def __init__(self, *args):
""" Create a vector, example: v = Vector(1,2) """
if len(args)==0: self.values = (0,0)
else: self.values = args
def norm(self):
""" Returns the norm (length, magnitude) of the vector """
sleepygarden /
Created Sep 27, 2013
trying to make sense of unicode_ebooks
# -*- coding: utf-8 -*-
import sys
import enchant
trying to make sense of unicode_ebooks
you need pyenchant:
brew install enchant
pip install pyenchant
kylemcdonald / _tsne.pdf
Last active Feb 28, 2021
Exploring antonyms with word2vec.
View _tsne.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
acdha /
Last active Feb 14, 2021
Python 3: serve the current directory as HTTP while setting CORS headers for XHR debugging
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
entron /
Last active Jan 20, 2020
Keras implementation of Kim's paper "Convolutional Neural Networks for Sentence Classification" with a very small embedding size. The test accuracy is 0.853.
'''This scripts implements Kim's paper "Convolutional Neural Networks for Sentence Classification"
with a very small embedding size (20) than the commonly used values (100 - 300) as it gives better
result with much less parameters.
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python
Get to 0.853 test accuracy after 5 epochs. 13s/epoch on Nvidia GTX980 GPU.
from __future__ import print_function

Interactive Machine Learning

Taught by Brad Knox at the MIT Media Lab in 2014. Course website. Lecture and visiting speaker notes.