Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
IAM_GROUP=${1:-admins} | |
EKS_ROLE_ARN=${2:-arn:aws:iam::111122223333:role/eks-node-role} | |
RBAC_GROUP=${3:-system:masters} |
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift | |
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes" | |
FROM stv_blocklist | |
INNER JOIN | |
(SELECT DISTINCT id, name FROM stv_tbl_perm) names | |
ON names.id = stv_blocklist.tbl | |
GROUP BY name | |
ORDER BY "Size in Gigabytes" DESC |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
#!/usr/bin/env ruby | |
progress = 'Progress [' | |
1000.times do |i| | |
# i is number from 0-999 | |
j = i + 1 | |
# add 1 percent every 10 times | |
if j % 10 == 0 |
# post_loc.txt contains the json you want to post | |
# -p means to POST it | |
# -H adds an Auth header (could be Basic or Token) | |
# -T sets the Content-Type | |
# -c is concurrent clients | |
# -n is the number of requests to run in the test | |
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
#!/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 - |
# SSL request to hostname that is not in DNS | |
> curl -o /dev/null -w @curlformat https://beta.finance.yahoo.com | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 255k 0 255k 0 0 233k 0 --:--:-- 0:00:01 --:--:-- 233k | |
Size: 261255 | |
DNS: 0.522 | |
Connect: 0.536 |
Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
package main | |
import ( | |
"net/http" | |
) | |
type SingleHost struct { | |
handler http.Handler | |
allowedHost string | |
} |