Skip to content

Instantly share code, notes, and snippets.

View andyreagan's full-sized avatar

Andy Reagan andyreagan

View GitHub Profile
@andyreagan
andyreagan / speedy.py
Created March 30, 2015 01:51
loading in LIWC
# this is the loop that loads the LIWC dataset into a dictionary for me
# note, I'm loading the function words into the set if they're not marked
# as emotion
for line in f:
l = line.rstrip().split("\t")
word = l[0]
if '125' in l:
if '126' in l:
score = 1
LIWC[word] = (score,i)
@andyreagan
andyreagan / gist:b4bc29d9ce4fd3e6c5fe
Created April 16, 2015 15:50
dendrogram hacking
test = linkage(normed_dist_winner_matters_array,method = 'ward')
d = dendrogram(test);
k= 19
fig = figure()
clustered_matrix = []
nodes_order = list(reversed(d['leaves']))
nodes_order = list(d['leaves'])
for leaf1 in nodes_order:
row = []
@andyreagan
andyreagan / gist:f6e9dfdf591d890194d6
Created April 17, 2015 13:41
standard deviation vectors from TSV files
langs = ["chinese","portuguese","english","indonesian","russian","french","korean","spanish","arabic","german"]
for lang in langs:
f = open("labMT2"+lang+".txt","r")
f.readline()
stdDevs = [line.rstrip().split("\t")[3] for line in f]
f.close()
print(stdDevs[:10])
f = open("vectors/labMTscoresStd-"+lang+".csv","w")
f.write("\n".join(stdDevs))
f.close()
@andyreagan
andyreagan / gist:74755ff9160fc0be64c5
Created April 27, 2015 18:38
quick input script
tweets = ['a','b','c']
scores = ['c' for i in range(len(tweets))]
if __name__ == '__main__':
i = 0
while i < len(tweets):
scores[i] = input(tweets[i]+":\n")
if scores[i] == 'b':
i -= 1
else:
@andyreagan
andyreagan / list.py
Last active August 29, 2015 14:20
CSYS302 topics
flash_cards = ['self-similarity',
'deterministic vs. stochastic',
'context-free vs. context-sensitive',
'parameterless vs. parameterized',
'Kolmogorov complexity',
'Shannon''s entropy',
'derivatives, eigenvalues, Lyapunov exponents',
'analytical vs. numerical solution',
'Taylor series expansion',
'round-off error and truncation error',
function zooit() {
## ssh areagan@zoo.uvm.edu mkdir -p public_html/files/$(date +%Y/%m)
rsync -avzr $1 areagan@zoo.uvm.edu:/users/a/r/areagan/public_html/files/$(date +%Y/%m)
echo "andyreagan.com/files/$(date +%Y/%m)/$1" | tr -d '\n' | pbcopy
echo "link is in the clipboard"
}
@andyreagan
andyreagan / custom-map-code
Created May 28, 2015 19:33
jquery ajax request
<div id="mapcontent"></div>
<script type="text/javascript">$('#mapcontent').load('http://tools.newbreedmarketing.com/mapmaker/api/allearth/');</script>
<script src="http://cdn2.hubspot.net/hubfs/415283/scripts/maps-on-load-minimal-hardcoded.js"></script>
@andyreagan
andyreagan / plot.py
Created June 4, 2015 16:03
matplotlib basic
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,10))
ax = fig.add_axes([0.2,0.2,0.7,0.7])
ax.plot()
# ax.set_ylim()
# ax.set_xlim()
# ax.legend()
ax.set_xlabel('',fontsize=15)
ax.set_ylabel('',fontsize=15)
@andyreagan
andyreagan / plot.jl
Created June 4, 2015 16:07
julia PyPlot example
using PyPlot
import PyPlot.plt
using PyCall
@pyimport matplotlib as mpl
patches = mpl.pymember("patches")
fig = plt.figure(figsize=(15,10))
ax = fig[:add_axes]([0.2,0.2,0.7,0.7])
@andyreagan
andyreagan / .aspell.en.pws
Created July 17, 2015 14:09
what happens when you aspell a DA paper
Runge
EnKF
Kutta
incompressible
blockMesh
integrations
McMaster
RMS
ODE's
Boussinesq