My Shitty Code

Embracing the Messiness in Search of Epic Solutions

Home

Welcome to my encyclopedia of shitty code!

  • GCP + Container Registry: Pushing/Pulling Images

    PROBLEM You want to push a new image to Google Container Registry (GCR) or pull an existing image from GCR. SOLUTION Pushing a New Image to GCR Prepare your Dockerfile. Create an image and tag it with a path pointing to GCR within a project. There are several variations of GCR’s hostname (ex: gcr.io, us.gcr.io, […] Read More…

  • Ansible: Handling Multiple Hosts via SSH

    PROBLEM To run Ansible playbook in multiple hosts via SSH. SOLUTION Configuring SSH environment Ensure SSH keypair exists on the current machine (ex: ~/.ssh/id_rsa for private key and ~/.ssh/id_rsa.pub for public key). If you do not have one, create one: Copy the public key (ex: ~/.ssh/id_rsa.pub) to each remote host’s ~/.ssh/authorized_keys. If this file doesn’t […] Read More…

  • Squid: Configuring Whitelisted URLs

    PROBLEM To configure a proxy server that only allows whitelisted URLs through. SOLUTION Install Squid… in this case, on Ubuntu. Ensure the service is running. Create a file ( /etc/squid/whitelist.txt ) containing the whitelisted URLs. In this example, only one URL is whitelisted. To simplify the configuration, backup /etc/squid/squid.conf and create the same file with […] Read More…

  • macOS Big Sur: Poor Screen Quality When Connecting to Old Monitor via HDMI

    PROBLEM You have a shiny Mac laptop running macOS Big Sur. This laptop is connected to an old external monitor via HDMI. The screen quality looks pixelated and fuzzy. Running font smoothing (as below) doesn’t fix the problem: You are poor enough to buy a new 4K monitor. SOLUTION The usage of HDMI seems to […] Read More…

  • Docker: Executing Startup Script When Running Container Interactively

    PROBLEM When running the Docker container interactively (ex: docker run –rm -it myimage), you want to run a startup script every time. SOLUTION For Ubuntu, Debian and Centos images, write the startup script to /root/.bashrc: For Alpine image, it’s a little different because it uses Ash shell. Besides writing the startup script to /root/.profile, you […] Read More…

  • Gone From Our Sight…

    Gone from our sight, but never from our hearts. – Unknown Read More…

  • Git: Querying Tags Without Cloning the Repository

    PROBLEM A typical way to get a list of tags from a repository is to clone it before running git tag:- versionsort.suffix=- ensures 1.0.0-XXXXXX comes after 1.0.0. To retrieve the latest tag:- While it works, it requires us to clone the repository first, and if we want to retrieve tags from multiple repositories, we are […] Read More…

  • RPM: Performing Offline Installation

    PROBLEM To perform an offline (or airgapped) installation, sometimes it’s not sufficient to download just the needed RPM package. In most cases, this package requires a list of dependencies to be installed too. For example, Nginx requires at least 20 different packages in order for its installation to be successful:- SOLUTION The first step to […] Read More…

  • Nginx: Requesting and Configuring SSL Certificate

    INTRO Step by step instructions for my future self to obtain the SSL certificate and to configure it in Nginx because my fragile little brain cannot retain them at the moment. INSTRUCTIONS Generate a private key and store it in a safe place. Generate a certificate signing request (CSR). Request a SSL certificate from Certificate […] Read More…

About Author

This author has 20+ years of experience in software engineering and cloud engineering. In an industry where knowledge becomes obsolete in the next three months, he learns anything that crosses his path with no mercy. He codes Java while drinking Espresso and writes Spock specifications while listening to Groovy beats. He masters Google Cloud Platform just like he masters the art of predicting the movement of dark clouds over his backyard, where 60% of the time, he is right every time.

This author suffers from the Dunning-Kruger effect, where he overestimates his competence and underestimates his ignorance. Technology buzzwords never scare him, for he does not know what to be afraid of in the first place. GCP, GCS, GCR, GKE, GWT, JWT… they all sound the same to him. This author is a jack of all trades but a master of none. He writes like he knows all the answers, yet he googles for better solutions from elsewhere. He fakes it until he makes it, and if he doesn’t, that’s okay because he has the attention span of a squirrel.

By now, you should know this author is full of shit, and he apologizes in advance if you are trying to solve your company’s real problems with his shitty solutions.