Skip to content

Instantly share code, notes, and snippets.

@baratrion
baratrion / test_flow.py
Created Feb 2, 2021
Line-by-line memory profiling for Metaflow
View test_flow.py
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 Jun 22, 2021
Install Terraform & Packer on Linux
View install-terraform-packer-os-x.sh
#!/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 ~
View states_hash.json
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
View min-cut.js
// 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;