Skip to content

Instantly share code, notes, and snippets.

@joelhaasnoot
joelhaasnoot / deepdive.py
Created Oct 28, 2019
Mugsy DeepDive Bot
View deepdive.py
# Requires: requests, bs4, python-pushover
import time
import requests
from bs4 import BeautifulSoup
from pushover import init, Client
known_last_updated = ""
View straatnamen.txt
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
@joelhaasnoot
joelhaasnoot / Typeahead-BS3-css
Created Sep 26, 2015 — forked from bhays/Typeahead-BS3-css
Bootstrap 3 style fixes for using Typeahead.js
View Typeahead-BS3-css
.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 Dec 29, 2013
Trying to make patterns
View input
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}"
View gist:2220126
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 Feb 6, 2012
My very simple django deploy script
View fabfile.py
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"
View local_settings.py
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.
}
}
View gist:1521104
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