Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This is a helper script to generate a dict of student to section assignments.
# roster.csv should contain the u# of each student that you want to assign sections to each on a newline....
# e.g. u5555555\nu1234567\nu9876543
import numpy as np
with open("roster.csv") as f:
roster = f.read().split()
N = len(roster)
np.random.seed(0)
// The addSections function takes in a JS object containing info about which sections to add to which students.
// it doesn't have any logic to check the current status of assigned sections, so if you run this multiple times,
// I'm not sure what will happen.
function findEl(cssSelector, innerHTML) {
return Array.prototype.filter.call(
document.querySelectorAll(cssSelector),
x => {return x.innerHTML.includes(innerHTML);}
);
}
@csbrown
csbrown / test.md
Last active August 1, 2018 16:32
markdown testing
@csbrown
csbrown / distcorr.py
Created December 8, 2016 18:15 — forked from satra/distcorr.py
Distance Correlation in Python
from scipy.spatial.distance import pdist, squareform
import numpy as np
from numbapro import jit, float32
def distcorr(X, Y):
""" Compute the distance correlation function
>>> a = [1,2,3,4,5]
>>> b = np.array([1,2,9,4,4])
@csbrown
csbrown / gist:61df3930896099998e5f
Created February 18, 2015 18:06
My R sessionInfo
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
@csbrown
csbrown / stuff.json
Created August 15, 2013 19:47
waterbear example
{"title":"","description":"","date":1376486580977,"waterbearVersion":"2.0","blocks":[{"blocktype":"context","group":"scripts_workspace","id":"5a6dd590-64fa-44e4-8250-24631519134d","help":"Drag your script blocks here","scopeId":"5a6dd590-64fa-44e4-8250-24631519134d","scriptId":"5a6dd590-64fa-44e4-8250-24631519134d","sockets":[{"name":"Workspace"}],"seqNum":"2","script":"[[1]]","contained":[{"blocktype":"eventhandler","group":"controls","id":"386b017a-4ea1-4539-9201-01832f481a72","help":"this trigger will run its scripts once when the program starts","scopeId":"0","scriptId":"1cf8132a-4996-47db-b482-4e336200e3ca","sockets":[{"name":"when program runs"}],"seqNum":"3","script":"function _start(){[[1]]}_start();","contained":[{"blocktype":"step","group":"images","id":"a39df783-10df-494f-9f43-29629016a353","help":"initialize a new imageData from local file","scopeId":"0","scriptId":"1c79800c-af02-48e1-b9cb-d043e8299f7a","sockets":[{"name":"create local image ## with size","type":"localimage","uName":"create local