See twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import io | |
import json | |
import os | |
import re | |
import time | |
from itertools import groupby | |
import folium | |
import geocoder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def main(bwv): | |
bwv0 = '%03d' % int(bwv) | |
links = { | |
# label: (url template, raw?) | |
bwv: ('http://www.bach-cantatas.com/BWV{slug}.htm', True), | |
'allofbach permalink': ('https://www.bachvereniging.nl/en/bwv/bwv-{slug}', True), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import csv | |
import json | |
import re | |
import random | |
import requests | |
import time | |
import urllib | |
BASE = 'http://web.mit.edu/bin/cgicso?query' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><meta charset="utf-8" /></head><body><script type="text/javascript">/** | |
* plotly.js v1.20.5 | |
* Copyright 2012-2016, Plotly, Inc. | |
* All rights reserved. | |
* Licensed under the MIT license | |
*/ | |
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=t("../src/lib"),i={"X,X div":"font-family:'Open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PIL.Image | |
from PIL.ExifTags import TAGS, GPSTAGS | |
from operator import mul | |
def rekey(d, source): | |
"""Re-keys a dictionary d to use keynames from source mapping.""" | |
return {encoding.get(k, k):v for (k, v) in d.iteritems()} if d else {} | |
def get_exif(image): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seconds_per_year = 365*24*3600 | |
new_year = time.mktime(time.strptime("01/01/2017 0:0:0", "%m/%d/%Y %H:%M:%S")) | |
print "wishing everyone a happy %.1f through %.1f" % (new_year, new_year + seconds_per_year) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
import bs4 | |
import requests | |
p = requests.get('http://www.classical-scene.com/calendar/') | |
s = bs4.BeautifulSoup(p.content, "lxml") | |
presenters = s.select('.presenter > a') | |
c = Counter(p.text for p in performers) | |
# At least 4 concerts to be considered for a series subscription. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/processing-js/processing-js.github.io.git | |
cd processing-js.github.io/ | |
sudo gem install jekyll | |
sudo gem install bundler | |
sudo gem install github-pages | |
jekyll build | |
cd _site | |
python -m SimpleHTTPServer | |
# in browser: http://0.0.0.0:8000/reference/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code for https://github.com/processing/processing/issues/4376 | |
# See processing/core/src/processing/core/PConstants.java for render/blend mode constants. | |
labels = 'REPLACE, BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN'.split(', ') | |
blend_modes = [REPLACE, BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN] | |
blend_mode_names = dict(zip(blend_modes, labels)) | |
render_modes = [JAVA2D, P2D, P3D] | |
render_mode = render_modes[0] | |
def setup(): | |
size(300, 1000, render_mode) |