Skip to content

Instantly share code, notes, and snippets.

View dwillis's full-sized avatar

Derek Willis dwillis

View GitHub Profile
@bycoffe
bycoffe / csvcut
Created September 15, 2009 13:08 — forked from JoeGermuska/csvcut
#!/usr/bin/env python
"""
Like cut, but for CSVs. To be used from a shell command line.
Note that fields are zero-based, as opposed to 'cut' where they are 1-based.
Should use something better than getopt, but this works...
Usage:
csvcut foobar.csv
@bryanl
bryanl / campfire-emoji.txt
Created January 27, 2011 16:34
campfire emoji
Surround these with : e.g. :calling:
+1
-1
bulb
calling
clap
cop
email
feet
@onyxfish
onyxfish / enb_schema.csv
Created August 23, 2011 13:46
An in2csv (csvkit) schema for parsing the Bureau of Labor Statistics Quarterly Census of Employment and Wages flat-files (ftp://ftp.bls.gov/pub/special.requests/cew/)
column start length
survey_prefix 0 3
area_code 3 5
datatype_code 8 1
size_code 9 1
ownership_code 10 1
naics_industry_code 11 6
year 17 4
aggregation_level 21 2
first_quarter_status_code 23 1
require 'sinatra'
require 'sanitize'
TO_REMOVE = ["", " ", " "]
get '/' do
<<-HTML
<form method="post" action="sanitize">
<textarea name="dirty" style="width:100%;height:800px;"></textarea>
<input type="submit" value="Submit">
@dannguyen
dannguyen / gender-detector-front-page-news.md
Last active May 11, 2020 17:28
Gender detection for formal news sites

Command-line gender analysis of New York Times articles, using wget and regex and highly simplified domain-specific methodology

This is a short proof-of-concept of how to use pattern matching and batch-downloading -- and, well, careful reading of New York Times style -- to perform a quickie gender analysis of New York Times articles by website section.

Sloppy analysis: Across virtually all of the nytimes.com section fronts, mentions of men outnumber women, except for Weddings (roughly 200 vs 190, Ms. vs Mr). Previous explanations for this phenomenon have generally boiled down to - more men are in the kinds of positions that get written about.

(function() {
var MapCanvas = Landline.Stateline = function(container, locality, opts) {
this.paper = {};
this.events = {};
this.attrs = {};
this.lookup = {};
this.locality = locality;
this.container = $(container);
this.container.css("position", "relative");