This file contains hidden or 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 ( | |
"fmt" | |
"log" | |
"sync" | |
) | |
/* | |
This is an example of a worker pattern for channels |
This file contains hidden or 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
# install kube-ps1 from https://github.com/jonmosco/kube-ps1 | |
alias sn="kubectl config set-context --current --namespace" # switch namespace | |
# setup bash prompt | |
source "/usr/local/opt/kube-ps1/share/kube-ps1.sh" && k8s='$(kube_ps1)' # k8s cluster | |
export PS1="\n\n π¦" # headgehog | |
export PS1="$PS1\nβββββββ―β π° \t βββββββββββββββββββββββββ" # headgehog | |
export PS1="$PS1\nβ git β \$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')" # git branch | |
export PS1="$PS1\nβ k8s β $k8s" # k8s info |
This file contains hidden or 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
/* | |
Waits for a terminate | interrupt signal, ctrl-c before finishing main | |
when creating services and adapters, I like to return a cleanup function that is deferred for | |
each service, thus when the app closes they are teared down in reverse order. | |
graceful.Exit() returns two functions: | |
- waitFor - which is called as the last statement of main. This will block until a signal to terminate or interrupt the executable. | |
- deferMe - defer this first before the service cleanups. This ensures thar stdout/err are flushed and sleeps 1 second before exiting. |
OlderNewer