Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
| #!/bin/bash -e | |
| echo ' | |
| PATH=$HOME/go/bin:$PATH | |
| export GOPATH=$HOME | |
| export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg | |
| export EDITOR=vim | |
| ' >> ~/.profile | |
| sudo apt-get update |
| <% | |
| require 'cgi' | |
| require 'uri' | |
| begin | |
| uri = URI.parse(ENV["DATABASE_URL"]) | |
| rescue URI::InvalidURIError | |
| raise "Invalid DATABASE_URL" | |
| end |
| package main | |
| import ( | |
| "net/http" | |
| ) | |
| type SingleHost struct { | |
| handler http.Handler | |
| allowedHost string | |
| } |
| 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 |
Getting started:
Related tutorial: http://cd64.de/mysql-cli
SQL joins infografic: http://cd64.de/sql-joins
| # 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 |
| #!/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 - |
| # 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/ |
| #!/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 |
| # 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" |