Skip to content

Instantly share code, notes, and snippets.

View davclark's full-sized avatar

Dav Clark davclark

View GitHub Profile
@davclark
davclark / ftrain_treeify.py
Created November 11, 2012 21:04
An apology to Paul
def ftrain(l):
'''Convert an iterable to a nested list based on ordered comparison'''
i = iter(l)
tree, seen = ftrain_helper(i, i.next())
# This might not be the desired behavior, but it's not terrible
# You could also emit a warning or an exception here
while(not seen is None):
rest_tree, seen = ftrain_helper(i, seen)
tree = [tree] + rest_tree
return tree
@davclark
davclark / vega.json
Created December 24, 2013 21:41
Example vega.json file that doesn't work
{
"axes": [],
"data": [
{
"format": {
"feature": "world-countries",
"type": "topojson"
},
"name": "countries",
"transform": [
@davclark
davclark / README
Last active August 29, 2015 14:00
Instructions for Team
How to:
1. Writing good questions
2. Code
3. I added this
4. I also
a. added this
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
'''ungraded.py - extract answers to ungraded problems
Data is obtained from the `course_structure` and `courseware_studentmodule`
data, which are currently specified at the top of the file.
This was developed in response to a request from an instructor to obtain
individual student responses to ungraded questions *with 0 weight*. However,
upon inspection, I noted that all items had either 0 weight, or had weight
@davclark
davclark / Historical.ipynb
Created April 24, 2015 18:29
Example of using GNIP
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davclark
davclark / setup_jupyter_notebook.sh
Created March 23, 2016 18:35
The steps to set up Jupyter notebooks to run nicely on a remote server. Please feel free to make your own mods!
#!/usr/bin/bash
# XXX The below was made before the jupyter switch and would be nice to
# update! For now, you can run this *before* ever running the jupyter notebook,
# OR you can `rm ~/.jupyter/migrated` and move any existing `jupyter_notebook_config.py`
# after you run this script and it should re-import. -DJC
# Make it easy to set up password / encryption for IPython notebook
echo "
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.