Skip to content

Instantly share code, notes, and snippets.

@baratrion
baratrion / test_flow.py
Created February 2, 2021 15:00
Line-by-line memory profiling for Metaflow
from functools import wraps, partial
from metaflow import FlowSpec, catch, step
def profile_memory(f):
@wraps(f)
def func(self, *args, **kwargs):
from memory_profiler import choose_backend, LineProfiler, show_results
backend = choose_backend('psutil')
@Adron
Adron / install-terraform-packer-os-x.sh
Last active June 22, 2021 20:28
Install Terraform & Packer on Linux
#!/usr/bin/env bash
# Script prerequisite > install jq > https://stedolan.github.io
# ********************************************************************************************
# UPDATE: Check out Robert's repo here https://github.com/robertpeteuil/terraform-installer
# Robert's repo is more built out and has more options around the installation process.
# Cheers! -Adron
# ********************************************************************************************
cd ~
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
// Takes an adjacency list like:
// { 1: [2, 3], 2: [1, 3], 3: [2, 1] }
function pick(arr) {
var idx = (arr.length * Math.random()) | 0;
return arr[idx];
}
function remove(arr, el){
var idx;