Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Set your status

Yohan Boniface yohanboniface

💭
Set your status
View GitHub Profile
View mongocomplete.py
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
View keybase.md

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 Nov 17, 2017
Extract boundaries from OpenStreetMap (as lines, to keep individual tags, like maritime=*)
View boundary.ini
# 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
@yohanboniface
yohanboniface / boundary.ini
Created Nov 17, 2017
Extracting international boundaries from OSM
View boundary.ini
# 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
View test_dict_inheritance_perf.py
from timeit import timeit
class A:
def __init__(self):
self.kwargs = {}
class B(dict):
@yohanboniface
yohanboniface / README.md
Last active Sep 5, 2016
Koombook stress tests
View README.md

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 Sep 5, 2016
Generating thumbnails for ideascube
View README.md

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 / README.md
Last active Dec 9, 2016
Benching utilery
View README.md

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 / local.py
Created Aug 9, 2016
Addok local config for France and trigrams
View local.py
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',
View Path.Drag.js
/* A Draggable that does not update the element position
and takes care of only bubbling targetted path in Canvas mode. */
L.PathDraggable = L.Draggable.extend({
initialize: function (path) {
this._path = path;
this._canvas = (path._map.getRenderer(path) instanceof L.Canvas);
var element = this._canvas ? this._path._map.getRenderer(this._path)._container : this._path._path;
L.Draggable.prototype.initialize.call(this, element, element, true)
L.DomUtil.addClass(element, 'leaflet-path-draggable');
You can’t perform that action at this time.