{{ message }}

Instantly share code, notes, and snippets.

🚌
trains, buses, bikes, and maps

# Kuan Buttskuanb

🚌
trains, buses, bikes, and maps
Created Aug 8, 2014
Example Homework Assignment from Introductory Python course 6.00
View gist:2f75e66c8b7c827717c2
 # Problem Set 7: Simulating the Spread of Disease, Body Temperature and Virus Population Dynamics # Name: Kuan Butts # Time: 22:00 import numpy import random import pylab # for checking work from prob. 3, 4, 5, 6 #from ps7_precompiled_27 import *
Created Aug 8, 2014
View gist:e7155e51d6ba9950dbfd
 def adjacent_hanoi(num_discs, start_peg, end_peg): """ For this problem, discs should always start on the first peg and end on the last peg. num_discs: an integer number of discs start_peg: starting peg end_peg: ending peg returns: integer number of moves, actual moves required """
Created Aug 8, 2014
View gist:a76cce362aec8f0b9000
 Find a route using Geolocation and Google Maps API
Created Sep 8, 2015
Simple locked header with class toggle on scroll
Created Oct 26, 2016
View insert ctracks output
 'use strict'; const fs = require('fs'); const parse = require('csv-parse'); const db = require('knex')({ client: 'postgresql', connection: { user: '', database: 'clientcomm', },
Created Apr 14, 2017
Example of Dask variation of GeoDataFrame buffer aggregation
View Dusk_GeoDataFrame_aggregation.py
 import sys, csv, time from dask import dataframe as dd import geopandas as gpd import pandas as pd from shapely.wkt import loads # log/monitor performance start_time = time.time() def log(message):
Created Apr 26, 2017
Using OSMnx, pull down a network and remove "unneeded" intersections from boulevards and like, so as to not double count.
View clean_intersections.py
 import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') import geopandas as gpd import pandas as pd from shapely.geometry import Point import osmnx as ox COUNTER = 0
Created Sep 8, 2015
All traffic camera locations in NYC
View traffic-cameras.json
 [{ "lat": "40.79142677512476", "lng": "-73.93807411193848", "name": "1 Ave @ 110 St", "camera": "http://207.251.86.238/cctv261.jpg" }, { "lat": "40.800426144169315", "lng": "-73.93155097961426", "name": "1 Ave @ 124 St", "camera": "http://207.251.86.238/cctv254.jpg"
Created Jun 7, 2017
Sketch of using networkx to calculate accessibility sheds
View accessibility_shed.py
 import networkx as nx import numpy as np import pandas as pd import time from dgna.utils import format_pandana_edges_nodes # read in osm data, load into top level variable osm_edges = pd.read_csv('./data/osm_edges.csv') osm_nodes = pd.read_csv('./data/osm_nodes.csv')
Created Jul 1, 2017
Run this script via: time python test_dask.py {desired_row_count_of_dfs}