Quirks & tips

  • Get all the DNS domains associated with a TLS certificate:
$ echo | openssl s_client -connect ${DOMAIN?}:443 2>/dev/null | openssl x509 -noout -bash | grep DNS | sed -e 's/,/\n/g' -e 's/ //g'
  • Kubernetes namespace stuck in “Terminating” state:
$ kubectl proxy &
$ kubectl get namespace ${NAMESPACE?} -o json |jq '.spec = {"finalizers":[]}' >temp.json
$ curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/${NAMESPACE?}/finalize
  • Apply Terraform outputs only (source):
$ terraform apply -refresh-only
  • Push an empty Git commit to remote:
$ git commit --allow-empty -m "chore: trigger CI"
  • Update file access control for the Docker socket:
$ sudo setfacl --modify user:${USER?}:rw /var/run/docker.sock
  • Get process name of a window in X11:
$ xwininfo | grep "Window id:" | cut -d " " -f 4 | xargs xprop -id | grep _NET_WM_PID | cut -d " " -f 3 | xargs ps -o comm= -p
  • Generate a passphrase:
$ echo $(tr -dc 'A-Za-z0-9!@#?%=&' < /dev/urandom | head -c 32)
  • Kill what’s listening on port 8080:
$ lsof -ti:8080 | xargs kill -9