Skip to content

Instantly share code, notes, and snippets.

Avatar
🚌
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
ximeg / ThresholdingAlgo.py
Created Apr 20, 2017
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
View ThresholdingAlgo.py
#!/usr/bin/env python
# Implementation of algorithm from http://stackoverflow.com/a/22640362/6029703
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
bbengfort / nx2gt.py
Created Jun 26, 2016
Convert a networkx to graph-tool graph
View nx2gt.py
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
View todobot.py
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
drmalex07 / convert-geojson-to-wkt.py
Created May 12, 2014
Convert GeoJSON to/from WKT in Python. #python #geojson #geometry
View convert-geojson-to-wkt.py
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
drewda / gist:1299198
Created Oct 19, 2011
Jenks natural breaks classification
View gist:1299198
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
def getJenksBreaks( dataList, numClass ):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)
View cut.py
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.