Skip to content

Instantly share code, notes, and snippets.

View andrhamm's full-sized avatar
:shipit:
Shipping 🔥 & ⚡️

Andrew Hammond andrhamm

:shipit:
Shipping 🔥 & ⚡️
View GitHub Profile
@andrhamm
andrhamm / deepChangeKeyCase.js
Last active November 2, 2020 16:20
Javascript Deep Change Key Case
// deeply changes the case of object keys, including in sub arrays of objects
const _ = require('lodash');
function deepChangeKeyCase(value, fn) {
if (Array.isArray(value)) {
return value.map(v => deepChangeKeyCase(v, fn));
} else if (_.isPlainObject(value)) {
return Object.entries(value).reduce((acc, [k, v]) => {
acc[fn(k)] = deepChangeKeyCase(v, fn);
return acc;
@andrhamm
andrhamm / aws-auth-mfa.sh
Last active May 16, 2022 15:49
Simple AWS CLI MFA login script
#!/bin/bash
set -eo pipefail
# Note: this script will overwrite your credentials for the `default` AWS profile, you may wish to create a backup
# Pre-requisites:
# 1) Run:
# brew install jq awscli
# 2) Add alias to .zshrc or .bashrc:
# alias aws-auth-mfa="~/.scripts/aws-auth-mfa.sh"