Skip to content

Instantly share code, notes, and snippets.

View bushong1's full-sized avatar

Charles Bushong bushong1

View GitHub Profile
@bushong1
bushong1 / .gitconfig
Created December 23, 2014 21:48
Charles' gitconfig lg
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
[color]
ui = auto
@bushong1
bushong1 / npmdeps.sh
Last active August 29, 2015 14:14
Determine full npm dependencies of a node.js package.
#Add to .bashrc
#Usage: npmdeps <package>[@<version>]
function npmdeps {
regex="^[- |]*$"
regex_space="^ *$"
regex_github="github\.com"
if [[ "$1" =~ $regex ]]; then
return
else
DEPS=`npm info $1 dependencies|perl -0777 -pe 's/^.*{//gs'|perl -0777 -pe 's/}.*$//gs'| sed "s/[\{\}' ]//g" | sed 's/, \?/\n/g' | sed "s/:/@/g"`
@bushong1
bushong1 / git.sh
Last active August 29, 2015 14:15
Git submodule management
#add new dependency
cd github-mirror
git submodule add <url/ssh> <namespace>/<project-name>/<branch>
cd <namespace>/<project-name>/<branch>
git checkout <branch>
cd ..
git add <branch>
git commit -m "Adding <namespace>/<project-name>/<branch>"
cd <branch>
@bushong1
bushong1 / Bowerfile
Created October 23, 2015 01:27
shine through chapter 6
asset 'bootstrap-sass-official'
asset 'angular', '~> 1.4'
#asset 'angular-mocks'

Keybase proof

I hereby claim:

  • I am bushong1 on github.
  • I am charlesbushong (https://keybase.io/charlesbushong) on keybase.
  • I have a public key whose fingerprint is F770 07AF 538B 48F9 BF1B 4672 6A1E 5661 6626 23F0

To claim this, I am signing this object:

@bushong1
bushong1 / .bashrc
Created November 17, 2017 14:18
A BASH function to shortcut removing an AMI and it's associated Snapshots
function aws-rm-ami-snap() {
if [[ ${1} == ami-* ]]; then
AMI_ID=${1}
SNAPSHOT_IDS=$(aws ec2 describe-images --filters Name=image-id,Values=${1} | jq '.Images[].BlockDeviceMappings[].Ebs.SnapshotId' | sed 's/"//g')
aws ec2 deregister-image --image-id ${AMI_ID}
for snapshot_id in ${SNAPSHOT_IDS}; do
aws ec2 delete-snapshot --snapshot-id ${snapshot_id}
done
else
echo "ERROR: Require \$1 to be an AMI ID, starting with 'ami-'"
@bushong1
bushong1 / centos-7-user-data.yml
Last active January 22, 2018 18:25
A gist to run a dockerize papertrail container for reporting ECS container logs
Parameters:
PapertrailEndpoint:
Type: String
Default: logsX.papertrailapp.com:XXXXX
Resources:
LaunchConfig:
Properties:
...
UserData:
Fn::Base64: !Sub |
@bushong1
bushong1 / entrypoint.sh
Created July 26, 2018 13:13
Docker Entrypoint to pull in ParameterStore variables and S3 Buckets
#!/bin/bash -e
# Usage:
# 1) Build the AWS CLI into your container
# 2) Set your region, or pass env into the container
export AWS_DEFAULT_REGION=us-east-1
function usage () {
echo "Usage: Container must be run with the following environment variables:
ARG MY_ARG
RUN : "${MY_ARG:?ERROR - MY_ARG Build argument needs to be set and non-empty.}"