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 / 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'
@kiwidamien
kiwidamien / elections.csv
Created September 28, 2018 06:16
Election results by state since 1952
year state votes candidate party short_state
2016 Alabama 729547 Clinton, Hillary Democratic AL
2016 Alaska 116454 Clinton, Hillary Democratic AK
2016 Arizona 1161167 Clinton, Hillary Democratic AZ
2016 Arkansas 380494 Clinton, Hillary Democratic AR
2016 California 8753788 Clinton, Hillary Democratic CA
2016 Colorado 1338870 Clinton, Hillary Democratic CO
2016 Connecticut 897572 Clinton, Hillary Democratic CT
2016 Delaware 235603 Clinton, Hillary Democratic DE
2016 Florida 4504975 Clinton, Hillary Democratic FL