william

Keep Calm and Markdown.

Nested tmux over SSH: why Ctrl-k worked through a relay but not directly

Ctrl-k reached my remote tmux when I logged in through a relay, but the same key went to local tmux when I connected directly. The loopback login, nb, and nbx all reached the intended SSH server. The problem was how my local helper decided where to send the key.

The fix was to treat known forwarded endpoints differently from a relay. For ports 62222 and 62223, I already knew the destination used Ctrl-k, so I could skip detection. For a relay, I still needed to detect when the second SSH connection started and ended. This follows up on my two-hop tmux setup.

Nested tmux over SSH: dynamically route Ctrl-k across two hops

Update 2026-11-21: I tested real keystrokes through the two-hop login, including the return to the relay shell. Direct logins through my forwarded ports exposed a separate problem: the TCP source port changes in transit, so the observer cannot match the login terminal. See the forwarded-port fix for nb and nbx for the updated helper and test results.

Update 2026-11-15: there were two corrections. Always forwarding for a relay hostname broke local Ctrl-k when no second hop was active. Watching only remote tmux panes then missed my actual ssh → zsh → nb → ta zsh path: the first hop was a plain shell, not a tmux client. The observer now correlates the interactive SSH connection with its remote login terminal and inspects that terminal’s foreground job. Both downloads below are required; reconnect the first SSH login after updating the observer. Hostnames are anonymized.

My local tmux and the tmux behind a second SSH hop both use Ctrl-k. The first remote uses Ctrl-j. I wanted the prefixes to coexist without an extra escape sequence before every command.

The intended mapping is: Ctrl-k stays local until the first remote’s login terminal, or its active tmux pane, runs another SSH connection. Then Ctrl-b controls local tmux and Ctrl-k goes downstream. If a first-remote tmux is attached, Ctrl-j still controls it. Leaving the second connection returns Ctrl-k to local tmux. The live check verified detection of my nested SSH; it was not a complete keyboard test of every transition.

Keep SSH reachable with a closed lid on Linux Mint

My Linux Mint notebook accepted SSH connections while its lid was open, but became unreachable when I shut it. The connection command was unchanged:

1
ssh william@127.0.0.1 -p 62223

The relevant setting was not in sshd_config. Cinnamon was configured to suspend the notebook when the lid closed, even on AC power. I changed just the AC lid action, leaving the battery policies alone.

ChatGPT models in Claude Code: gptcc setup and troubleshooting

I wanted Claude Code’s terminal interface and tools to run ChatGPT models. Installing gptcc was only the first step. I could select Sol in /model and still get an account-hold error before the request reached GPT.

The working setup uses a local authenticated gateway, ChatGPT OAuth, and Claude Code’s custom model picker. It lists eight GPT models, makes Default resolve to GPT-6.1 Sol with medium effort, and displays Codex’s five-hour and weekly usage beside the model. A real Claude Code session completed a file-read tool call in two turns.

Why trading.hyena17 runs past 09:30: request timeouts and slow service readiness

I wanted to know which tasks in trading.hyena17 make the morning setup run past 09:30. Sorting by duration was misleading. Some tasks deliberately run until 15:00, while a task that takes only five seconds can still start ninety seconds late.

The Nov 12 run has two main problems. Stock-weight preparation takes 352.6 seconds and leaves only 4.4 seconds before 09:30. Downstream, the slowest shared-service startup takes another 167.3 seconds and finishes at 09:35:15. Redis itself takes 4.8 seconds. Its late start comes from its dependencies.

Rebuildable Airflow: snapshot the running container, redeploy with a rollback

Update 2026-11-11 17:30: image tags are now the build time, yyyymmddTHHMMSS (e.g. airflow:20261111T172041), so two builds on the same day no longer collide, and ./run.sh with no tag lists what’s available. The outputs below are from the first build, which still used a plain date tag, 20261111. The downloadable scripts are the current versions.

The outage postmortem had one recurring theme: every time someone rebuilt the Airflow container by hand, it came back missing something. A mount, the concurrency settings, the plugin, the registry login. The image was whatever someone last typed, and the settings that mattered lived only in a running container.

So the same afternoon I wrote three small scripts. build.airflow.sh turns the running container into an image tagged with its build time (airflow:20261111T172041), pushes it, and saves a tarball. run.sh recreates the container from that tag and checks it’s actually healthy, or puts the old one back. restart.sh runs inside the container and keeps the scheduler and webserver up. From the 170 entries in docker diff, the image keeps 13 files (172K). A redeploy is healthy about 15 s after the new container starts, and a failed one rolls back in 1 s.

0%