Skip to content

Instantly share code, notes, and snippets.

View paul-english's full-sized avatar

Paul English paul-english

View GitHub Profile
@paul-english
paul-english / .tmux.conf
Created November 16, 2015 22:30
tmux config
unbind C-b
set -g prefix C-Space
set -g mode-keys vi
# Set XTerm key bindings
setw -g xterm-keys on
# Set XTerm overrides
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@"
@paul-english
paul-english / pairwise-levenshtein.py
Last active October 28, 2015 18:46
Pairwise string distances
import Levenshtein as levenshtein
import numpy as np
def dist(coord):
i, j = coord
return levenshtein.distance(strings_list[i], strings_list[j])
coords = np.triu_indices(len(strings_list), 1)
zipped_coords = zip(*coords)
@paul-english
paul-english / clone
Last active August 29, 2015 14:21
Manage git repo organization a bit more like go does.
#!/bin/bash
# Clones a repo into an organized directory structure at your $CODEPATH.
# This organization is similar to how "go get" will organize your code into
# $GOPATH/<site>/../../<repo>
set -e
trap "echo ERRORS DETECTED" err
@paul-english
paul-english / migrate_repos.sh
Created May 14, 2015 15:31
Migrate GHE repos to https (based on eric's gist)
#!/bin/bash
# Finds and converts git repositories in or under the working directory to
# reference GitHub Enterprise (code.redbrainlabs.com).
set -e
trap "echo ERRORS DETECTED" ERR
IFS="`printf '\n\t'`"
@paul-english
paul-english / sims.jl
Last active August 29, 2015 14:17
some-julia
using Images
using Match
function sample_S(n, iters=1000)
S = zeros(Int32, n)
for step = 1:iters
i = rand(1:n)
@match (i,S[i]) begin
(1,0),if S[i+1]==0 end => S[i]=1
(1,0),if S[i+1]==1 end => continue
@paul-english
paul-english / econometrics-model.r
Last active August 29, 2015 14:14
econometrics thing
install.packages('car')
df <- read.csv("~/data.csv")
plot(df)
# Model 1
model1.y <- df$inf
model1.X <- df$unem
import xml.etree.ElementTree as ET
@shared_task
def test_et():
print('test_et')
fpath = '<xml-file>'
t = ET.parse(fpath)
print('--- t', t)
@paul-english
paul-english / LogAnalysis.hs
Last active August 29, 2015 14:06
haskell-hw03.hs
-- Exercise 1
invalidInt :: MaybeInt -> Bool
invalidInt (ValidInt _) = False
invalidInt InvalidInt = True
maybeIntValue :: MaybeInt -> Int
maybeIntValue (ValidInt val) = val
maybeIntValue InvalidInt = 0
@paul-english
paul-english / haskell-hw02.hs
Created September 16, 2014 05:36
haskell-hw02.hs
-- Exercise 1
formableBy :: String -> Hand -> Bool
formableBy [] _ = True
formableBy [letter] hand = letter `elem` hand
formableBy (letter:letters) hand
| letter `elem` hand = formableBy letters (delete letter hand)
| otherwise = False
@paul-english
paul-english / haskell-hw01.hs
Last active August 29, 2015 14:06
haskell-hw01.hs
-- Exercise 1
lastDigit :: Integer -> Integer
lastDigit x = mod x 10
dropLastDigit :: Integer -> Integer
dropLastDigit x = div x 10
-- Exercise 2