Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""
simple example script for running and testing notebook resulting in a new workbook.
Usage: `ipnbdoctest.py foo.ipynb foo_new.ipynb`
Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook.
"""
import io
@davidshinn
davidshinn / README.md
Last active December 30, 2015 08:19
Georgia University Salaries
@davidshinn
davidshinn / README.md
Last active December 30, 2015 23:59 — forked from mbostock/.block
Focus+Context via Brushing on the y-Axis

This example is a revision of Focus+Context via Brushing to demonstrate how to use D3's brush component to implement focus + context zooming but along the y-axis. Click and drag up/down in the narrow chart on the left to pan or zoom.

@davidshinn
davidshinn / README.md
Last active December 31, 2015 01:59 — forked from mbostock/.block
Line Chart with Focus-Context
@davidshinn
davidshinn / _.md
Created January 3, 2014 03:16
Tributary inlet
@davidshinn
davidshinn / _.md
Created January 7, 2014 05:13
bounded panning
@davidshinn
davidshinn / _.md
Created January 14, 2014 18:37
workbars
@davidshinn
davidshinn / test.ipynb
Last active August 29, 2015 14:15
categorical_variables
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davidshinn
davidshinn / profile_max
Last active August 29, 2015 14:15
Profile finding max in vector versus max in matrix
{"nbformat_minor": 0, "cells": [{"source": "### Profile finding max in a vector versus finding max in matrix ", "cell_type": "markdown", "metadata": {}}, {"execution_count": 1, "cell_type": "code", "source": "import numpy as np", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}, {"execution_count": 2, "cell_type": "code", "source": "%%time\nm = np.random.randn(500, 600, 500)", "outputs": [{"output_type": "stream", "name": "stdout", "text": "CPU times: user 4.37 s, sys: 309 ms, total: 4.68 s\nWall time: 4.68 s\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 3, "cell_type": "code", "source": "v = m[:, :, 1]", "outputs": [], "metadata": {"collapsed": true, "trusted": true}}, {"source": "Timing finding max in a vector\n\nHowever, realize you have to run this 300,000 times (500\\*600)", "cell_type": "markdown", "metadata": {}}, {"execution_count": 4, "cell_type": "code", "source": "%timeit np.max(v)", "outputs": [{"output_type": "stream", "name": "stdout", "text": "100
#!/usr/bin/env python
"""Outputs the WebKit cookies for a specified URL.
Useful for wget'ing URLs which require authentication.
$ python thisfile.py http://example.com > wgetcookies.txt
$ wget --load-cookies wgetcookies.txt http://example.com/example.zip
"""
import objc
from Foundation import NSHTTPCookieStorage, NSURL