Skip to content

Instantly share code, notes, and snippets.

View stringertheory's full-sized avatar

Mike Stringer stringertheory

View GitHub Profile
@stringertheory
stringertheory / threes_simulation.py
Last active June 26, 2023 14:00
A quicky python script to simulate random pushes in the Threes game at threesjs.com, as described in http://datascopeanalytics.com/what-we-think/2014/03/13/are-you-really-any-good-at-threes
# standard library
import sys
import random
import time
# need to pip install selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
@stringertheory
stringertheory / threes_plot.py
Created March 14, 2014 15:14
A quicky script to make a vincent stacked area plot with the results of the threes simulation [this blog post](http://datascopeanalytics.com/what-we-think/2014/03/14/are-you-really-any-good-at-threes).
# standard library
import sys
import random
# 3rd party
import numpy as np
import vincent
N_SAMPLES = 10000
@stringertheory
stringertheory / ks.R
Created April 7, 2014 21:27
Bootstrap KS test
# read in data
onlydown <- read.table('scores-onlydown.dat')[,1]
random <- read.table('scores-random.dat')[,1]
# use bootstrap version of KS test
library(Matching)
ks.boot(onlydown, random)
@stringertheory
stringertheory / keybase.md
Created August 14, 2014 19:54
proving identify for keybase.io

Keybase proof

I hereby claim:

  • I am stringertheory on github.
  • I am mstringer (https://keybase.io/mstringer) on keybase.
  • I have a public key whose fingerprint is 866E D9E9 FDEF 47FB 77AB D1AC 7B91 DA3D 7B5F 643A

To claim this, I am signing this object:

@stringertheory
stringertheory / .auto_virtualenv
Last active August 29, 2015 14:06 — forked from clneagu/.bashrc
put this in .bashrc to change to environments created with virtualenvwrapper automatically
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from--
# http://justinlilly.com/python/virtualenv_wrapper_helper.html
# which is linked from--
# http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory
check_virtualenv() {
if [ -e .venv ]; then
env=`cat .venv`
if [ "$env" != "${VIRTUAL_ENV##*/}" ]; then
echo "Found .venv in directory. Calling: workon ${env}"
workon $env
@stringertheory
stringertheory / stop_haters.py
Created October 14, 2014 20:32
so true, dawg
#!/usr/bin/env python
raise Exception('haters gonna hate')
@stringertheory
stringertheory / combos.py
Last active August 29, 2015 14:16
Script to test a few small numbers for a combinatorics problem
"""Script to test a few small versions of combinatorics problem.
"""
from sys import stderr
from collections import Counter
from itertools import permutations
from math import factorial
from time import time
def answer(n, g):
@stringertheory
stringertheory / proselint_test.py
Created March 8, 2016 15:36
playing with proselint in python
import sys
import codecs
from proselint.command_line import lint
import termcolor
WINDOW = 40
FORE = 'white'
BACK = 'on_blue'
@stringertheory
stringertheory / human_centered_design.py
Created September 12, 2016 18:14
pseudocode for human-centered design
"""Template for the design process."""
def empathize(people):
raise NotImplementedError
def define(people, needs):
raise NotImplementedError
@stringertheory
stringertheory / goog2md.py
Last active September 17, 2016 05:43
hack to get markdown, dammit
"""Convert a google doc to markdown with all of the cruft removed.
"""
import hashlib
import imghdr
import shutil
import subprocess
import sys
import urllib
import urlparse