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
curl -Ls http://git.io/... | tar xzs '/dmotylev-dotfiles-[a-f[:digit:]]*/dotfiles/' && dotfiles/bootstrap |
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 | |
set -o nounset | |
set -o privileged | |
set -o errtrace | |
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
readonly LOG_TS_FMT='+%Y-%m-%d %H:%M:%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/sh | |
readonly jenkins_data=/var/lib/jenkins | |
readonly jenkins_data_escaped=$(echo $jenkins_data | sed -E 's/\//\\\//g') | |
readonly filelist=$(mktemp) | |
find $jenkins_data | | |
sed -E " | |
s/^$jenkins_data_escaped\///; | |
/^${jenkins_data_escaped}$/d; |
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 bash | |
if ! [[ ${BASH_VERSINFO[0]} -ge 4 && ${BASH_VERSINFO[1]} -ge 2 ]]; then | |
echo "$(basename $0): bash version >= 4.2 required" | |
exit 1 | |
fi | |
# | |
# expands {{varname}} to varvalue | |
# |
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
#!/usr/bin/env bash | |
# original gist (javascript) https://gist.github.com/afriggeri/1266756 | |
readonly ADJECTIVES=("autumn" "hidden" "bitter" "misty" "silent" "empty" \ | |
"dry" "dark" "summer" "icy" "delicate" "quiet" "white" "cool" "spring" \ | |
"winter" "patient" "twilight" "dawn" "crimson" "wispy" "weathered" "blue" \ | |
"billowing" "broken" "cold" "damp" "falling" "frosty" "green" "long" "late" \ | |
"lingering" "bold" "little" "morning" "muddy" "old" "red" "rough" "still" \ | |
"small" "sparkling" "throbbing" "shy" "wandering" "withered" "wild" "black" \ | |
"young" "holy" "solitary" "fragrant" "aged" "snowy" "proud" "floral" \ | |
"restless" "divine" "polished" "ancient" "purple" "lively" "nameless") |
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
// Provides Write once read many (WORM) primitives | |
package worm | |
import ( | |
"sync" | |
) | |
// Object could be used to store interface{} | |
// Object is safe for concurrent usage | |
type Object struct { |
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
func TestType_TestFunc(t *testing.T) { | |
tests := []struct { | |
name string | |
wantErr bool | |
}{ | |
{"test", false}, | |
} | |
const wantTest = -1 | |
for testNo, test := range tests { |
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
func WaitShutdownRequest(f func(os.Signal)) { | |
signals := make(chan os.Signal) | |
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM) | |
f(<-signals) | |
} | |
func CleanUp(closers ...func()) { | |
for _, f := range closers { | |
f() | |
} |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"os" | |
"os/signal" | |
"path/filepath" | |
"syscall" |
OlderNewer