Skip to content

Instantly share code, notes, and snippets.

View yohanboniface's full-sized avatar
💭
Set your status

Yohan Boniface yohanboniface

💭
Set your status
View GitHub Profile
@yohanboniface
yohanboniface / boundary.ini
Created November 17, 2017 14:21
Extract boundaries from OpenStreetMap (as lines, to keep individual tags, like maritime=*)
# put here the name of keys for ways that are assumed to be polygons if they are closed
# see http://wiki.openstreetmap.org/wiki/Map_Features
closed_ways_are_polygons=aeroway,amenity,boundary,building,craft,geological,historic,landuse,leisure,military,natural,office,place,shop,sport,tourism
# comment to avoid laundering of keys ( ':' turned into '_' )
attribute_name_laundering=yes
# uncomment to report all nodes, including the ones without any (significant) tag
report_all_nodes=yes
import re
import time
from lxml import etree
from pymongo import MongoClient
from minicli import cli, run
client = MongoClient()
db = client.mydb
collection = db.disorders

Keybase proof

I hereby claim:

  • I am yohanboniface on github.
  • I am ybon (https://keybase.io/ybon) on keybase.
  • I have a public key ASBug1SfdjvvVkzo5xTk5oXG4tYSCrg4enKNeccZZU-Gngo

To claim this, I am signing this object:

@yohanboniface
yohanboniface / boundary.ini
Created November 17, 2017 10:41
Extracting international boundaries from OSM
# put here the name of keys for ways that are assumed to be polygons if they are closed
# see http://wiki.openstreetmap.org/wiki/Map_Features
closed_ways_are_polygons=aeroway,amenity,boundary,building,craft,geological,historic,landuse,leisure,military,natural,office,place,shop,sport,tourism
# comment to avoid laundering of keys ( ':' turned into '_' )
attribute_name_laundering=yes
# uncomment to report all nodes, including the ones without any (significant) tag
#report_all_nodes=yes
from timeit import timeit
class A:
def __init__(self):
self.kwargs = {}
class B(dict):
@yohanboniface
yohanboniface / localconfig.js
Created September 29, 2014 17:32
Example of Kosmtik localconfig files used for HDM rendering
exports.LocalConfig = function (localizer, project) {
var country = 'burundi',
centers = {
hispaniola: [-71.7325, 19.1075, 9],
burundi: [29.9377, -3.4216, 9],
sierraleone: [-13.2366965, 8.4732210, 9],
chad: [16.56874, 8.68063, 9],
mauritania: [-11.558, 19.725, 9]
};
project.mml.compareUrl = "http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
@yohanboniface
yohanboniface / README.md
Last active December 9, 2016 17:11
Benching utilery

Install

You need imposm3, postgresql, postgis, python 3.5, siege.

Data

wget http://download.geofabrik.de/europe/france/ile-de-france-latest.osm.pbf

Import:

env PGHOST=/var/run/postgresql/ imposm3 import -mapping ~/Code/maps/pagesjaunes/mapping.yml -read ~/Data/geo/pbf/ile-de-france-latest.osm.pbf -write -connection="postgis:///pagesjaunes" -appendcache -deployproduction

@yohanboniface
yohanboniface / README.md
Last active September 5, 2016 13:34
Koombook stress tests

Command

siege -f urls.txt -c 10 -r 100 -b

Example of result

Transactions:		        3637 hits
Availability:		      100.00 %

Elapsed time: 88.35 secs

@yohanboniface
yohanboniface / README.md
Last active September 5, 2016 13:31
Generating thumbnails for ideascube

Creating the pdf thumbnails:

for file in *.pdf; do evince-thumbnailer -s 400 $file $file.png; done

Creating the mp4 thumbnails:

for file in *.mp4; do totem-video-thumbnailer -rs 400 $file $file.png; done

@yohanboniface
yohanboniface / local.py
Created August 9, 2016 13:04
Addok local config for France and trigrams
LOG_QUERIES = False
LOG_NOT_FOUND = False
EXTRA_FIELDS = [
{'key': 'citycode'},
]
FILTERS = ['type', 'postcode', 'citycode', 'city']
BLOCKED_PLUGINS = ['addok.pairs', 'addok.fuzzy', 'addok.autocomplete']
QUERY_PROCESSORS = [
'addok_france.extract_address',
'addok_france.clean_query',