Skip to content

Instantly share code, notes, and snippets.

View alanwill's full-sized avatar
🤔
Thinking

Alan Williams alanwill

🤔
Thinking
View GitHub Profile
@alanwill
alanwill / configure-pat.sh
Created July 27, 2014 04:12
Script used in AWS EC2 to enable an instance to perform port address translation (PAT). Found in /usr/local/sbin/configure-pat.sh
#!/bin/bash
# Configure the instance to run as a Port Address Translator (PAT) to provide
# Internet connectivity to private instances.
function log { logger -t "vpc" -- $1; }
function die {
[ -n "$1" ] && log "$1"
log "Configuration of PAT failed!"
exit 1
#!/usr/bin/env ruby
require 'aws-sdk'
if ARGV.length < 5
print <<-EOF
Usage: mfa-delete.rb <bucket_name> <aws_id> <aws_secret> <mfa_serial> <mfa_token> <s3_endpoint>
<s3_endpoint> is optional
EOF
exit
end
@alanwill
alanwill / gist:c2f7ed88e765e530f24b
Created October 14, 2015 04:51 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@alanwill
alanwill / s3-bucket-size
Created December 5, 2015 20:26
Count the size of an S3 bucket
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
@alanwill
alanwill / s3-bucket-move
Created December 5, 2015 20:27
Move an S3 bucket to a different region
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
@alanwill
alanwill / 0_reuse_code.js
Created January 16, 2016 17:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@alanwill
alanwill / install-docker-cs-engine1-10.sh
Last active March 8, 2017 07:03
Install latest Docker CS Engine 1.10 on ubuntu. This assumes that `linux-image-extra-virtual` is already installed.
#!/bin/bash
curl -s 'https://sks-keyservers.net/pks/lookup?op=get&search=0xee6d536cf7dc86e2d7d56f59a178ac6c6238f52e' | apt-key add --import
apt-get update -y && apt-get install apt-transport-https -y
echo "deb https://packages.docker.com/1.10/apt/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list
apt-get update -y && sudo apt-get install docker-engine -y
service docker start
usermod -a -G docker ubuntu
@alanwill
alanwill / install-docker-os-engine.sh
Created February 22, 2016 19:45
Install Docker OS (Open Source) Engine on ubuntu. This assumes that `linux-image-extra-virtual` is already installed
#!/bin/bash
apt-get update -y
apt-get install apt-transport-https ca-certificates -y
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
rm -f /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list
apt-get update -y
@alanwill
alanwill / api-gateway-mapping-template.json
Created April 3, 2016 06:34
AWS API Gateway Mapping Template
{
"body" : $input.json('$'),
"headers": {
#foreach($header in $input.params().header.keySet())
"$header": "$util.escapeJavaScript($input.params().header.get($header))" #if($foreach.hasNext),#end
#end
},
"method": "$context.httpMethod",
"params": {
@alanwill
alanwill / gist:71d212d25b2061d78168ba2201187e17
Created May 11, 2016 00:08
Lambda code update with AWS CLI
aws lambda update-function-code --function my-lambda-function --zip-file fileb://lambda-package.zip