Skip to content

Instantly share code, notes, and snippets.

View memes's full-sized avatar
☁️
Working in the cloud

Matthew Emes memes

☁️
Working in the cloud
View GitHub Profile

Keybase proof

I hereby claim:

  • I am memes on github.
  • I am memes (https://keybase.io/memes) on keybase.
  • I have a public key whose fingerprint is DA93 ED21 9B28 F77E 3FBB 8620 A659 3790 E1AD CDE1

To claim this, I am signing this object:

@memes
memes / bb_repo_add_deploy_key.sh
Created September 29, 2015 22:58
Shell script to add deployment key to all repos owned by team
#!/bin/sh
#
# Add a deployment key to all repos for all team repos
# Edit/override these to correct settings
BB_TEAM=${BB_TEAM:-'teamname'}
BB_API_KEY=${BB_API_KEY:-'api_key'}
BB_PUBKEY=${BB_PUBKEY:-'./key.pub'}
BB_KEY_LABEL=${BB_KEY_LABEL:-'label'}
@memes
memes / gist:e6303829104d25348350
Created February 26, 2016 18:43
Onename verification
Verifying that +matthewemes is my blockchain ID. https://onename.com/matthewemes
@memes
memes / azure-auth-postman.js
Created July 13, 2017 01:03
Postman pre-request script to add Azure auth token to environment
var encodedURL = encodeURIComponent(postman.getGlobalVariable("baseURL")).toLowerCase();
var expiration = Math.ceil((Date.now() / 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);
@memes
memes / cloud-iot-pre-request-auth.js
Last active May 12, 2018 20:22
Google Cloud IoT authentication for Postman
// 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
eval(postman.getEnvironmentVariable('jsrsasign'));
// Cloud IoT HTTP URL is of form: https://cloudiotdevice.googleapis.com/v1/projects/{project-id}/locations/{location}}/registries/{registry}/devices/{device-id}/...
@memes
memes / .bashrc
Last active June 16, 2018 05:28
Termux .profile and .bashrc as used on chromebook, which automatically goes into a chroot to make me feel more at home.
# Configure bash shell for chromebook
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
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/git-prompt.sh ] && . ~/bin/git-prompt.sh
[ -f ~/.bash_memes ] && . ~/.bash_memes
@memes
memes / .bashrc.osx
Last active March 10, 2020 22:10
Mac OS shell settings
#-*- mode: sh -*-
# Setup history control
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
# Default prompt is user@host
PS1='\[\033[0;32m\]\u@\h\[\033[0m\]:\[\033[0;31m\]\w\[\033[00m\]\$ '
@memes
memes / .envrc
Last active April 17, 2020 20:18
New automation project files
# Use the virtualenv defined for this project
layout virtualenvwrapper VENV_NAME
unset PS1
- 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
memes / sa_auth_status.sh
Created November 24, 2021 16:54
Standalone GCP service account tester based on embedded script in https://github.com/memes/terraform-google-sa-scopes-demo/blob/main/main.tf
#!/bin/sh
#
# Verify GCP service account default authentication status on VM
info()
{
echo "$0: INFO: $*" >&2
}
error()