Git Cheatsheet

To delete merged branches git branch --merged | grep -Ev "(^\*|master|main|dev)" | xargs git branch -d To retrieve commits between dates git log --after="2020-03-17" --before="2020-03-19" To retrieve full commit history of a file Note: works even for deleted files If you know path to the file. git log --all --full-history -- <path-to-file> If you do not know the path to the file. git log --all --full-history -- "**/thefile.*" Reset a file to it’s state in master git checkout origin/master -- <path-to-file> Script to pull latest changes from master and rebase the current branch Filename: pull_and_rebase.sh #! /bin/zsh # Pull from latest master and rebase # the current branch on master current_branch=$(git rev-parse --abbrev-ref HEAD) echo "### Rebasing $current_branchon master" git checkout master echo "### Pulling latest master" git pull -r echo "### Switching back to $current_branch" git checkout $current_branch git rebase master echo "### Rebase complete" chmod a+x pull_and_rebase.

Django cheatsheet

Generate APP secret key from django.core.management.utils import get_random_secret_key get_random_secret_key() Command line shortcut to stop all Django server processes. ps -A | grep -i "python manage.py runserver" | awk '{print $1}' | xargs kill -9 Shortcut for zsh/bash stop_django_server() { ps -A | grep -i "python manage.py runserver" | awk '{print $1}' | xargs kill -9 } To refresh your zsh - zsh -l

Articles

A Day in the Life of an Engineering Manager Essential Reading for Software Engineering Managers

Reading Goal - 2021

In 2020, my goal was to read 12 books, and I read only 8 and I am still reading a book. This year I am not changing the goal, I want to read 12 books. When I chose books in 2020, mostly it was random except for a few books. I didn’t select the books based on a theme except for personal finance - I picked titles from this article. For 2021, I want to read books on Health and Personal Finance. Here is my list for 2021. To Read Never split the difference: Negotiating as if Your Life Depended on it - Chris Voss and Tahl Raz (From 2020 reading goal) The phoenix project - Gene Kim, Kevin Behr, George Spafford (From 2020 reading goal) The automatic millionaire - David Bach I will teach you to be rich - Ramit Sethi Principles: life and work - Ray Dalio Digital Minimalism - Cal Newport The Cancer Code - Dr.

Podcasts December 2020

Capturing the list of podcasts I listened over the month. Changelog - Growing as a software engineer Deep-Questions with Cal Newport - Ep.56 Go Time (Changelog)- Cloudy with a chance of Kelsey Hightower Changelog - Coding without your hands

Digital Ocean Kubernetes Cert Manager - Failed to perform Self check GET request (Solved)

In GKE (Google Kubernetes Engine), setting up ingress controller and cert-manager is straightforward. After setting up the ingress controller and cert-manager on DO Kubernetes, my sub-domain was still not served on https. When I checked cert-manager logs, I found this error: Waiting for http-01 challenge propagation: failed to perform self check GET request. After little searching on Google I found this article on DO. In short, add the following annotation to your ingress resource and you should be good. service.beta.kubernetes.io/do-loadbalancer-hostname: "workaround.example.com" Related Github issue: https://github.com/jetstack/cert-manager/issues/3238

What, Why and How learning trick

We recently hired a DevOps intern at BeautifulCode. We gave him a learning plan which covers a lot of concepts in DevOps. In one of our one-one meetings, he raised a concern: “learning too many tools in a condensed period is putting pressure on me.” Firstly I agreed with him. Later I told him I would have felt the same way if I am in his position. Then I gave my 2 cents on the learning for which I haven’t prepared. He had to learn 5 tools (I am calling tools, for lack of a better word). I have listed the tools in his learning plan and discussed What each tool does in the bigger picture.

Podcasts November 2020

Capturing the list of podcasts I listened over the month. Changelog - Inside 2020’s infrastructure for Changelog.com Brain Science (Changelog) - The practice of being present Software Engineering Daily - Staff Engineering with Will Larson

Revert Python Version in Mac (Homebrew)

Homebrew upgrades packages to the latest versions whenever it tries to install a package. This has caused problems multiple times for me especially with the Python version. Recently Homebrew upgraded Python version on my Mac from 3.8 from 3.9. This has caused problems with gcloud. I installed python 3.8 version using brew install python@3.8. The installation was successful but python3 still referring to the newer version i.e python 3.9. The trick is to update the PATH to use Python 3.8. I’ve performed the following steps to revert Python version to Python 3.8. brew info python@3.8 After you run this command you will see lot of information, find the following lines If you need to have python@3.