Skip to content

Instantly share code, notes, and snippets.

View grantbachman's full-sized avatar

Grant David Bachman grantbachman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am grantbachman on github.
  • I am grantbachman (https://keybase.io/grantbachman) on keybase.
  • I have a public key ASAu4SEpOInYo7HigiK6P6jxCgXgCDoZoULZyuMAd2gxiwo

To claim this, I am signing this object:

@grantbachman
grantbachman / create-k8s-service-account.sh
Last active January 30, 2018 14:34
Create k8s service account for a new user
#!/bin/bash
# I'm copying this from https://gist.github.com/so0k/8fad3b1639b3d70cd841703fda67f16b
# because I need to reference it internally at work (the other user may delete it).
# Add user to k8s 1.5 using service account, no RBAC (unsafe)
if [[ -z "$1" ]] ;then
echo "usage: $0 <username>"
exit 1
fi
// https://developer.github.com/v3/oauth/#web-application-flow
// To generate the temp code, just send a GET request with this info (just enter into browser, it'll redirect to gdb.io)
//https://github.com/login/oauth/authorize/?client_id=a120596f26ba6f3148ea&scope=public_repo,repo,repo,repo_deployment,repo:status,gist,write:repo_hook,write:org
// With Meteor
var authHeaders= {'Accept':'application/json','User-Agent':'grantbachman'}
var authData= {'client_id':'a120596f26ba6f3148ea', // This is the app id
'client_secret':'XXXXXXXXXXXXXXXXXX', // This is the app secret
'code':'XXXXXXXX'} // This is the temp code from the first step
@grantbachman
grantbachman / meteor_ebs_deploy.sh
Last active August 29, 2015 14:12
This gist is to keep track of the deployment steps to AWS EBS, there really isn't any documentation for it...
# install meteor
curl https://install.meteor.com/ | sh
# create the app and enter it
meteor create sample_app
cd sample_app
# EBS only supports Node.js version 0.10.31, so we need to downgrade
# our version of meteor so that it runs a version of Node that's supported
# Release 1.0.1 uses Node.js 0.10.29
// https://jordan-wright.github.io/blog/2014/12/30/why-deleting-sensitive-information-from-github-doesnt-save-you/
// Check all events
resp = $.getJSON('https://api.github.com/events')
// Parse the object and get the user/repo/sha1 of the commit
// Check a user's commit
resp2 = $.getJSON('https://api.github.com/repos/grantbachman/SpaceXNews/git/commits/f522653bdc8e6f3d82736d1fa2da193e90442675')
// get the tree
resp3 = $.getJSON('https://api.github.com/repos/grantbachman/SpaceXNews/git/trees/7351d575af883b1c0f9605b36effa3f40892899b')
resp4 = $.getJSON('https://api.github.com/repos/grantbachman/SpaceXNews/git/blobs/bb22acede28c229de888fcce3589b69e72488844')
@grantbachman
grantbachman / rsync.sh
Last active August 29, 2015 14:12
rsync command using .pem SSH credentials
# This command demostrates how to send a directory to a remote server that uses .pem ssh credentials
# It also excludes the virtual_env directory within source_directory.
rsync -azvv -e "ssh -i /path/to/ssh-key.pem" --exclude "virtual_env" /path/to/source_directory/ ec2-user@ec2-ip-address.region.compute.amazonaws.com:target_directory/