Disconnection-resistant GitHub codespaces with tmux and iTerm2

GitHub codespaces' ssh client is prone to frequent, frustrating disconnections. If you're actively working remotely, that means that you often lose state in the codespace, which is especially frustrating if what you are doing takes a long time to set up, or should stay running. This post describes how I mitigate that with a script that ensures I always have a session in my codespace.