Skip to content

Instantly share code, notes, and snippets.

View mvexel's full-sized avatar

Martijn van Exel mvexel

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mvexel
mvexel / states-fips.py
Created July 20, 2017 17:14
states-fips.py
states = {
"01": ["Alabama", "AL"],
"02": ["Alaska", "AK"],
"60": ["American Samoa", "AS"],
"04": ["Arizona", "AZ"],
"05": ["Arkansas", "AR"],
"81": ["Baker Island", ""],
"06": ["California", "CA"],
"08": ["Colorado", "CO"],
"09": ["Connecticut", "CT"],
12:26 $ rake test:db
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
Run options: --seed 7757
# Running:
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
@mvexel
mvexel / select_exits.md
Created February 10, 2017 17:00
select motorway exit nodes SQL

I use this series of queries to get all nodes that should represent motorway_junction nodes:

-- create temp table to store all motorway nodes
create table motorway_nodes as (select (st_dump(st_points(linestring))).geom geom, id from ways where tags->'highway' = 'motorway');
-- create temp table to store all motorway_link start nodes
create table motorway_link_start_nodes as (select st_pointn(linestring, 1) geom, id from ways where tags->'highway' = 'motorway_link');
-- create temp table with the intersection between these two
create table offramp_starts as (select l.id lid, m.id mid, l.geom from motorway_nodes m, motorway_link_start_nodes l where st_equals(m.geom, l.geom));
-- select the OSM nodes at these locations
@mvexel
mvexel / devos-call-script.md
Last active January 28, 2017 21:00
devos-call-script.md

Mr [SENATOR],

My name is [NAME] and I live in [CITY], [STATE]. I am calling to express my grave concerns about Ms DeVos, the current candidate for Secretary of Education. Her confirmation hearings showed to me that she lacks basic knowledge about our public education system. A system that Ms DeVos seems intent on dismantling in favor of privately run schools. There is no precedent for such a change working to benefit the quality of education at scale. Our education system is already fragile, and many measures could be taken to improve it, but navigating down this uncharted and ill-informed path that will be impossible to backtrack from is not one that we should take. Therefore, Ms DeVos is not a suitable person to lead education policy, and I ask of you in the strongest possible terms to not support her candidacy.

Thank you for listening.

@mvexel
mvexel / restrictions-in-toronto.csv
Last active December 21, 2016 01:48
restrictions-in-toronto.csv
@id restriction restriction:conditional
14986 no_left_turn
15054 no_right_turn
15056 no_right_turn
56407 no_right_turn
69208 no_left_turn @ (Mo-Fr 15:30-18:30)
69210 no_left_turn
69211 no_left_turn
69212 no_left_turn
69213 no_left_turn
@mvexel
mvexel / stock_quote_function.sh
Created December 20, 2016 19:19
stock_quote_function.sh
# Get stock quote from command line
# Call with `sq yhoo`
# By default only last trade price shown
# add extra info in optional second parameter
# for available data see http://vikku.info/codetrash/Yahoo_Finance_Stock_Quote_API
# like so: `sq yhoo c1` will give you % change for the day
function sq() {
curl -s "http://download.finance.yahoo.com/d/quotes.csv?s=$1&f=l1$2"
}
@mvexel
mvexel / network-values.txt
Created December 1, 2016 23:14
network-values.txt
CA:AB:primary
CA:QC:A
CA:QC:A
CA:ON:county
CA:ON:primary
CA:ON:primary
CA:ON:primary
CA:ON:primary
CA:ON:primary
CA:ON:primary
@mvexel
mvexel / manifesto-2017.md
Last active November 30, 2016 15:50
MartijnOSM US Manifesto 2017

This is a draft


layout: post title: "Here is how I failed in 2016. And why I should be on the OSM US board in 2017." excerpt: "My manifesto for the 2016 OSM US board elections" tags: [osm, elections, board] comments: false

@mvexel
mvexel / maproulette-2-windows-local-setup.md
Last active October 11, 2016 20:37
maproulette-2-windows-local-setup.md
  • Install Java JDK 8 from here
    • Set JAVA_HOME environment variable according to install instructions
  • Download and extract the Lightbend Activator from here
  • Add the Activator bin directory to your Windows path.
  • Install PostgreSQL 9.5 from here
    • When asked, choose osm as the database superuser password
  • Run the PostgreSQL StackBuilder to install PostGIS 2.3.0
  • Install git for windows from here
  • Open a PSQL console from the PostgreSQL program menu
  • In the PSQL consile, create the MapRoulette database: