Skip to content

Instantly share code, notes, and snippets.

View ajduberstein's full-sized avatar

Andrew Duberstein ajduberstein

View GitHub Profile
{
"draft": false,
"layers": [
{
"id": "background",
"type": "background",
"layout": {},
"paint": {
"background-color": "hsl(55, 1%, 20%)"
}
@ajduberstein
ajduberstein / remap_covid_counties.py
Last active March 23, 2020 22:08
Script to remap county names
CORRECTIONS = {
"Stanislaus, CA": "Stanislaus County, CA",
"Monmouth, NJ": "Monmouth County, NJ",
"Stark, OH": "Stark County, OH",
"Bon Homme, SD": "Bon Homme County, SD",
"Orleans, LA": "Orleans Parish, LA",
"Ventura, CA": "Ventura County, CA",
"Jefferson, CO": "Jefferson County, CO",
"Pottawattamie, IA": "Pottawattamie County, IA",
"Nassau, FL": "Nassau County, FL",
@ajduberstein
ajduberstein / point-radial-distance.js
Created January 1, 2020 23:06
Calculate destination latitude/longitude from a longitude, latitude, distance, and bearing angle
// Earth has a mean radius of 6,371km
const R = 6371.01;
const EPSILON = 0.0000001;
function toRadians(degree) {
return (degree * Math.PI) / 180;
}
function toDegrees(radians) {
@ajduberstein
ajduberstein / pydeck_demo.py
Last active May 9, 2020 00:40
pydeck HexagonLayer demo
import pydeck
# 2014 locations of car accidents in the UK
UK_ACCIDENTS_DATA = ('https://raw.githubusercontent.com/uber-common/'
'deck.gl-data/master/examples/3d-heatmap/heatmap-data.csv')
# Define a layer to display on a map
layer = pydeck.Layer(
'HexagonLayer',
UK_ACCIDENTS_DATA,
@ajduberstein
ajduberstein / bundle.js
Last active March 6, 2019 19:06
json api for deck
var bundle = (function (exports, core, d3Dsv) {
'use strict';
// TODO - can we reuse the core util? Assuming we don't want to export it
/* eslint-disable complexity */
// Compares two objects to see if their keys are shallowly equal
function shallowEqualObjects(a, b) {
if (a === b) {
@ajduberstein
ajduberstein / county.csv
Created October 9, 2018 23:29
Massachusetts Ridesharing Data in 2017
OBJECTID TOWN FIPS_CODE TOWN_ID TYPE FIPS_STCO SUM_SQUARE_MILES POP2010 ORIGIN_TRIPS PCT_ORIGIN_TRIPS DESTINATION_TRIPS PCT_DESTINATION_TRIPS ORIGIN_TRIPS_PER_PERSON DESTINATION_TRIPS_PER_PERSON
151 ABINGTON 2502300170 1 T 25023 10.19 15985 29620 0.04571 29665 0.04578 1.85 1.86
144 ACTON 2501700380 2 T 25017 20.295 21924 17645 0.02723 18998 0.02932 0.8 0.87
62 ACUSHNET 2500500520 3 T 25005 18.878 10303 673 0.00104 891 0.00138 0.07 0.09
20 ADAMS 2500300555 4 T 25003 22.96 8485 66 0.0001 113 0.00017 0.01 0.01
2 AGAWAM 2501300840 5 TC 25013 24.335 28438 20918 0.03228 20672 0.0319 0.74 0.73
155 ALFORD 2500300975 6 T 25003 11.533 494 1 0 3 0 0 0.01
16 AMESBURY 2500901260 7 C 25009 13.725 16283 9984 0.01541 9210 0.01421 0.61 0.57
351 AMHERST 2501501325 8 T 25015 27.754 37819 284506 0.43907 282307 0.43567 7.52 7.46
179 ANDOVER 2500901465 9 T 25009 32.153 33201 85159 0.13142 90416 0.13953 2.56 2.72
import itertools
import math
from Queue import Queue
import sys
from threading import Thread
import time
import requests
"""
@ajduberstein
ajduberstein / gist:910fb02a52cc51fbfa50
Created September 29, 2014 06:08
Yoman: Yo for the Terminal
Yoman: Yo for the Terminal
====================
[Get an API token and a username](https://medium.com/@YoAppStatus/yo-developers-api-e7f2f0ec5c3c), and send yourself a [Yo](http://www.justyo.co/) when your script raps up.
Sub your username and API key in below. Copy and paste it into your .bashrc.
```
function yoman () {
eval "$@"