Skip to content

Instantly share code, notes, and snippets.

View dphiffer's full-sized avatar

Dan Phiffer dphiffer

View GitHub Profile
@dphiffer
dphiffer / file
Last active January 27, 2016 21:28
freedom_public
{"0.17074542515911162":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEc4fH3eyrjdfaVZaqXx8I0jRvPJ37n7hA\r\nGbL/kjWvJ5A/9WQkoh9fLbtMtw8ZkJtvNR/Jh/xJjnNnF4z6ODsh5M3/AAAACDxn\r\naXRodWI+wv8AAACNBBATCAA//wAAAAWCVqfQF/8AAAACiwn/AAAACZCBU4V816v6\r\nAv8AAAAFlQgJCgv/AAAAA5YBAv8AAAACmwP/AAAAAp4BAAC1UwEA0fGRMusg99eL\r\nuGcKAnFNegoiZcPQooeiV2LrnQuRHwsA/RYCYytvdDQJmWua1ky67Xh4tmzTkSs2\r\nq4LZF8gGHMsOzv8AAABWBAAAAAASCCqGSM49AwEHAgMEAz1TCitc3kKlu2kfNQDc\r\nWYuce65JDIl/gYO3qnXDh+kQ7cx1AkgnXGTtwAqeL+GLDbVPq+m997lAEJ+Hzh/Q\r\n6gMBCAfC/wAAAGwEGBMIAB//AAAABYJWp9AX/wAAAAmQgVOFfNer+gL/AAAAApsM\r\nAADzvQD4oNy2qSdvJsZCeplVbcMhCTcyVfyzU7HUQegKDULb4gEA5BiVHRZr1Zca\r\nJrU0qQUiNP/NaSAp2x/sVpgDz9PYIIw=\r\n=oKw2\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n","0.845377374207601":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEc4fH3eyrjdfaVZaqXx8I0jRvPJ37n7hA\r\nGbL/kjWvJ5A/9WQkoh9fLbtMtw8ZkJtvNR/Jh/xJjnNnF4z6ODsh5M3/AAAACDxn\r\naXRodWI+wv8AAACNBBATCA
@dphiffer
dphiffer / nyc_neighborhood_names.txt
Created February 25, 2016 21:44
NYC Neighborhood Names / source: nyc.gov
Allerton, Bronx
Annadale, Staten Island
Arden Heights, Staten Island
Arlington, Staten Island
Arrochar, Staten Island
Arverne, Queens
Astoria, Queens
Astoria Heights, Queens
Auburndale, Queens
Bath Beach, Brooklyn
@dphiffer
dphiffer / curl-cmd.txt
Created March 2, 2016 17:20
How do I GitHub API?
curl -X POST \
-H "User-Agent: curl" \
-H "Content-Type: application/json" \
-H "Authorization: token XXXXXX" \
"https://api.github.com/gists" -d '
{
"description": "Testing gist API",
"public": false,
"files": {
"file1.txt": {
@dphiffer
dphiffer / github-500-error.md
Last active April 28, 2016 20:46
The repos/contents GitHub API method only works on "small" repos.

This is a minimal demonstration of a problem that's cropped up, where committing changes via this API method has stopped working: https://developer.github.com/v3/repos/contents/#update-a-file

But only sometimes! It does work on "small" repos, but the same process fails inexplicably when attempted on a "big" repo.

Below I compare results committing against the README.md of two repos:

First, get a copy of the current README (base64 content + sha hash).

@dphiffer
dphiffer / timelapse.sh
Created June 9, 2016 01:47
Turn folders of .jpg files into .mp4 files
#!/bin/bash
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for subdir in $dir/*/
do
date=`basename $subdir`
if [ ! -f "$dir/$date.mp4" ]
then
ffmpeg -framerate 30 -pattern_type glob -i "$subdir*.jpg" -c:v libx264 "$dir/$date.mp4"
@dphiffer
dphiffer / war_collector.sh
Created October 13, 2016 00:24
A script to collect (conserve? steal?) Constant Dullaart's "war" web pages
#!/bin/sh
# A script to collect (conserve? steal?) Constant Dullaart's "war" web pages
# See: https://twitter.com/constantdull/status/785797564167839744
# Usage: ./war_collector.sh
start_from="war.repair"
if [ ! -d src ] ; then
@dphiffer
dphiffer / 0_transitland_nyc_subway.sh
Last active May 11, 2017 15:22
Loads all of the NYC subway stations from transit.land into a CSV file
#!/bin/bash
# This script outputs a CSV file constructed from transit.land's dataset of
# subway stops in NYC.
# See also: https://transit.land/documentation/datastore/api-endpoints.html
#
# (20170415/dphiffer)
url="https://transit.land/api/v1/stops?served_by=o-dr5r-nyct"
raw_csv="transitland_nyc_subway_dupes.csv"
<?php
// Re: https://twitter.com/anildash/status/856690635872493569
// with some help from https://github.com/dphiffer/emoji-index
$json = file_get_contents('emoji-index.json');
$emoji = json_decode($json);
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
wof_id onestop_id name latitude longitude
1108956235 s-dr5nqr57gy-tottenville Tottenville 40.512764 -74.251961
1108956237 s-dr5nqrxgq4-atlantic Atlantic 40.515401 -74.245689
1108956239 s-dr5nqxfd1v-arthurkill Arthur Kill 40.516578 -74.242096
1108956241 s-dr5nw8j32e-nassau Nassau 40.517812 -74.238373
1108956243 s-dr5nwb7gzw-richmondvalley Richmond Valley 40.519631 -74.229141
1108956245 s-dr5nx0uhnu-pleasantplains Pleasant Plains 40.52241 -74.217847
1108956247 s-dr5nx93njn-princesbay Prince's Bay 40.525507 -74.200064
1108956251 s-dr5nxdzjvb-huguenot Huguenot 40.533674 -74.191794
1108956253 s-dr5q8h1j63-annadale Annadale 40.54046 -74.178217
@dphiffer
dphiffer / wikidata_flatiron.csv
Created June 14, 2017 13:40
select * from entity where lat > 40.738403 and lat < 40.744255 and lng > -73.999201 and lng < -73.976885;
id name instance_of lat lng
Q63751 Rubin Museum of Art Q207694 40.740111111111 -73.997805555556
Q904191 Theodore Roosevelt Birthplace National Historic Site Q41176 40.738889 -73.989722
Q1427377 Flatiron District Q123705 40.7408 -73.9896
Q2478033 23rd Street Q55488 40.743889 -73.995556
Q2478345 23rd Street Q55488 40.7429 -73.9929
Q2515468 18th Street Q928830 40.740833 -73.997778
Q3163335 Jazz Standard 40.7422 -73.9838
Q4557667 18th Street Q55488 40.7398 -73.995
Q4631696 23rd Street Q55488 40.7388 -73.9832