Skip to content

Instantly share code, notes, and snippets.

View saralilyb's full-sized avatar
🤷‍♀️

Sara Burke saralilyb

🤷‍♀️
View GitHub Profile
@saralilyb
saralilyb / say.sh
Created January 7, 2016 04:07 — forked from dkarter/say.sh
OS X `Say` voices try out
echo 'Agnes'
say -v 'Agnes' "Isn't it nice to have a computer that will talk to you?"
echo 'Albert'
say -v 'Albert' "I have a frog in my throat. No, I mean a real frog!"
echo 'Alex'
say -v 'Alex' "Most people recognize me by my voice."
echo 'Alice'
say -v 'Alice' "Salve, mi chiamo Alice e sono una voce italiana."
echo 'Alva'
say -v 'Alva' "Hej, jag heter Alva. Jag är en svensk röst."
@saralilyb
saralilyb / arrminmax.coffee
Last active February 2, 2025 18:37
The following are done up to dig into nested arrays and find the max or min values in them. In CoffeeScript. From http://stackoverflow.com/questions/10564441/how-to-find-the-max-min-of-a-nested-array-in-javascript.
arrmax = (arrs) ->
toplevel = []
i = 0
l = arrs.length
while i < l
toplevel.push Math.max.apply(window, arrs[i])
i++
Math.max.apply window, toplevel
arrmin = (arrs) ->
toplevel = []
@saralilyb
saralilyb / meshgrid.coffee
Last active February 29, 2016 18:53
Replicates a baby version of MATLAB's meshgrid in CoffeeScript using the NumericJS library: http://www.numericjs.com.
meshgrid = (value) ->
m = []
value_length = value.length
i = 0
while i < value_length
m.push(value)
i += 1
[m, numeric.transpose(m)]
@saralilyb
saralilyb / rescale_core.coffee
Last active February 29, 2016 18:57
Rescales an array so all values lie between a and b, where m is the unscaled array's (potential) minimum value and M is the max. Requires the NumericJS library. Based on Gabriel Peyre's MATLAB code: http://www.mathworks.com/matlabcentral/fileexchange/5103-toolbox-diffc/content/toolbox_diffc/toolbox/rescale.m
rescale_core = (y, a, b, m, M) ->
y if M - m < .0000001
numeric.add(numeric.mul(b - a, numeric.div(numeric.sub(y, m), M - m)), a)
@saralilyb
saralilyb / minmax-numeric.js
Created February 29, 2016 22:18
Array Min and Max functions using NumericJS through mapreduce
arrmax = numeric.mapreduce('if(xi > accum) accum=xi;','-Infinity');
arrmin = numeric.mapreduce('if(xi < accum) accum=xi;','Infinity');
@saralilyb
saralilyb / .vimrc-after
Created March 13, 2016 17:54
Make vim feel like this century with hard tabs as 2 spaces, soft wrap at 80 columns, and hanging intents on soft wrapped text.
set linespace=4
set noexpandtab
set wrap
set linebreak
set breakindent
set briopt=shift:2
set shiftwidth=2
set tabstop=2
set textwidth=79
set columns=80
@saralilyb
saralilyb / dice-mcmc.r
Created April 26, 2016 13:18
MCMC model of dice rolling: is a bastard sword better than a longsword (2nd Ed, BGII)
# 2d4 vs 1d8
samples <- 10000
# 2d4
m1d4 <- sample(1:4, samples, replace = TRUE)
m2d4 <- sample(1:4, samples, replace = TRUE)
bastard_sword <- m1d4 + m2d4

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@saralilyb
saralilyb / compile-closure.sh
Created March 19, 2017 17:10
Shell script to compile javascript through Google Closure
#!/bin/sh
usage(){
echo "Usage: $0 inputfile.js closurecompiledfile.js"
exit 1
}
is_file_exits(){
local f="$1"
[[ -f "$f" ]] && return 0 || return 1
@saralilyb
saralilyb / compbf.R
Created March 26, 2017 12:01
compare bayesfactor models in R with the random baseline
# compares bayesfactor analyses relative to the last, which is the random only model (just participants)
compbf <- function(m) {
m[c(1:(length(m)-1))]/m[length(m)]
}