Skip to content

Instantly share code, notes, and snippets.

View dfevre's full-sized avatar

David Fevre dfevre

View GitHub Profile
@dfevre
dfevre / iam-assume-role.sh
Created May 25, 2017 03:14 — forked from ambakshi/iam-assume-role.sh
Assume an IAM role. An interesting way of doing IAM roles is to give the instance permissions to assume another role, but no actual permissions by default. I got this idea while setting up security monkey: http://securitymonkey.readthedocs.org/en/latest/quickstart1.html#setup-iam-roles.
#!/bin/bash
#
# Assume the given role, and print out a set of environment variables
# for use with aws cli.
#
# To use:
#
# $ eval $(./iam-assume-role.sh)
#
@dfevre
dfevre / aws_env
Last active March 4, 2019 21:32 — forked from mjul/aws_env
Get environment variables from AWS profile (for use with docker-machine)
# The following is a ~/.zshrc function that exports an aws cli profile from ~/.aws/credentials to environment variables.
aws_env() {
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id --profile "$1");
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key --profile "$1");
export AWS_SESSION_TOKEN=$(aws configure get aws_session_token --profile "$1");
export AWS_SECURITY_TOKEN=$(aws configure get aws_security_token --profile "$1");
export AWS_DEFAULT_REGION=$(aws configure get region --profile "$1");
echo "$1 environment variables exported";
}
@dfevre
dfevre / Git Commit Message.sublime-settings
Last active March 25, 2021 20:17
A settings file for Sublime Text to help format git commit messages with subject headings and line wrapping.
// This is the settings file for git commit messages in Sublime Text inspired by http://chris.beams.io/posts/git-commit/.
// These settings will help assist in formatting git commit messages with the following -
// * Subject lines should be no more than 50 characters.
// * Other lines should wrap at 72 characters.
//
// It makes use of the AutoWrap package (https://github.com/randy3k/AutoWrap) to hard wrap lines.
//
// These settings put vertical rulers ar 50 chars and 72 chars and will hard wrap at 72 chars.
// These settings will only affect git commit messages because it is a syntax specific settings file.
//
@dfevre
dfevre / gitaliases
Last active May 19, 2017 06:45
Favourite git aliases
git config --global alias.lg "log --graph --pretty=format:'%C(bold blue)%h%C(reset) -%C(auto)%d%Creset %C(white)%s%C(reset) %Cgreen(%cr) %C(dim white)%an%Creset' --abbrev-commit --date=relative"
# this one sets Notepad++ as the git editor on Windows. Requires the npp.sh file from https://gist.github.com/3735365#file_npp.sh
git config --global core.editor ~/npp.sh
@dfevre
dfevre / .bash_profile
Created September 17, 2012 03:12
Favourite Cygwin bash scripts
# This will setup the colour and format of the Cygwin prompt and include git branch info.
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"