Skip to content

Instantly share code, notes, and snippets.

@joelhaasnoot
joelhaasnoot / deepdive.py
Created October 28, 2019 10:27
Mugsy DeepDive Bot
# Requires: requests, bs4, python-pushover
import time
import requests
from bs4 import BeautifulSoup
from pushover import init, Client
known_last_updated = ""
@joelhaasnoot
joelhaasnoot / straatnamen.txt
Created January 11, 2018 10:30
Straten in Nederland
This file has been truncated, but you can view the full file.
28309 Dorpsstraat
22798 Kerkstraat
17848 Hoofdstraat
15678 Molenstraat
15043 Schoolstraat
12229 Nieuwstraat
11880 Wilhelminastraat
11536 Julianastraat
10825 Hoofdweg
8728 Stationsstraat
@joelhaasnoot
joelhaasnoot / Typeahead-BS3-css
Created September 26, 2015 10:19 — forked from bhays/Typeahead-BS3-css
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
@joelhaasnoot
joelhaasnoot / input
Created December 29, 2013 19:24
Trying to make patterns
line_id,operator_id,directiontype,name,stoparearef,latitude,longitude,pointorder,journeypatterns
HTM:3,HTM:8127,1,"Zoetermeer, Centrum-West",3006,52.060565,4.483079,1,{154579}
HTM:3,HTM:8103,1,"Zoetermeer, Centrum-West",3006,52.060597,4.483706,1,{154562}
HTM:3,HTM:1818,2,"Den Haag, Arnold Spoelplein",3165,52.05464,4.232891,1,"{154591,154580}"
HTM:3,HTM:8126,1,"Zoetermeer, Dorp",3177,52.054132,4.491709,2,"{154579,154562}"
HTM:3,HTM:1806,2,"Den Haag, Pisuissestraat",3131,52.057413,4.22792,2,"{154591,154580}"
HTM:3,HTM:8124,1,"Zoetermeer, Delftsewallen",3179,52.050779,4.486936,3,"{154579,154562}"
HTM:3,HTM:1813,2,"Den Haag, Mozartlaan",3164,52.060732,4.231698,3,"{154591,154580}"
HTM:3,HTM:8122,1,"Zoetermeer, Driemanspolder",3136,52.048483,4.477098,4,"{154579,154562}"
HTM:3,HTM:1802,2,"Den Haag, Heliotrooplaan",3133,52.062723,4.231297,4,"{154591,154580}"
def transform_rd(point):
''' Please note this returns an OGRGeometry, not a point '''
src_string = '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs no_defs <>'
src_srs = SpatialReference(src_string)
geom = OGRGeometry(point.wkt, src_srs)
geom.transform(4326)
return geom
@joelhaasnoot
joelhaasnoot / fabfile.py
Created February 6, 2012 21:44
My very simple django deploy script
from fabric.api import task, cd, sudo, run, env, prefix
from contextlib import contextmanager as _contextmanager
@task(default=True)
def live():
env.hosts = ['ssh.myserver.com']
env.virtualenv = "project-release"
env.parent = "github"
env.branch = "master"
env.user = "user"
@joelhaasnoot
joelhaasnoot / local_settings.py
Created January 10, 2012 21:44
Database config
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'haltes', # Or path to database file if using sqlite3.
'USER': 'geo', # Not used with sqlite3.
'PASSWORD': 'haltes', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
from pygraph.classes import graph, exceptions
def make_graph(nodes, edges):
bg = graph.graph()
bg.add_nodes(nodes)
for edge in edges:
try:
bg.add_edge(edge)
except exceptions.AdditionError:
print "Already had it: %s %s" % (edge[0], edge[1]) # Edge is tuple