Skip to content

Instantly share code, notes, and snippets.

View mathcass's full-sized avatar
👋

Cass mathcass

👋
View GitHub Profile
@mathcass
mathcass / aedeploy.sh
Created January 19, 2018 22:01
A generic AppEngine deploy script
#!/bin/bash
# Deploys application to default service setting version to current time, thus
# mimicking how `gcloud app deploy` works
APP="$PROJECT_NAME" # Or, just replace with your project
VERSION=$(date +%Y%m%dt%H%M%S) # ${year}${month}${day}t${24hour}${minute}${second}
gcloud config set project "$APP"

I hereby claim:

  • I am mathcass on github.
  • I am mathcass (https://keybase.io/mathcass) on keybase.
  • I have a public key ASBURwDb_4-jp5hUjLFgtQbaLz9CbS1fMxQL3pNEFfZO2go

To claim this, I am signing this object:

{
@mathcass
mathcass / run.py
Created February 14, 2016 02:56
A simple example demonstrating how to use the Python memory_profiler package.
#!/usr/bin/env python
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
@profile
def infinite_loading():
"""Exceeds available memory"""
train = pd.read_csv('big.csv')
@mathcass
mathcass / Makefile
Last active February 14, 2016 02:57
This is a simple Makefile spec that allows you to transform every .tsv file in your current directory to a .csv with a given tsv2csv python script
# You can call this with:
# make -j N all_csv
# where N can be the number of processors you wish to use in parallel
# This Make rule uses the Python script `tsv2csv.py` to turn the first argument (the .tsv file) and dumps it to the output file
%.csv: %.tsv
python tsv2csv.py $< > $@
# This gets all files in this directory that end in .tsv
@mathcass
mathcass / equivalence.py
Last active February 14, 2016 02:58
A simple brute-force algorithm to create equivalence classes of a collection based on an equivalence relation.
def build_equivalence_classes(a_collection, comparer):
"""Given a collection of items that can be compared,
and a comparer for those items, return a new collection
of sublists that are equivalence classes of items in the
original collection.
"""
classes = []
accounted_for = [False] * len(a_collection)