Skip to content

Instantly share code, notes, and snippets.

View mvexel's full-sized avatar

Martijn van Exel mvexel

View GitHub Profile
def get_current_state_from_server():
# I dislike PyYAML, that is why
import requests
from dateutil.parser import parse
current_state_file_url =\
"http://planet.openstreetmap.org/replication/changesets/state.yaml"
state_file = requests.get(current_state_file_url).text
current_state = {}
for line in state_file.split('\n'):
elems = line.split(':')
def get_changeset_path_for(utctime):
import os
parts = ["http://planet.osm.org/replication/changesets/"]
from math import floor
minutes = int(floor((utctime - config.OSM_DAY_ZERO).total_seconds() / 60))
rem = minutes
while rem > 0:
parts.append(str(rem % 1000).zfill(3))
rem = (rem - rem % 1000) / 1000
return os.path.join(*parts)
@mvexel
mvexel / newmac.md
Last active August 29, 2015 14:00
what I do to a new Mac

Settings

  1. Move all icons out of the dock
  2. Add Google account to iMessage
  3. Disable natural scrolling
  4. Set key repeat to fastest, delay to shortest.

Installs

  • Software update (Apple -> Software Update...)
[12:57:02] 127 $ osmconvert --out-statistics ~/Downloads/amsterdam.osm.pbf
timestamp min: 2007-03-25T18:36:55Z
timestamp max: 2014-04-08T23:02:08Z
lon min: 4.4650000
lon max: 5.3469997
lat min: 52.1630000
lat max: 52.6289997
nodes: 6907968
ways: 946951
relations: 8924
# Deploying A MapRoulette Server
Deploying a MapRoulette instance is pretty straightforward. We have a Fabric script that takes care of almost everything for you.
If you just want to run MapRoulette locally for development or testing, this guide is not for you.
## What do you need? ##
You need a server to deploy MapRoulette on. This can be a local or remote machine, but it will need to meet these requirements:
@mvexel
mvexel / gist:9221083
Created February 26, 2014 00:39
geojson plugin build error
compile:
[echo] compiling sources for dist/traffic-geojson-plugin.jar ...
[javac] /Users/martijnv/src/traffic-sandbox/geojson-plugin/build.xml:33: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 17 source files to /Users/martijnv/src/traffic-sandbox/geojson-plugin/build
[javac] /Users/martijnv/src/traffic-sandbox/geojson-plugin/src/com/telenav/traffic/josm/plugins/geojson/GeoJsonPanel.java:50: type javax.swing.JList does not take parameters
[javac] private final JList<GeoJsonFeature> list = new JList<GeoJsonFeature>();
[javac] ^
[javac] /Users/martijnv/src/traffic-sandbox/geojson-plugin/src/com/telenav/traffic/josm/plugins/geojson/GeoJsonPanel.java:54: type javax.swing.JComboBox does not take parameters
[javac] private final JComboBox<TaskState> state = new JComboBox<TaskState>(TaskState.values());
[javac] ^
@mvexel
mvexel / defaults.json
Created February 17, 2014 23:11
My JSBeautify settings
{
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": true,
"brace_style": "collapse",
"keep_array_indentation": false,
{ "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
"properties": {"prop0": "value0"}
},
{ "type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
@mvexel
mvexel / 0_reuse_code.js
Created October 22, 2013 13:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mvexel
mvexel / index.html
Created August 7, 2013 17:41
via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;