Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy B. Merrill jeremybmerrill

View GitHub Profile
@jeremybmerrill
jeremybmerrill / atlantacrime2012until2017.small.csv
Last active Feb 28, 2018
resources for an observable notebook
View atlantacrime2012until2017.small.csv
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 Oct 3, 2016
a demonstration of the shenanigans caused by the isTrusted attribute
View demo.html
<!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 Mar 13, 2016
color lines by gradient
View airplanes.sql
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 Jan 20, 2016
quick-and-dirty code things, CSV backend
View code_tos.rb
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|
View ocr_pdf.rb
#! /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 Apr 7, 2015
export from RDS mysql to a CSV
View gist:1d058424aca5ebe2eb3d
#
# 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 Jan 2, 2015
Brooklyn Public Library locations in GeoJSON format
View bpl-locations.geojson
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 Dec 23, 2014
Most common `cyber X` word-pairs in certain New York Times, ProPublica, Washington Post, Politico articles and congress speeches since sometime in 2013
View cyberlist.yml
---
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 Aug 29, 2015
Tracking down the commit that broke tabula-0.96 for Windows (issue #203)
View tabula-win-tester.rb
#!/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 Oct 16, 2014
keybase verification
View keybase.md

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:

You can’t perform that action at this time.