Skip to content

Instantly share code, notes, and snippets.

trains, buses, bikes, and maps

Kuan Butts kuanb

trains, buses, bikes, and maps
View GitHub Profile
View Caching parse_time.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ximeg /
Created Apr 20, 2017
Python implementation of smoothed z-score algorithm from
#!/usr/bin/env python
# Implementation of algorithm from
import numpy as np
import pylab
def thresholding_algo(y, lag, threshold, influence):
signals = np.zeros(len(y))
filteredY = np.array(y)
avgFilter = [0]*len(y)
stdFilter = [0]*len(y)
bbengfort /
Created Jun 26, 2016
Convert a networkx to graph-tool graph
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
import zulip
import os
import json
client = zulip.Client(config_file='.config', verbose=True)
class TodoManager(object):
def __init__(self, client):
self.client = client
self.todo_file = ".todos"
drmalex07 /
Created May 12, 2014
Convert GeoJSON to/from WKT in Python. #python #geojson #geometry
import json
import geojson
from shapely.geometry import shape
o = {
"coordinates": [[[23.314208, 37.768469], [24.039306, 37.768469], [24.039306, 38.214372], [23.314208, 38.214372], [23.314208, 37.768469]]],
"type": "Polygon"
s = json.dumps(o)
drewda / gist:1299198
Created Oct 19, 2011
Jenks natural breaks classification
View gist:1299198
# code from
# described at
def getJenksBreaks( dataList, numClass ):
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
from math import sqrt
from matplotlib import pyplot
from shapely.geometry import *
GM = (sqrt(5)-1.0)/2.0
W = 8.0
H = W*GM
SIZE = (W, H)
COLORS = ['#6699cc', '#ffcc33']
You can’t perform that action at this time.