Skip to content

Instantly share code, notes, and snippets.

View booo's full-sized avatar

Philipp Borgers booo

View GitHub Profile
#!/usr/bin/env coffee
{ createServer } = require "net"
irc = require "irc"
NICK = "munin-spline"
PIPE = "./pipe.sock"
channels = ["#spline"]
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<title>Downtime</title>
<style type="text/css">
/*
SELECT
ST_ConvexHull(ST_Collect(planet_osm_point.way)) AS convexHull,
ST_Centroid(ST_ConvexHull(ST_Collect(planet_osm_point.way))) AS centroid
FROM
planet_osm_polygon,
planet_osm_point
SELECT
planet_osm_point.name,
ST_Distance(
Geography(ST_Transform(planet_osm_point.way,4326)),
Geography(ST_Transform(ST_Centroid(planet_osm_polygon.way),4326))
)
FROM
@booo
booo / intervaltree.py
Created December 10, 2011 23:09 — forked from slomo/intervaltree.py
Implementation of intervaltree
class Node:
def __init__(self,value):
self.left = Leaf()
self.right = Leaf()
self.value = value
self.maxima = value.high
def search(tree,interval):
if interval.low > tree.maxima:
#!/usr/bin/env python2
from shapely.geometry import Polygon
from matplotlib import pyplot
from descartes import PolygonPatch
class IntervalTree(object):
[21:27:59] ways: 12875k/12875k
[21:28:02] ways: total time 1 h 29m 48s for 12875277 (2389/s)
[21:30:02] nodes: 561k/561k
[21:30:03] nodes: total time 2 m 1 s for 561535 (4635/s)
create_generalized_tables
create_views
[21:30:03] writing took 1 h 40m 38s
[21:30:03] imposm took 1 h 40m 38s
#!/usr/bin/env python2
# make sure to install shapely and matplotlib
# pip install shapely matplotlib
# maybe use a virtual environment
p1=(350,75)
p2=(379,161)
p3=(469,161)
p4=(397,215)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Simple script to create geojson from osm files.
Prints geojson features line by line.
Currently we don't support relations.
Requires (unmodified) imposm and imposm.parser
Inspired by https://github.com/emka/OSMCouch
'''
@booo
booo / pg.js
Created November 25, 2011 21:46
var pg = require("pg");
var connectionString = "xxx";
pg.connect(connectionString, function(error, client){
if(error) {
console.log(error);
} else {
query = client.query("SELECT * FROM nodes");
query.on('error', function(error){ console.log(error);});
query.on('row', function(row){ console.log(row);});
}