Skip to content

Instantly share code, notes, and snippets.

View strongh's full-sized avatar

Homer Strong strongh

View GitHub Profile
nrs <- rep(seq(1,5,1),2)
sex <- c("M","M","M","M","M","F","F","F","F","F")
links <- NULL
#Loop to create 10 links, 5 for the male age grou 18-24, 5 for women agegroup 18-24. However,
#there are only 3 pages in the male age group with a table.
for (i in 1:length(nrs) ) {
links[i] = paste("http://www.ironman.com/triathlon/events/americas/ironman/texas/results.aspx?p=",nrs[i],"&race=texas&rd=20160514&sex=",sex[i],"&agegroup=18-24&loc=",sep="")
}
@strongh
strongh / schools.stan
Created July 19, 2016 22:07
toy example of MCMC using (py)stan and (py)spark
data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // s.e. of effect estimates
}
parameters {
real mu;
real<lower=0> tau;
real eta[J];
}
@strongh
strongh / install.R
Created March 3, 2016 17:25
Install packages for DSI advanced R workshop
install.packages(c("knitr", "tidyr", "magrittr", "dplyr", "shiny", "ggplot2"), dependencies=TRUE)
[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[20] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
[39] 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534
[58] 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534
[77] 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534
[96] 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534
[115] 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534 65534
[134] 65534 65534 65534 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
[153] 152 153 154 155 156 157 158 159 160 16
@strongh
strongh / ci_abstract.tex
Last active August 29, 2015 14:26
RMarkdown template for CI workshop abstract
\documentclass[11pt,twocolumn,twoside]{IEEEtran}
\usepackage{amsmath}
\usepackage[pdftex]{epsfig}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fancyhdr}
\include {graphicsx}
\usepackage[unicode=true]{hyperref}
\usepackage{setspace}
\usepackage{longtable}
************************+++++*********************************+*************************+++++++*******************************+++++*****************************
*****************************************************************************************+++++*******************************++++++*****************************
*************************************************************************++****************+++*******************************+++++******************************
+++*******************************++*************************************++++**********************************************+++++********************************
++*******************************************************++***********************************+***************************++++**********************************
++*******************************************************++++********************************+++*************************+++++*********************************+
++*******************************************************+
'' '+##&"
'@#########&' +#@'
+#% &#* '&#*
*#&' '&#####*
&#*
'+&########@&*'
*&##%'"&###&*' '+@###%''%##&"
+#@* "@#@* +##&' *##*
'@@''@#% '&#% "@&'
&#@#@" "&@@@+' '%@@@%" *#@&#%
#############
####################### ######@@@###
####@%++&@################### ######@@@@@&&&&%%&##
#######&%&@###################### ###@@@@@@@@@&&&%++%%%&&&@#
##################################### ###@@@@@&%%&&@@@@&&+'"%&&&%%&##
################################@&&###### ###@@@@@@@&+'"+&@@###@@&%&&&&&%&&&##
#################################%' '%###### ##@@@@@@@@@&+**%@############@&%%&&&@#
##############@%**&###############%' '%####### ##@@@@@@@@@@@@@@@##############@%+%&&&&&##
###############@&@###################@########## ##@&
;; http://www.johndcook.com/standard_deviation.html
(defn online-var
[x]
(loop [xs x
k 1
m (first x)
s 0]
(let [x (first xs)
mk (+ m (float (/ (- x m) k)))]
(if (empty? (rest xs))
@strongh
strongh / findclass.sh
Created January 3, 2014 03:02
find classes in classpath. assumes a leiningen project. useful for finding bundled deps. usage is e.g. ``` $ ./findclass.sh MyTerribleClass ```
#!/bin/sh
TMPCP=/tmp/badcp.txt
lein cp | tr ':' '\n' > $TMPCP
while read line; do
find "$line" -name "*.jar" -exec sh -c 'jar -tf {}| grep -H --label {} '$1'' \;
done < "$TMPCP"