21zoo Labs - Assorted Stuff

Recent posts

Feb 2020
Use Gitea as a Auth Provider for oauth2_proxy
Oct 2019
Make "go get" use ssh instead of https Useful e.g. when using private repos
Sep 2019
Go Modules - How to Update All Dependencies just use "go get -u -m"
Sep 2019
How to Make a DNS Lookup in Golang code snippet
Aug 2019
Prometheus & Kubernetes - Configure to Scrape Pods How to scrape pods, not services
Aug 2019
Prometheus Mongodb Exporter - Correct DB User Permissions How to configure the DB user
Jul 2019
Postgres - Get the Current Number of Open Connections metrics
Jul 2019
Using AppEngine go112 with CloudSQL Postgres - How to set the DB URI?
Jun 2019
How to Calculate the Distance Between Two Lat,Long Points in Golang code snippet
Jun 2019
How to Run the Google Firestore Emulator Useful for local development
May 2019
How to prevent Nginx from Caching DNS for Proxy Upstreams when your upstreams change often
May 2019
Reload Nginx config inside a Docker container A useful way to avoid downtime
May 2019
Golang Sub Tests t.Run() is a great way to improve table-driven tests
May 2019
git push --force-with-lease really, use `git push --force-with-lease`
Apr 2019
Interactive Bash Shell in Kubernetes When you need a quick shell in your Kubernetes cluster
Apr 2019
How to Forward a Port to Different IP using "nc" a useful unix networking tool
Mar 2019
Delete a Tag from Docker Hub docker maintenance
Feb 2019
drone-gcf - a Google Cloud Function plugin for drone.io automation
Nov 2018
How to query Prometheus from Python code snippet
Oct 2018
Docker - Clean Up Unused Volumes docker maintenance
Oct 2018
Golang HTTP Client - How to not follow redirects code snippet
Sep 2018
Golang - Parallelize Tests You can run Golang tests in parallel by using `t.Parallel()`
Sep 2018
Crontab - run a command every 5 minutes a quick explainer
Aug 2018
Install Deluge Torrent Client on Ubuntu First, install the Deluge PPA to get the latest releases: ``` sudo add-apt-repository ppa:deluge-team/ppa sudo apt-get...
Apr 2018
How to set a default namespace for "kubectl" Use context to set a default namespace
Apr 2018
Golang Cross Compile for Linux Macos and Windows For Linux desktop: ``` $ GOOS=linux GOARCH=amd64 go build ``` For MacOS: ``` $ GOOS=darwin GOARCH=arm64 go build ``` ...
Apr 2018
How to get the SSL cert expiration date from PEM file How to get the the SSL cert expiration date from PEM file ``` openssl x509 -enddate -noout -in << pem file name >> ```
Mar 2018
Prometheus Instrumentation & Metrics Best Practices Good read from the official docs
Mar 2018
Notes on Programming in C Good read: <a href="http://doc.cat-v.org/bell_labs/pikestyle">Notes on programming in C</a> by Rob Pike. On complexity:...
Feb 2018
What was the best CS paper you read in 2017?
Jan 2018
How to Design a Scalable Rate Limiting Algorithm Link: <a href="https://konghq.com/blog/how-to-design-a-scalable-rate-limiting-algorithm/">How to Design a Scalable Rate...
Dec 2017
Django SMTP Settings for Gmail Django SMTP Settings for Gmail ``` EMAIL_USE_TLS = True EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' ...
Dec 2017
Remove or Clear Last Login Information on Linux In particular, the information returned by `lastlog` and `last`/`lastb` ``` # for lastlog rm -f /var/log/lastlog && to...
Dec 2017
Enable Swap on Ubuntu Enable Swap on Ubuntu ``` sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon...
Dec 2017
Install Docker and Docker Compose on Ubuntu Install Docker and Docker Compose on Ubuntu ``` # docker: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | s...
Nov 2017
Configure SSH to use a Jump Host Configure SSH to use a Jump Host for ssh connections: `[ Laptop ] --ssh--> [ Jump Host ] --ssh--> [ Host ]` <br> ~/.ss...
Nov 2017
How to define multiline strings in yaml/yml ``` key: > a very very long string ``` --> `"a very very long string"` And with literal newlines: ``` key: | ano...
Nov 2017
Bash Shell - Append Date to Filename Append the current date to a filename in Bash shell: ``` $ fname="/var/log/output-$(date +"%Y-%m-%d").log" $ echo $fna...
Nov 2017
Automatically Delete Docker Container After Running Automatically delete Docker container after running: ``` docker run --rm my-image ```
Nov 2017
Disable password access in sshd Disable password access in sshd /etc/ssh/sshd_config ``` ChallengeResponseAuthentication no PasswordAuthentication no ...
Nov 2017
How to create custom Nginx error pages for 404s How to create custom Nginx error pages for 404s
Nov 2017
Update Nginx to latest version on Ubuntu Update Nginx to the latest version on Ubuntu: ``` sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo a...
All articles →