Short name | Full name |
---|---|
csr | certificatesigningrequests |
cs | componentstatuses |
cm | configmaps |
ds | daemonsets |
deploy | deployments |
ep | endpoints |
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
while [[ "${#}" -gt 0 ]]; do | |
case "${1}" in | |
-i|--inventory) INVENTORY="${2}"; shift 2;; | |
-h|--help) display_help; exit 1;; | |
esac | |
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
FROM golang@sha256:2b3ca6f02d74eaf6f2d1788a16c1ccf551fe2407cb457636f3826f0108fed8ff AS stage-build | |
WORKDIR "/go/src/package" | |
RUN apk update && apk add dep git | |
COPY Gopkg.* ./ | |
RUN dep ensure --vendor-only | |
COPY main.go . | |
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \ | |
go build \ |
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
signalChannel := make(chan os.Signal, 1) | |
signal.Notify(signalChannel, os.Interrupt) | |
go func(){ | |
for sig := range signalChannel { | |
// fmt.Println(sig) | |
} | |
}() |
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
# Git log: | |
# | |
# am3xn47 'fixup! Add file B' | |
# 302mx47 'Add file B' | |
# xn4273x 'Add file A' | |
NON_FIXUP_HEAD_COMMIT="$( | |
git log --oneline | |
| grep --invert-match 'fixup' | |
| head -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
# Origin: https://github.com/engineer-man/youtube/blob/master/058/commands.sh | |
# 6. Tunnel with ssh (local port 3337 -> remote host's 127.0.0.1 on port 6379) | |
ssh -L 3337:127.0.0.1:6379 root@emkc.org -N |
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
GIT_TAG="$( git describe --abbrev=0 )" | |
GIT_HASH="$( git rev-parse HEAD )" | |
BUILD_DATE="$( date +%F )" # Note: An ldflag cannot contain whitespace | |
REPO="github.com/user/repo" | |
OUTPUT_NAME="build-artifact" | |
PACKAGE="main.go" | |
read -r -d '' LDFLAGS << EOM | |
-X ${REPO}/cmd.gitVersionTag=${GIT_TAG} |
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
docker run \ | |
-v pypi-cache:/var/lib/nginx/pypi \ | |
-v $(pwd)/nginx.conf:/etc/nginx/nginx.conf \ | |
-p 7777:80 \ | |
nginx |
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
spec: | |
template: | |
metadata: | |
labels: | |
app.kubernetes.io/name: {{ .Release.Name }} | |
annotations: | |
configChecksum: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
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
type Spinlock struct { | |
state *int32 | |
} | |
const free = int32(0) | |
func (l *Spinlock) Lock() { | |
for !atomic.CompareAndSwapInt32(l.state, free, 42) { // 42 or any other value but 0 | |
runtime.Gosched() // Poke the scheduler | |
} |
OlderNewer