Debugging Kubernetes

23 Jul 2024

Helpful tips for debugging applications running in k8s

build/k8s.png

Handling multiple errors in Rust iterator adapters

17 Dec 2023

Approaches for handling multiple errors within iterator adapters

build/rust.png

Better FastAPI Background Jobs

29 Aug 2022

A more featureful background task runner for Async apps like FastAPI or Discord bots

build/fastapi_logo.png

Useful Linux Examples

21 Dec 2021

A plethora of helpful tips for working in Linux

build/bash_logo.png
Continue to all blog posts

Just Bash Things

Every now and again I come across a few things that are really useful, or that seem rather odd/unintuitive when working with bash commands/scripts. A couple popped up recently, so I thought I would start a post which will probably expand over time with them, and maybe some ways to help use or work around them.

sudo uses a different path

$ which python 
/home/chris/.pyenv/shims/python
$ sudo which python
/usr/bin/python

bash scripts will continue regardless of errors unless you tell them not too

If any later commands rely on the earlier commands executing successfully (which is often the case), you probably want to set a few sensible defaults at the start of the script

set -e
set -u
set -o pipefail

Check out the more detailed explanation in this awesome article by Kev

Remember you can change the shebang to choose the interpreter

The shebang line is the first line in a script, and chooses the interpreter of the rest of the script

Using your system python3

#!/usr/bin/python3

Using a custom python3 installation (maybe with packages you need for this script)

#!/my/path/to/bin/python3

Or search in the default PATH for the interpreter

#!/usr/bin/env python3