Skip to content

Instantly share code, notes, and snippets.

View otterley's full-sized avatar

Michael S. Fischer otterley

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
@otterley
otterley / gist:742355
Created December 15, 2010 18:03
latin1 test
use strict;
use Test::More;
use t::Redis;
test_redis {
my $r = shift;
$r->{encoding} = 'utf8';
$r->all_cv->begin(sub { $_[0]->send });
@otterley
otterley / ssh_precopy.sh
Created May 12, 2011 17:34
ssh precopy bash script
# Those of you who frequently log in to different hosts and prefer your experience to be consistent may appreciate an "ssh precopy"
# function. The idea is that when you intend to ssh to a host, a set of files (usually dotfiles such as .profile, .gitconfig, etc.)
# that you designate is copied immediately before the actual remote login takes place.
# Simply include the function in your .profile on your "base station" (e.g., your laptop). Then edit $HOME/.briefcase; each line
# should contain a file (relative to $HOME) you want to copy.
# Store ssh(1)'s path.
__SSH="`type -path ssh 2>/dev/null`";
@otterley
otterley / tmux-cssh
Created January 18, 2012 23:03
tmux fanout
#!/bin/sh
# Usage: tmux-cssh user1@host1 user2@host2 host3 host4 host5 host6 [...]
SESSION=cssh-$$
tmux new-session -d -s $SESSION "exec ssh $1"
shift
for host in "$@"; do
tmux split-window -t $SESSION "exec ssh $host"
tmux select-layout -t $SESSION tiled >/dev/null
done
tmux set-window-option -t $SESSION status off >/dev/null
attrs_json = cookbook_file "/tmp/attrs.json" do
action :nothing
source "examples/attributes.json"
mode 00600
end
attrs_json.run_action(:create)
attrs = JSON.load(File.open("/tmp/attrs.json"))
node.consume_attributes(attrs)

Keybase proof

I hereby claim:

  • I am otterley on github.
  • I am otterley (https://keybase.io/otterley) on keybase.
  • I have a public key whose fingerprint is A02C D15E C624 0B33 5C88 43EE 01F7 123D FA61 646D

To claim this, I am signing this object:

@otterley
otterley / main.go
Created March 2, 2017 04:52
s3gof3r example
package main
import (
"compress/gzip"
"io"
"log"
"net/http"
"os"
"github.com/rlmcpherson/s3gof3r"
@otterley
otterley / policy.json
Created July 7, 2019 16:22
Example S3 instance role policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:ListBucket"
],
@otterley
otterley / vpc-endpoint-policy.json
Created July 7, 2019 16:23
Example S3-granting VPC endpoint policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:ListBucket"
@otterley
otterley / amazon-eks-controlplane.template.yaml
Created March 31, 2020 00:53
Minimal EKS cluster CloudFormation template
AWSTemplateFormatVersion: "2010-09-09"
Description: "Deploys the EKS control plane"
Parameters:
VPCID:
Description: ID of your existing VPC for deployment
Type: AWS::EC2::VPC::Id
SubnetIds:
Type: List<AWS::EC2::Subnet::Id>
KubernetesVersion:
Type: String