This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# A good generator of IPSec PSK's | |
< /dev/urandom tr -dc a-zA-Z0-9_ | head -c30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get instance-id from meta-data, if you like: | |
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
aws ec2 describe-instances \ | |
--instance-id $INSTANCE_ID \ | |
--query 'Reservations[*].Instances[*].Tags[?Key==`aws:cloudformation:stack-name`].Value' \ | |
--output text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copy data from a Time Machine volume mounted on a Linux box. | |
# | |
# Usage: copy-from-time-machine.sh <source> <target> | |
# | |
# source: the source directory inside a time machine backup | |
# target: the target directory in which to copy the reconstructed | |
# directory trees. Created if it does not exists. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Reference: https://github.com/pypa/pip/issues/3165 | |
sudo -H pip install skew --ignore-install six |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gsl' | |
require 'time' | |
module Diskalerter | |
class ThresholdEstimator | |
attr_reader :timestamps, :signal, :threshold, :now | |
# timestamps - a list of timestamps in epoch milliseconds | |
# signal - a list of values for the provided timestamps | |
# threshold - the "exhaustion" threshold (e.g., 100 for a percentage signal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fetch the S3 prefix list ID's for S3 in all AWS regions. | |
# These are can then be used as destinations in route tables | |
aws ec2 describe-regions --query 'Regions[*].RegionName' | \ | |
jq -r '.[]' | \ | |
while read REGION | |
do | |
echo ==== $REGION ==== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
aws ec2 describe-vpc-endpoints --region ap-southeast-2 | \ | |
jq -r '.VpcEndpoints[].PolicyDocument' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uses jq to extract data from JSON | |
aws ec2 describe-regions | \ | |
jq -r '.Regions[] | .RegionName' | \ | |
while read i | |
do | |
echo ==== $i ==== | |
aws ec2 describe-availability-zones --region $i | \ | |
jq -r '.AvailabilityZones[] | .ZoneName' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you're looking into the C10M problem (10 million concurrent connections) | |
# you might want to play with DPDK (Originally proprietry Intel, now open source) | |
# | |
# C10M: http://c10m.robertgraham.com/ | |
# DPDK: http://dpdk.org/ | |
# | |
# This is a quick summary how to install dpdk on ubuntu | |
# running inside virtualbox on a mac | |
# On my Mac: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws rds describe-db-snapshots --region=us-east-1 | \ | |
jq '.DBSnapshots | .[] | .AllocatedStorage' | \ | |
awk '{s+=$1}END{print s}' | |