Skip to content

Instantly share code, notes, and snippets.

Mathieu Leplatre leplatrem

Block or report user

Report or block leplatrem

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@leplatrem
leplatrem / app.py
Created Oct 11, 2011
Simple Flask-couchdb demo
View app.py
import simplejson
from flask import Flask, g, request
from couchdb.design import ViewDefinition
import flaskext.couchdb
app = Flask(__name__)
"""
CouchDB permanent view
@leplatrem
leplatrem / gist:1415767
Created Dec 1, 2011
Leaflet Offline Tiles using SQL Storage
View gist:1415767
/*
* L.TileLayer.LocalCache : A tile layer using SQL Storage, if available.
*/
L.TileLayer.LocalCache = L.TileLayer.extend({
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: 'abc',
@leplatrem
leplatrem / gist:1415795
Created Dec 1, 2011
Tiles serialization in base64 using django and landez
View gist:1415795
import base64
from StringIO import StringIO
from django.http import HttpResponse
from django.utils import simplejson
from easydict import EasyDict as edict
from landez import TilesManager
from . import app_settings
@leplatrem
leplatrem / replag.sh
Created Jan 24, 2012
OSM Mirror - Replication Lag
View replag.sh
#!/bin/bash
# Script by MapOSMatic
# (Maxime Petazzoni)
STATE=${HOME}/replication_-_15mn/osmosis/last.state.txt
rep=`cat ${STATE} |\
grep 'timestamp' |\
awk '{split($0, a, "="); print a[2]}' |\
@leplatrem
leplatrem / planet-update.sh
Created Jan 24, 2012
OSM Mirror - Update
View planet-update.sh
#!/bin/sh
# Script by MapOSMatic
# (Maxime Petazzoni)
LOG_FILE="/home/osm/replication_-_15mn/planet-update.log"
PID_FILE="/home/osm/replication_-_15mn/planet-update.pid"
OSM2PGSQL="/usr/bin/osm2pgsql"
OSM2PGSQL_STYLE="/usr/share/osm2pgsql/default.style"
@leplatrem
leplatrem / ass2dcl.py
Created Feb 23, 2012
ass2dcl : conversion of ASS subtitles to XML DCSubtitle
View ass2dcl.py
"""
``ass2dcl`` converts subtitles from ASS to DCSubtitle format.
It depends on python3 and `pysub <http://pypi.python.org/pypi/pysubs>`_.
INSTALL
::
@leplatrem
leplatrem / capture.js
Created Apr 5, 2012
Casper.js screenshot with optional POST and data
View capture.js
var casper = require("casper").create({
viewportSize: {width: 1600, height: 1200},
//verbose: true,
//logLevel: 'debug',
onError: function(self, m) { // Any "error" level message will be written
console.log('FATAL:' + m); // on the console output and PhantomJS will
self.exit(); // terminate
},
});
@leplatrem
leplatrem / index.html
Created Sep 22, 2012
Django-leaflet working example project
View index.html
{% load leaflet_tags %}
<html>
<head>
{% leaflet_js %}
{% leaflet_css %}
</head>
<body>
<h1>Django-Leaflet</h1>
{% leaflet_map "main" %}
</body>
@leplatrem
leplatrem / app.js
Created Dec 13, 2012
First (very first) try with Backbone and daybed
View app.js
var MushroomSpot = Backbone.Model.extend({
defaults: function() {
return {
mushroom: "Unknown",
area: [0.0, 0.0]
};
},
initialize: function() {
@leplatrem
leplatrem / demo.js
Last active Dec 14, 2015
Leaflet.LayerIndex example
View demo.js
L.Map.include(L.LayerIndexMixin);
var map = L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);
map.fitWorld();
map.addControl(new L.Control.Information());
for (var i=0; i<5000; i++) {
var lat = Math.random() * 170 - 85
, lng = Math.random() * 350 - 175;
You can’t perform that action at this time.