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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
from django.forms.models import model_to_dict
def log_addition(request, dbobject, oldobject=None, message=None):
_log_action(request, dbobject, oldobject, ADDITION, message)
leplatrem / .gitconfig
Created Nov 19, 2014
Git config (exemple)
View .gitconfig
name = Your Name\n
email =
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
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 /
Created Jan 24, 2012
OSM Mirror - Replication Lag
# Script by MapOSMatic
# (Maxime Petazzoni)
rep=`cat ${STATE} |\
grep 'timestamp' |\
awk '{split($0, a, "="); print a[2]}' |\
leplatrem /
Created Jan 24, 2012
OSM Mirror - Update
# Script by MapOSMatic
# (Maxime Petazzoni)
leplatrem /
Created Feb 23, 2012
ass2dcl : conversion of ASS subtitles to XML DCSubtitle
``ass2dcl`` converts subtitles from ASS to DCSubtitle format.
It depends on python3 and `pysub <>`_.
leplatrem / index.html
Created Sep 22, 2012
Django-leaflet working example project
View index.html
{% load leaflet_tags %}
{% leaflet_js %}
{% leaflet_css %}
{% leaflet_map "main" %}
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 / demo.js
Last active Dec 14, 2015
Leaflet.LayerIndex example
View demo.js
var map ='map');
map.addControl(new L.Control.Information());
for (var i=0; i<5000; i++) {
var lat = Math.random() * 170 - 85
, lng = Math.random() * 350 - 175;
leplatrem / gist:5317450
Created Apr 5, 2013
Repair South and GeoModel fields SRID
View gist:5317450
find . -name "????_*.py" | xargs sed -i "s/from django.db import models/from django.db import models\nfrom django.conf import settings/"
find . -name "????_*.py" | xargs sed -i "s/'32632'/'%s' % settings.SRID/g"
find . -name "????_*.py" | xargs sed -i "s/srid=32632/srid=settings.SRID/g"
You can’t perform that action at this time.