Skip to content

Instantly share code, notes, and snippets.

@quandyfactory
quandyfactory / get_sobi_data.py
Last active October 23, 2019 15:34
Fetch SoBi Rides Data
#!/usr/bin/env python
# coding: utf-8
"""
This script downloads your Social Bicycles (SoBi) routes data from the SoBi web
API and saves it as a JSON file. It uses HTTP basic authentication with your SoBi
username (your email address) and password.
The function that requests route data executes recursively, incrementing the page
parameter with each subsequent request, until there are no more results.
#!/usr/bin/env python
# coding: utf-8
"""Calculates kinetic energy for a moving object at a given mass and speed"""
import locale
locale.setlocale(locale.LC_ALL, '')
objects = (
{'name': 'Bicycle', 'mass': 100,},
@quandyfactory
quandyfactory / tweet.json
Last active August 29, 2015 14:09
JSON representation for Tweet ID 532191393062854656
{
"created_at":"Tue Nov 11 15:21:30 +0000 2014",
"id":532191393062854656,
"id_str":"532191393062854656",
"text":"Empty parking spaces in city-owned John\/Rebecca lot. We need affordable housing, not cheap parking @greg_tedesco http:\/\/t.co\/91JnJLNlwL",
"source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e",
"truncated":false,
"in_reply_to_status_id":null,
"in_reply_to_status_id_str":null,
"in_reply_to_user_id":null,
@quandyfactory
quandyfactory / get_fringe_plays.py
Created July 29, 2014 23:46
get_fringe_plays.py
#!/usr/bin/env python
"""Code I used to download all the details for the 2014 Hamilton Fringe Festival plays and convert them into a JSON file."""
from bs4 import BeautifulSoup as bs
import json
import requests
import xlrd
base_url = 'http://hamiltonfringe.ca/shows/'
@quandyfactory
quandyfactory / janeswalk.markdown
Last active August 29, 2015 14:00
My talking notes for this Saturday's Jane's Walk along James Street South, Hamilton, Otario.

Jane's Walk: James Street South

"Cities need old buildings so badly it is probably impossible for vigorous streets and districts to grow without them. ... Old ideas can sometimes use new buildings. New ideas must use old buildings."

Walk starts at the Queen Victoria statue, Gore Park, at Noon.

Three Tales of a Street

  • Amid all the observations, anecdotes and asides
  • Three distinct stories about James Street South:
@quandyfactory
quandyfactory / hamiton police snow advisory 2014-02-05.txt
Created February 5, 2014 19:19
Hamilton Police Service declare a Snow Advisory Warning for February 5, 2014
Snow Advisory Warning Declared
For Immediate release: February 5th, 2014
Hamilton, ON – The Hamilton Police Service (HPS) is advising motorists in Hamilton what the expectations and responsibilities are during a snow advisory warning with the appropriate procedures to follow:
Snow Advisory Warning
* City of Hamilton Transportation contacts HPS issuing snow warning
* HPS issues warning to public through media
@quandyfactory
quandyfactory / police board email chain
Created June 26, 2013 17:20
Chain of emails including Hamilton Police Board Chair Nancy DiGregorio, Police Board lawyer Lynda Bordeleau and assistant City lawyer Ron Sabo on the legality of Council appointing a Councillor to the Board on a temporary basis.
From: Merulla, Sam
Sent: Wednesday, June 26, 2013 12:55 PM
To: Bishop, Kathy; DL - Council Only
Cc: DL - SMT Only
Subject: Re: City of Hamilton Temporary Appointment to the Police Services Board,
Your Reference: HPB008
Please include this item under correspondence for tonight's Council meeting. I will
be requesting a formal retraction and apology for the irresponsible suggestion that
@quandyfactory
quandyfactory / fiveoclocksomewhere.py
Last active December 16, 2015 10:39
It's 5 O'Clock Somewhere: This script tells you the nearest time zone in which it's after 5 o'clock PM.
#!/usr/bin/env python
"""This script tells you the nearest time zone in which it's after 5 o'clock PM."""
import datetime
def get_beer_timezone():
now = datetime.datetime.today()
print("The curent time is %s." % (str(now)[11:-7]))
@quandyfactory
quandyfactory / permits.py
Last active December 12, 2015 06:19
Fetches geocode lat and lng for Hamilton building permits
import xlrd
import json
import urllib
path = 'permits.xls'
outfile = 'permits.csv'
template = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
def get_data(path=path):
"""Gets the records from the excel file"""