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
# Speed up slow apt default server | |
ENV DIST=xenial | |
RUN echo "deb mirror://mirrors.ubuntu.com/mirrors.txt $DIST main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt $DIST-updates main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt $DIST-backports main restricted universe multiverse\ndeb mirror://mirrors.ubuntu.com/mirrors.txt $DIST-security main restricted universe multiverse\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list |
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
const fs = require('fs') | |
const rocambole = require('rocambole'); | |
// Use espree instead of esprima - about twice as fast | |
const espree = require('espree'); | |
rocambole.parseFn = espree.parse; | |
rocambole.parseContext = espree; | |
const parseTime = (delta) => (delta[0] * 1000 + delta[1] / 1e6) + 'ms' |
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 | |
# Takes a parameter PREFIX and then prepends it to all stdin passed through | |
PREFIX="$1" | |
awk -v p="$PREFIX" '{ print "\033[90m[" p "]\033[0m" , $0; fflush(); }' |
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 | |
MAX_CACHE=21600 # 6 hours (sec) | |
EC2_CACHE="$HOME/.ec2_host" | |
file_age() { | |
stat -f "%Sm" -t "%s" "$1" | |
} | |
cur_time=$(date "+%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
#!/bin/bash | |
stat -f "%Sm" -t "%m-%d-%y %H:%M:%S" "$1" |
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 | |
# byte_range $start $end | |
# - Outputs the bytes between the starting and ending values from the stdin stream | |
# | |
# - $start - Starting byte to display | |
# - $end - Ending byte to display | |
isInteger() { | |
local regex_numeric='^[0-9]+$' |
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
perl -MTime::HiRes -e 'printf("%.0f\n",Time::HiRes::time()*1000)' |
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 | |
host01_temp() { | |
local key="host01.cpu.temp" | |
local temp=$(ssh stats@10.0.0.1 sensors | grep 'Physical id' | awk -F':' '{print $2 }' | awk '{print $1}' | tr -d '+' | tr -d '°C') | |
echo "$key $temp" | |
} | |
statsd `host01_temp` |
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
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 |
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
# req: prips | |
curl https://ip-ranges.amazonaws.com/ip-ranges.json \ | |
| grep -B 2 CLOUDFRONT \ | |
| grep 'ip_prefix' \ | |
| awk '{ print $2 }' \ | |
| tr -d '",' \ | |
| xargs -I{} prips {} |
NewerOlder