Skip to content

Instantly share code, notes, and snippets.

@nsfmc
nsfmc / dart.png
Last active October 1, 2018 10:32
slope fields
dart.png
@nsfmc
nsfmc / checker.html
Last active August 29, 2015 14:11
artboards to icons (false as third param means an error in matching)
<!doctype html>
<html>
<head>
<style>
.imgs, .json {display: inline-block; width: 40%;}
.desat {opacity: .2;}
.json {vertical-align: top;}
pre {white-space: pre-wrap;}
</style>
</head>
@nsfmc
nsfmc / .motd.txt
Last active August 29, 2018 18:26
an motd script which reads lines from eno's oblique strategies
Abandon normal instruments [1st ed.]
Accept advice [1st ed.]
Accretion [1st ed.]
A line has two sides [1st ed.]
Allow an easement (an easement is the abandonment of a stricture) [1st ed.]
Are there sections? Consider transitions [1st ed.]
Ask people to work against their better judgement [1st ed.]
Ask your body [1st ed.]
Assemble some of the instruments in a group and treat the group [1st ed.]
Balance the consistency principle with the inconsistency principle [1st ed.]
@nsfmc
nsfmc / horizontal-grids.py
Last active August 29, 2015 14:07
a plotdevice file for gridding out domains and subjects
from ka_automation import *
# yeesh, gross!!!
def random_domain_color(slug, **kwargs):
import random
seed = kwargs.get('seed', 53)
print seed
random.seed(seed)
subject_count = len(subjects_for_domain(slug))
@nsfmc
nsfmc / contentsize.py
Last active August 29, 2015 14:06
getting sizes (amount of content) for each subject in khan academy
# getting relative size of each subject in math using
# http://www.khanacademy.org/api/v1/topictree and helper
# methods from https://gist.github.com/nsfmc/2a877c61f0f7da984ead
# to plug into something like https://gist.github.com/nsfmc/2d496c1bb9e096402f8e
output = []
for s in subjects_for_domain('math'):
count = 0
for t in get_topics(domain='math', subject=s['slug']):
for tut in t['children']:
@nsfmc
nsfmc / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

A treemap recursively subdivides area into rectangles; the area of any node in the tree corresponds to its value. This example uses color to encode different packages of the Flare visualization toolkit. Treemap design invented by Ben Shneiderman. Squarified algorithm by Bruls, Huizing and van Wijk. Data courtesy Jeff Heer.

@nsfmc
nsfmc / README.md
Last active August 29, 2015 14:06 — forked from mbostock/.block

A treemap recursively subdivides area into rectangles; the area of any node in the tree corresponds to its value. This example uses color to encode different packages of the Flare visualization toolkit. Treemap design invented by Ben Shneiderman. Squarified algorithm by Bruls, Huizing and van Wijk. Data courtesy Jeff Heer.

@nsfmc
nsfmc / ka-auto.py
Created September 8, 2014 19:10
a plotdevice file for making stuff with the ka api
"""
ka design automation tools -
super rough, but this is a set of functions, documented at the bottom,
which let you get the text/names of topics/subjects/domains for parts of
our topic tree.
you need to get the topic tree, which you can do by running
curl -o ~/topictree.json http://www.khanacademy.org/api/v1/topictree
@nsfmc
nsfmc / Dockerfile.tmpl
Created March 29, 2014 20:23
a dockerfile which i
# $VBOX_VERSION should probably be something like 4.3.10 or somesuch
#
FROM boot2docker/boot2docker-rootfs
RUN apt-get install p7zip-full
RUN mkdir -p /vboxguest && \
cd /vboxguest && \
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
sh VBoxLinuxAdditions.run --noexec --target . && \
@nsfmc
nsfmc / toggleEndian.js
Created March 25, 2014 19:24
am i the only person that wants to be able to do Buffer("foo", "utf16-be")?
/**
* returns a new buffer with toggled endianness
* @param {Buffer} buff a nodeJS buffer, presumably utf16le/ucs2
* @return {Buffer} a nodeJS buffer, probably utf16be
*/
function toggleEndian(buff){
out = []
for (var i = 0; i < buff.length; i+=2) {
out[i] = buff[i + 1];
out[i + 1] = buff[i];