Skip to content

Instantly share code, notes, and snippets.

@kevhill
kevhill / aws_mfa.sh
Created May 20, 2021 22:47
source this to ask for an MFA code, then load aws session tokens into env
#!/bin/bash
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
MFA_ARN=$(aws sts get-caller-identity --output json | jq -r '.Arn' | sed 's/user/mfa/g')
echo Enter your MFA code
read MFA_CODE
@kevhill
kevhill / nan_compare.py
Last active July 8, 2017 20:55
I ran into a barrier trying to cross correlate two matrices with missing values. I had to work our how to do that in a memory/cpu efficient way, and this is the best I could come up with.
import numpy as np
import copy
def nan_cov(X, preserve_input=True):
# we need to mutate input to fill nan's with 0's
# if we need to use the input later, we need to use a copy now
if preserve_input:
X = copy.deepcopy(X)