Skip to content

Instantly share code, notes, and snippets.

View jeremybmerrill's full-sized avatar

Jeremy B. Merrill jeremybmerrill

View GitHub Profile
@jeremybmerrill
jeremybmerrill / atlantacrime2012until2017.small.csv
Last active February 28, 2018 22:08
resources for an observable notebook
We can't make this file beautiful and searchable because it's too large.
offense_id,occur_date,UC2 Literal,neighborhood,npu
110171050,01/14/2012,LARCENY-NON VEHICLE,Sweet Auburn,M
110181057,08/22/2011,LARCENY-NON VEHICLE,Glenrose Heights,Z
112032439,07/22/2011,AUTO THEFT,Downtown,M
112152334,08/03/2011,AUTO THEFT,Perkerson,X
113491709,12/07/2011,LARCENY-FROM VEHICLE,Hills Park,D
120010023,01/01/2012,AGG ASSAULT,The Villages at Carver,Y
120010069,12/31/2011,LARCENY-FROM VEHICLE,Old Fourth Ward,M
120010072,12/31/2011,LARCENY-FROM VEHICLE,English Avenue,L
120010086,01/01/2012,LARCENY-FROM VEHICLE,Morningside/Lenox Park,F
@jeremybmerrill
jeremybmerrill / demo.html
Created October 3, 2016 18:10
a demonstration of the shenanigans caused by the isTrusted attribute
<!DOCTYPE html>
<html>
<head>
<title>How To Cause Trouble With Events' isTrusted Attribute</title>
<meta charset="UTF-8">
<script
src="http://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
</head>
@jeremybmerrill
jeremybmerrill / airplanes.sql
Created March 13, 2016 02:27
color lines by gradient
create table flight_segments as
SELECT hexid,start_time,end_time,callsign,point,
-- take a substring if the length reamining in the segment is greater than 5280 feet (1609.34 m)
-- otherwise take the remainder
ST_LineSubstring(geom, 1609.34*n/length,
CASE
WHEN 1609.34*(n+1) < length THEN 1609.34*(n+1)/length
ELSE 1
END) as geom
FROM
@jeremybmerrill
jeremybmerrill / code_tos.rb
Created January 20, 2016 21:11
quick-and-dirty code things, CSV backend
require 'sinatra'
require 'csv'
$csv_read_path = "my_thing.uncoded.csv"
$csv_write_path = "my_thing.coded.csv"
$data = CSV.read($csv_read_path, {:headers => true})
def write_csv!
CSV.open($csv_write_path, 'wb') do |csv|
@jeremybmerrill
jeremybmerrill / ocr_pdf.rb
Created September 24, 2015 20:09
ocr a pdf
#! /usr/bin/env ruby
require 'pdfshaver'
# brew install ghostscript imagemagick #yikes
# brew install tesseract --HEAD # needs >=3.04
ARGV.each do |pdf|
puts pdf
pdf_basename = pdf.gsub(".pdf", '')
@jeremybmerrill
jeremybmerrill / gist:1d058424aca5ebe2eb3d
Created April 7, 2015 16:55
export from RDS mysql to a CSV
#
# on mac, replace TABGOESHERE with a tab by typing Ctrl-V then the Tab key
#
mysql -u USERNAME --database=dbname --host=HOST --batch -e "select * from tablename" |
sed 's/TABGOESHERE/","/g'| sed 's/^/"/g' | sed 's/$/"/g' | sed 's/\n//g' > destination.csv
@jeremybmerrill
jeremybmerrill / bpl-locations.geojson
Created January 2, 2015 22:37
Brooklyn Public Library locations in GeoJSON format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeremybmerrill
jeremybmerrill / cyberlist.yml
Created December 23, 2014 02:51
Most common `cyber X` word-pairs in certain New York Times, ProPublica, Washington Post, Politico articles and congress speeches since sometime in 2013
---
cyber security: 384
cyber threats: 87
cyber attacks: 826
cyber businesses: 1
cyber protection: 1
cyber espionage: 10
cyber surveillance: 1
cyber theft: 2
cyber area: 1
@jeremybmerrill
jeremybmerrill / tabula-win-tester.rb
Last active August 29, 2015 14:09
Tracking down the commit that broke tabula-0.96 for Windows (issue #203)
#!/usr/bin/env ruby
# Tabula 0.9.6 for Windows fails: Unknown Error (206) - __UNKNOWN_CONSTANT__
# for more discussion see https://github.com/tabulapdf/tabula/issues/203
require 'open3'
revisions = ["3286e6ce0a2ee9eee617b0b1b23c3ada1effcbac",
"41307d4c0085a8b3bad2797549bf6b94a8a765c3",
"45404fa07fb3ddaf2280ec03b7d2f84e20396e88", #fails UNKNOWN_CONSTANT
@jeremybmerrill
jeremybmerrill / keybase.md
Created October 16, 2014 02:21
keybase verification

Keybase proof

I hereby claim:

  • I am jeremybmerrill on github.
  • I am jeremybmerrill (https://keybase.io/jeremybmerrill) on keybase.
  • I have a public key whose fingerprint is 1B27 B244 205A C0B3 AAED 0F02 7780 C469 4F62 1BA0

To claim this, I am signing this object: