hacky web audio api + d3.
allow mic access, talk at computer.
import re | |
from sys import argv | |
from bs4 import BeautifulSoup as bs | |
from pyquery import PyQuery as pq | |
from lxml import etree | |
filename = argv[-1] | |
anchors = re.compile('<a.+?>.+?<\/a>', re.DOTALL|re.I) | |
with open(filename, 'r') as infile: |
hacky web audio api + d3.
allow mic access, talk at computer.
#!/usr/bin/env python | |
# get/store flickr photos in a spreadsheet | |
# you'll need a key: https://www.flickr.com/services/api/keys/apply/ | |
import csv | |
import json | |
import sys | |
from base64 import encodestring as b64 | |
from urllib import urlencode, urlopen as get | |
from optparse import OptionParser |
import re | |
from datetime import datetime as dt | |
fake_dates = '10-Jan-2011, 01-Feb-02, ##-Bla-##, 01-Bla-2014' | |
# you can probably do some lookahead assertion at the end of the regex to only capture 2 digits or the last 2 digits | |
# instead of the mess below [1] | |
date_finder = re.compile('(\d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2,4})') | |
dates = re.findall(date_finder, fake_dates) |
(function(){var e=document.createElement("script");e.async=!0,e.src="https://rawgit.com/josephg/noisejs/master/perlin.js",e.charset="utf-8",document.body.appendChild(e)})(); |
apparently mapbox no longer lets you export mbtiles locally like tilemill used to. this can be a problem when you just spent an hour creating a tileset and suddenly realize that you need to fork over a monthly fee to get your tiles out.
this is the general structure of mapbox studio local tile urls (for styles): http://localhost:3000/style/<z>/<x>/<y>.<ext>?id=tmstyle://<file path>/<style name>.tm2&<autogenerated id>
.
after selecting a project, View > Toggle Developer Tools
, Network
tab, copy the url for a tile, replace the part that corresponds to <z>/<x>/<y>
above with {z}/{x}/{y}
and you have a template url.
you can use the url to put together a custom provider in tilestache (have to do it yourself, since the proxy provider doesn't seem to support querystring arguments with urls) or if you're doing some rapid prototyping like i was, use this simple script to cache the tiles while you're working on other aspects of the map in the browser.
NOTE: you shou
var request = require('request'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/goofy', function(req, res) { | |
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res); | |
}); | |
app.get('/loop', function(req, res) { | |
res.render('mypage'); |
# some convenience functions here, nothing new | |
''' | |
# usage: | |
from easypipe import easy_pipeline | |
from easypipe import print_metrics | |
data_folder = "data-hold/20news" | |
p = easy_pipeline() | |
print_metrics(p, data_folder) | |
''' |
layer
= buildings
, earth,landuse
, etc: docs)layer
= toner
, toner-lines
, toner-lite
, toner-background
, toner-hybrid
)// This is the core Javascript code for http://windhistory.com/ | |
// I haven't done a full open source release, but I figured I'd put the most important | |
// D3 code out there for people to learn from. [email protected] | |
/** Common wind rose code **/ | |
// Function to draw a single arc for the wind rose | |
// Input: Drawing options object containing | |
// width: degrees of width to draw (ie 5 or 15) | |
// from: integer, inner radius |