Skip to content

Instantly share code, notes, and snippets.

Working from home

Matthew Emes memes

Working from home
View GitHub Profile
# Verify GCP service account default authentication status on VM
echo "$0: INFO: $*" >&2
View .pre-commit-hooks.yaml
- id: talisman-commit
name: talisman
entry: talisman --githook pre-commit
stages: [commit]
# talisman currently discovers files by itself and does not take them on the cli
pass_filenames: false
types: [text]
language: system
- id: talisman-push
memes /
Last active Apr 28, 2021
Vault OIDC configuration workaround for hashicorp/terraform-provider-vault#957
resource "vault_policy" "admin" {
name = "admin"
policy = <<EOP
# Manage auth methods broadly across Vault
path "auth/*"
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
# Create, update, and delete auth methods
memes / .envrc
Last active Apr 17, 2020
New automation project files
View .envrc
# Use the virtualenv defined for this project
layout virtualenvwrapper VENV_NAME
unset PS1
memes / .bashrc.osx
Last active Mar 10, 2020
Mac OS shell settings
View .bashrc.osx
#-*- mode: sh -*-
# Setup history control
shopt -s histappend
shopt -s checkwinsize
# Default prompt is user@host
PS1='\[\033[0;32m\]\u@\h\[\033[0m\]:\[\033[0;31m\]\w\[\033[00m\]\$ '
memes / cloud-iot-pre-request-auth.js
Last active May 12, 2018
Google Cloud IoT authentication for Postman
View cloud-iot-pre-request-auth.js
// Keep jsrsasign libs assume they are working in a browser; fake these out..
var navigator = {
appName: "Cloud IoT test script"
var window = {};
// Make sure that jsrsasign is in scope
// Cloud IoT HTTP URL is of form:{project-id}/locations/{location}}/registries/{registry}/devices/{device-id}/...
memes / .bashrc
Last active Jun 16, 2018
Termux .profile and .bashrc as used on chromebook, which automatically goes into a chroot to make me feel more at home.
View .bashrc
# Configure bash shell for chromebook
shopt -s histappend
shopt -s checkwinsize
_MEMES_IP=$(ip addr show dev arc0 | gawk '{ if (match($0, /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/, m)) print m[1]}')
PS1='\[\033[01;32m\]\u@${_MEMES_IP}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
[ -f ~/bin/ ] && . ~/bin/
[ -f ~/.bash_memes ] && . ~/.bash_memes
memes / azure-auth-postman.js
Created Jul 13, 2017
Postman pre-request script to add Azure auth token to environment
View azure-auth-postman.js
var encodedURL = encodeURIComponent(postman.getGlobalVariable("baseURL")).toLowerCase();
var expiration = Math.ceil(( / 1000) + 3600);
var realKey = postman.getGlobalVariable("sharedAccessKey");
var token = encodedURL + '\n' + expiration;
var sig = CryptoJS.HmacSHA256(token, realKey);
var encodedSig = encodeURIComponent(CryptoJS.enc.Base64.stringify(sig));
var authToken = "SharedAccessSignature sr=" + encodedURL + "&sig=" + encodedSig + "&se=" + expiration + "&skn=" + postman.getGlobalVariable("sharedAccessKeyName");
postman.setGlobalVariable("authToken", authToken);
View gist:e6303829104d25348350
Verifying that +matthewemes is my blockchain ID.
memes /
Created Sep 29, 2015
Shell script to add deployment key to all repos owned by team
# Add a deployment key to all repos for all team repos
# Edit/override these to correct settings