Skip to content

Instantly share code, notes, and snippets.

@elasticdog
elasticdog / gist:4660155
Last active December 11, 2015 21:09
AWS S3 Bucket Policy to Deny Hotlinking Images
{
"Version": "2008-10-17",
"Id": "http referer policy",
"Statement": [
{
"Sid": "Allow GET requests",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@elasticdog
elasticdog / samp
Created December 12, 2012 05:44
Copy of https://github.com/taltman/scripts/blob/master/samp, which will efficiently sample lines from a large file or infinite pipe.
#!/usr/bin/gawk -f
### samp
### Efficiently sample lines from a large file or infinite pipe.
### Table of Contents:
## * Copyright & Licensing
## * Script Documentation
## * Acknowledgments
@elasticdog
elasticdog / architecture-situation.txt
Created June 12, 2012 14:45
ocf::heartbeat:IPaddr2 FAILED
Two nodes, alice and bob that are set up to be redundant load balancers using
HAProxy. There are two floating IP address resources that need to be on the
machine for HAProxy to bind to (so only one machine will be running the HAProxy
resource at a time). Both machines are x86_64 CentOS 6.1 running corosync 1.4.1
and pacemaker 1.1.6.
alice.example.com = 172.16.32.10/24 (eth1)
bob.example.com = 172.16.32.11/24 (eth1)
@elasticdog
elasticdog / .gitconfig
Created March 2, 2012 17:36
Git Workflow
[alias]
ap = add --patch
br = branch
ci = commit --verbose
co = checkout
df = diff
ds = diff --stat
empty-tree-sha1 = hash-object -t tree /dev/null
gone = git log --diff-filter=D --summary
lc = log ORIG_HEAD.. --stat --no-merges
@elasticdog
elasticdog / tmuxx.sh
Last active September 28, 2015 15:58
tmux wrapper script
#!/bin/bash
# attach to an existing tmux session, or create one if none exist
# also set up access to the system clipboard from within tmux when possible
if [[ $OSTYPE == darwin* && -x $(command -v reattach-to-user-namespace) ]]; then
# on OS X force tmux's default command to spawn a shell in the user's namespace
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
tweaked_config=$(cat $HOME/.tmux.conf <(echo 'set-option -g default-command "reattach-to-user-namespace -l $SHELL"'))
@elasticdog
elasticdog / colortest.sh
Created March 24, 2011 22:37
256 Color Palette Numbers
#!/bin/bash
# System Colors
for line in {0..7}; do
for col in {0..1}; do
code=$(( $col * 8 + $line ))
printf $'\e[38;05;%dm %03d' $code $code
done
echo
done