Skip to content

Instantly share code, notes, and snippets.

View monkeycycle's full-sized avatar

Michael Pereira monkeycycle

View GitHub Profile
@monkeycycle
monkeycycle / durhamcounty.py
Created February 24, 2017 04:13 — forked from johnhawkinson/durhamcounty.py
Durham County NYC - Inmate Population Search
#!/usr/bin/python
import mechanize
import lxml.html
BASE_URL = "http://www2.durhamcountync.gov/sheriff/ips/default.aspx"
def parse_names(root):
# finds the names and prints
names = root.xpath("//a[@class='rvsnavy-bold']")
@monkeycycle
monkeycycle / .block
Created March 2, 2017 16:01 — forked from palewire/.block
Load data incrementally in d3 using a sorted value
license: MIT
border: no
height: 800
@monkeycycle
monkeycycle / .block
Created March 5, 2017 02:26 — forked from HarryStevens/.block
Annotations with Swoopy Drag for Scatter Plot
license: gpl-3.0
@monkeycycle
monkeycycle / 0_reuse_code.js
Created March 30, 2017 01:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@monkeycycle
monkeycycle / index.html
Created March 31, 2017 03:51 — forked from biovisualize/index.html
Basic Reusable Slopegraph
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<script type='text/javascript' src="http://d3js.org/d3.v2.js"></script>
<script type='text/javascript' src="slopegraph.js"></script>
<style type='text/css'>
line.slope-line{
stroke:green
@monkeycycle
monkeycycle / .block
Created April 4, 2017 14:16 — forked from mbostock/.block
Google Maps + D3
license: gpl-3.0
@monkeycycle
monkeycycle / make-animated-gifs-using-ffmpeg.md
Created May 8, 2017 13:56 — forked from gka/make-animated-gifs-using-ffmpeg.md
how to make a nice GIF from png frames

Make sure ffmpeg is up-to-date:

brew update
brew upgrade ffmpeg

Convert a MOV into frames. Tweak the 2/1 if you want more or fewer frames.

@monkeycycle
monkeycycle / multi-crowbar.js
Created May 8, 2017 13:56 — forked from gka/multi-crowbar.js
like svg-crowbar, but for multiple svg elements!
var multiCrowbar = (function() {
/*
* SVG Export
* converts html labels to svg text nodes
* will produce incorrect results when used with multi-line html texts
*
* Author: Gregor Aisch
* based on https://github.com/NYTimes/svg-crowbar/blob/gh-pages/svg-crowbar-2.js
*/
@monkeycycle
monkeycycle / xls2csv.py
Created May 8, 2017 13:56 — forked from gka/xls2csv.py
Excel to CSV
import xlrd
import csv
import sys
def csv_from_excel(fn):
wb = xlrd.open_workbook(fn)
sh = wb.sheet_by_index(0)
your_csv_file = open(fn.replace('xls', 'csv'), 'wb')
wr = csv.writer(your_csv_file, quoting=csv.QUOTE_ALL)
for rownum in xrange(sh.nrows):
@monkeycycle
monkeycycle / florida.csv
Created May 8, 2017 13:57 — forked from gka/florida.csv
bump chart tutorial, part 1
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
live_state born_state 1900 1910 1920 1930 1940 1950 1960 1970 1980 1990 2000 2012
Florida Alabama 0.0477 0.0484 0.0541 0.0508 0.0555 0.0554 0.0458 0.0344 0.0259 0.0197 0.0145 0.0102
Florida Alaska 0.0000 0.0000 0.0000 0.0000 0.0001 0.0000 0.0002 0.0004 0.0005 0.0005 0.0005 0.0008
Florida Arizona 0.0000 0.0000 0.0000 0.0001 0.0004 0.0003 0.0004 0.0007 0.0008 0.0011 0.0014 0.0015
Florida Arkansas 0.0007 0.0009 0.0021 0.0035 0.0024 0.0040 0.0040 0.0043 0.0032 0.0030 0.0025 0.0022
Florida California 0.0003 0.0003 0.0009 0.0006 0.0017 0.0032 0.0056 0.0074 0.0086 0.0104 0.0131 0.0141
Florida Colorado 0.0001 0.0001 0.0006 0.0004 0.0008 0.0008 0.0013 0.0017 0.0018 0.0024 0.0024 0.0026
Florida Connecticut 0.0018 0.0025 0.0018 0.0032 0.0043 0.0058 0.0076 0.0089 0.0106 0.0111 0.0112 0.0097
Florida Delaware 0.0002 0.0004 0.0010 0.0004 0.0005 0.0007 0.0009 0.0012 0.0013 0.0013 0.0013 0.0014
Florida District of Columbia 0.0004 0.0005 0.0005 0.0012 0.0011 0.0019 0.0036 0.0028 0.0035 0.0037 0.0035 0.0028