Skip to content

Instantly share code, notes, and snippets.

View kiwidamien's full-sized avatar
Will code for caffeine

Damien Martin kiwidamien

Will code for caffeine
  • StitchFix
  • San Francisco, CA
View GitHub Profile
@kiwidamien
kiwidamien / geocode.py
Created February 18, 2026 18:54
Geocoding in NZ
import requests
import urllib.parse
def geocode(address_number, full_road_name, town_city, api_key):
base = "https://data.linz.govt.nz/services"
layer = "layer-105689"
cql = f"address_number={address_number} AND full_road_name ILIKE '%{full_road_name}%' AND town_city ILIKE '%{town_city}%'"
url = f"{base};key={api_key}/wfs"
@kiwidamien
kiwidamien / README
Last active July 8, 2020 20:32
Sarah Connor
A couple of images
@kiwidamien
kiwidamien / styling_example.ipynb
Created November 5, 2019 08:45
An example of Styling Pandas DataFrames
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kiwidamien
kiwidamien / category_encoders_gist.ipynb
Created August 26, 2019 04:57
Category Encoders companion gist
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kiwidamien
kiwidamien / unbalanced.ipynb
Created May 9, 2019 07:00
Example of cross-validation with unbalanced data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
# This is a pre-commit hook that ensures attempts to commit files that
# are larger than 100 MB to your _local_ repo fail, with a helpful error
# message. This is the python version.
#
# This prevents the local repo from getting out of sync with the Github
# repo. To install
# 1) Install gitpython
# $ pip install gitpython
@kiwidamien
kiwidamien / pre-commit
Last active February 5, 2023 10:59
Github pre-commit hook to prevent commits of large files
#!/bin/sh
# This is a pre-commit hook that ensures attempts to commit files that
# are larger than 100 MB to your _local_ repo fail, with a helpful error
# message.
#
# This prevents the local repo from getting out of sync with the Github
# repo. To install
# 1) Change this file to executable:
# $ chmod a+x pre-commit
import requests
import base64
def base64_encode_string(s):
return base64.b64encode(s.encode()).decode()
class MyAPI:
def __init__(self, token_url, client_id, client_secret):
@kiwidamien
kiwidamien / OAuth2_Example.py
Created October 14, 2018 17:04
Showing how to use OAuth2 using Spotify as an example
import requests
import base64
import pprint
# You need to register an "app" on Spotify and
# go to your dashboard at
# https://developer.spotify.com/dashboard/applications
# to get the client id and client seceret
CLIENTID = 'YOUR_CLIENT_ID'