Comparing 2016 presidential election cartograms from FiveThirtyEight, Washington Post, Wall Street Journal, NPR, and Daily Kos.
Uses Polylabel to pick some decent label positions.
See also: Jigsaw morphing, Smoother polygon transitions
# Based on Waveshare's epd5in65f.py demo. Copyright notice at end. | |
import sys | |
import os | |
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic') | |
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib') | |
if os.path.exists(libdir): | |
sys.path.append(libdir) |
license: mit |
#!/usr/bin/env python3 | |
# A text filter for BBEdit. If it encounters a JSON error, it writes an error message | |
# to stderr (appears in a new BBEdit window) and leaves the original text unaltered. | |
# c.f. http://crisp.tumblr.com/post/2574967567/json-pretty-print-formatting-in-bbedit | |
# c.f. http://blog.scottlowe.org/2013/11/11/making-json-output-more-readable-with-bbedit/ | |
import json | |
import sys | |
def main(): |
#!/usr/bin/env python | |
# encoding: utf-8 | |
import network | |
import socket | |
sta = network.WLAN(network.STA_IF) | |
sta.active(True) | |
sta.connect('ESSID', 'key') |
Comparing 2016 presidential election cartograms from FiveThirtyEight, Washington Post, Wall Street Journal, NPR, and Daily Kos.
Uses Polylabel to pick some decent label positions.
See also: Jigsaw morphing, Smoother polygon transitions
#!/usr/bin/env python | |
import numpy as np | |
import cv2 | |
from sys import argv | |
# Gaussian radius (should really be an argument): | |
r = 21 | |
src, dst = argv[1:] |
#!/usr/bin/env zsh | |
# ./day.sh month_number morning_day evening_day zoom_level | |
# Strictly alpha: for example, does not know how to handle | |
# month edges or unscheduled missing images. | |
set -eu | |
year=$1 |
import requests as req | |
import sys | |
from dateutil.parser import parse | |
from PIL import Image | |
from StringIO import StringIO | |
# hi8-fetch.py <date> <zoom level> <output> | |
# E.g.: hi8-fetch.py 2016-01-13T22:10:00 8 2016-01-13T221000-z8.png | |
# Fetch Himawari-8 full disks at a given zoom level. | |
# Valid zoom levels seem to be powers of 2, 1..16, and 20. |
#!/usr/bin/env python | |
# created by shuichinet https://gist.github.com/shuichinet | |
# forked from https://gist.github.com/shuichinet/8159878 21 Nov 2015 | |
# using minor edits by fcrimins https://www.reddit.com/user/fcrimins from https://www.reddit.com/r/google/comments/2xzgyv/remove_duplicate_songs_from_google_play_music/csh6mrh | |
# also using clever edits by Morgan Gothard https://medium.com/@mgothard | |
# updated for Python 3.5 by John M. Kuchta https://medium.com/@sebvance 22 Nov 2016 (hey I was busy) | |
# compiled by John M. Kuchta https://medium.com/@sebvance | |
# thanks to shuichinet, fcrimins and Mr. Gothard for their work |