Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0"?>
<osm version="0.6" generator="Way-with-fistory-fetcher" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<node id="154762320" changeset="167532" timestamp="2007-12-07T13:44:35Z" version="1" visible="true" user="wunni" uid="7811" lat="51.6990787" lon="10.5121746">
<tag k="created_by" v="JOSM"/>
</node>
<node id="154762320" changeset="2724228" timestamp="2009-10-03T15:03:12Z" version="2" visible="true" user="Ich_hasse_doitsche_OSM-Korinthenkacker" uid="179968" lat="51.6990787" lon="10.5121746"/>
<node id="154762320" changeset="9695653" timestamp="2011-10-30T16:51:29Z" version="3" visible="true" user="Ogmios" uid="81983" lat="51.6990612" lon="10.5120616"/>
<node id="154762322" changeset="167532" timestamp="2007-12-07T13:44:35Z" version="1" visible="true" user="wunni" uid="7811" lat="51.6994731" lon="10.5120858">
<tag k="created_by" v="JOSM"/>
</node>
@MaZderMind
MaZderMind / render.py
Created April 28, 2014 09:09
render data from postgresql to an image or a pdf - my version of render_image or nik2img
#!/usr/bin/python
#
# render data from postgresql to an image or a pdf
#
from optparse import OptionParser
import sys, os
import mapnik
@MaZderMind
MaZderMind / require.js
Last active August 29, 2015 14:01 — forked from louisstow/require.js
/**
* Shim the require function used in node.js
*/
(function() {
if (window.require !== undefined)
throw 'RequireException: \'require\' already defined in global scope';
window.require = function(module) {
var url = window.require.resolve(module);
@MaZderMind
MaZderMind / docrypt.py
Created May 28, 2014 13:50
generte a unix-shadow-compatible password on systems with python <3.3
#!/usr/bin/python
# Wrapper to the POSIX crypt library call and associated functionality.
import sys
import crypt as _crypt
import string as _string
from random import SystemRandom as _SystemRandom
from collections import namedtuple as _namedtuple
@MaZderMind
MaZderMind / guthaben.sh
Created June 5, 2014 16:14
Aktuelles Guthaben via Shell von einem angeschlossenen Prepaid-USB-3G-Stick auslesen. Getestet mit Congstar Prepaid-Stick.
#!/bin/sh
export LANG=C
echo "wait 60 seconds"
{
gammu getussd "*100#" |\
grep reply |\
awk '{print substr($4, 2, length($4)-2)}' |\
sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' |\
xargs printf;
} &
@MaZderMind
MaZderMind / gist:635538724c885a63e1c3
Created July 31, 2014 20:18
libleibzig w/ unicode - \o/ - yay
mkdir test; chdir test
virtualenv -p python3 .
./bin/pip install -U setuptools
./bin/pip install https://github.com/MaZderMind/libleipzig-python/archive/master.zip
./bin/python
Python 3.3.2+ (default, Feb 28 2014, 00:52:16)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libleipzig
>>> >>> print(libleipzig.Cooccurrences("müde", 0, 1, corpus="de"))
@MaZderMind
MaZderMind / bgpdump_to_asn.py
Last active August 29, 2015 14:08
bgpdump to postges
# echo 'DROP TABLE IF EXISTS asn_lookup; CREATE TABLE asn_lookup (prefix INET, asn BIGINT, name VARCHAR(500))' | psql
# bgpdump -m latest-bview.gz | python bgpdump_to_asn.py data-used-autnums | psql -c 'COPY asn_lookup FROM STDIN'
# echo 'CREATE INDEX asn_prefix ON asn_lookup (prefix);' | psql
# echo "SELECT * FROM asn_lookup WHERE prefix >> '`curl -s http://wtfismyip.com/text`';" | psql
import fileinput
import sys
import re
reload(sys)
@MaZderMind
MaZderMind / media_ccc_de.py
Created April 9, 2015 12:20
media_ccc_de livestreamer plugin
"""Plugin for media.ccc.de
Supports:
- http://media.ccc.de
- http://streaming.media.ccc.de (not yet implemented)
"""
import re
import requests
import json
@MaZderMind
MaZderMind / gist:5ef15902e0a3e6b04d47
Created April 28, 2015 12:57
jQuery - Wait for multiple Ajax-Calls
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script>
var reqs = [];
@MaZderMind
MaZderMind / log-after
Created June 6, 2015 03:57
gstreamer interaudiosrc timestamps before and after the a/v-sync-patch
outgoing dumb gap ts 0:00:00.000000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.025000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.050000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.075000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.100000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.125000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.150000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.175000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.200000000 duration 0:00:00.025000000
outgoing dumb gap ts 0:00:00.225000000 duration 0:00:00.025000000