Skip to content

Instantly share code, notes, and snippets.

Petr Michalec epcim

Block or report user

Report or block epcim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
epcim /
Last active Jan 10, 2020
elasticsearch troubleshooting elastic

identify kubernetes pods with docker overlay2

(not the best output, but works)

TOP_STORAGE=$(du -hs /var/lib/docker/overlay2/* | grep -Ee '^[0-9]{3}[M]+|[0-9]G' | sort -h |tail -n 10 |tee -a /dev/stderr |awk '{print $2}'|xargs|sed 's/ /|/g')

docker inspect $(docker ps -q) | jq '.[]|.Config.Hostname,.Config.Labels."",.GraphDriver.Data.MergedDir,.hovno' | egrep -B2 "$TOP_STORAGE"

docker image inspect $(docker images -aq) | jq '.[]|.RepoDigests[0],.GraphDriver.Data.MergedDir,.hovno' |egrep -B2 "$TOP_STORAGE" 
epcim /
Last active Jan 7, 2020
kubernetes job
kubectl get job -n sre kibana-config -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | kubectl replace --force -f -
epcim /
Last active Jan 3, 2020
strace debug
strace -f -o /tmp/strace.log -s 2048 -p 1 & systemctl restart postgresql.service
#Then, after a couple of seconds, fg into the strace process, cancel it, and then
#see it the strace.log helps.
strace -e trace=open,read ls /home
strace $(pidof apache2 | sed 's/\([0-9]*\)/\-p \1/g')
epcim /
Last active Oct 23, 2019
git howto usage guide

Various GIT usage tutorials/examples


git config core.trustctime false
git core.filemode false

git config "Alice Bob"
git config
epcim /
Last active Sep 30, 2019
trusted certificates system update-ca-certificates

Adding trusted root certificates to the server

Mac OS X

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-certificate.crt
sudo security delete-certificate -c "<name of existing certificate>"


certutil -addstore -f "ROOT" new-root-certificate.crt
epcim / hab clustered etcd
Created Sep 16, 2019
etcd habitat docker-compose hab
View hab clustered etcd
# See more:
# hab clustered etcd
## compose
cat <<EOF > docker-compose.yml
version: '3'
epcim /
Last active Sep 16, 2019
hab habitat hab-sup deployment etcd

Simple deployment script to install habitat container with the app as systemd service.

export ALT=500 # Prefix for all the service names/ports used (apply to habitat/ inner service service)
# cleanup
systemctl stop etcd-$ALT
sleep 3
rm -f /etc/systemd/system/etcd-$ALT.service /etc/default/etcd-$ALT*
rm -rf /srv/etcd-$ALT
epcim /
Created Mar 31, 2017
keybase github git gpg pgp
epcim /
Created Aug 26, 2019 — forked from rgl/
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check
You can’t perform that action at this time.