This file contains 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
#!/usr/bin/env python | |
import socket | |
import json | |
import sys | |
import os | |
import re | |
from subprocess import Popen, PIPE | |
from pprint import pprint |
This file contains 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-reset () | |
{ | |
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY \ | |
AWS_SECURITY_TOKEN AWS_SESSION_TOKEN \ | |
AWS_ROLE_NAME AWS_ROLE_EXPIRATION | |
source "/etc/profile.d/aws-env.sh" | |
} | |
assume-role () |
This file contains 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 | |
DB=$1 | |
mysql -Ne "SELECT TABLE_NAME FROM TABLES WHERE TABLE_SCHEMA='$1'" INFORMATION_SCHEMA | while read TABLE; do | |
mysql -Ne "TRUNCATE \`$TABLE\`" $DB | |
done |
This file contains 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
BEGIN {FS = "|"} | |
{print "{" \ | |
"\"l_orderkey\": " $1 ", " \ | |
"\"l_partkey\": " $2 ", " \ | |
"\"l_suppkey\": " $3 ", " \ | |
"\"l_linenumber\": " $4 ", " \ | |
"\"l_quantity\": " $5 ", " \ | |
"\"l_extendedprice\": " $6 ", " \ | |
"\"l_discount\": " $7 ", " \ |
This file contains 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 | |
# OS: Ubuntu 14.01 | |
# Generate data - produces about 200GB on disk, takes a while | |
DATADIR=tpch-dbgen | |
SCALE=1000 | |
git clone https://github.com/electrum/tpch-dbgen.git | |
cd $DATADIR && make && ./dbgen -f -v -C 16 -S 1 -s $SCALE && cd - |
This file contains 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 | |
# OS: Ubuntu 14.01 | |
# Generate data - produces about 100GB on disk, takes a while | |
DBGEN_DIR=tpch-dbgen | |
SCALES=(1 10 100) | |
ORIGIN=`pwd` | |
S3_DIR="s3://your-bucket-here" | |
TABLES=(customer lineitem nation orders part partsupp region supplier) |
This file contains 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 redshift describe-clusters | jq '.Clusters[] | .NumberOfNodes' | awk '{s+=$1} END {print s}' |
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"sts:AssumeRole" | |
], | |
"Resource": [ | |
"arn:aws:iam::000123456789:role/YourRoleName" |
This file contains 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
EMP ('TOY') | |
NAME DEPT |
This file contains 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 | |
# Copies the most recent snapshot associated with one or more | |
# RDS instances from us-east-1 to us-west-1 | |
# | |
# Tested with | |
# $ aws --version | |
# aws-cli/1.11.108 Python/3.5.2 Linux/4.4.0-81-generic botocore/1.5.71 | |
# | |
# Does not work with aws-cli/1.10.x or earlier. |