‹ BackHN Continuity

Thread

Small programming tricks

681 points · 294 comments · signa11

  1. kccqzy · · focus · HN ↗
    A lot more tricks can be learned from just watching AI work. Instead of allowing AI to work autonomously, go back to the old days where you manually approve every command the AI runs. Just recently while doing performance optimization work, I found Opus using the `perf` command in ways I didn’t know possible. Just give AI a real task and carefully read what commands are used by the AI to solve the problem; most likely the AI uses a trick or two that you didn’t know existed.
    1. throwaway219450 · · focus · HN ↗
      There are several keyboard shortcuts that you would never find out from watching an agent, but are mindblowing to new Linux users. I suck at remembering vim keybindings, but I have ingrained ctrl+a ctrl+e for jumping to the start/end of a string (which also works all over OS X). I had been a developer for an embarassing amount of time before I discovered those.

      There are other terminal specific shortcuts for removing last word (ctrl+w) but they don't seem to be as portable.

      1. gosub100 · · focus · HN ↗
        Another one, not quite as handy but still awesome: ctrl s / ctrl-q. This freezes/unfreezes the terminal output so you can read it, without interrupting your program. Useful for very fast walls of text.
        1. kccqzy · · focus · HN ↗
          It can’t always not interrupt your program. Think about it: after you press Control S to trigger XOFF, the fast output has to be buffered in memory. That memory is certainly not unlimited. There’s no way for the program to keep outputting text. Indeed some programs (including Claude Code, at least a while ago) really don’t like it when you press Control S and let the terminal be frozen for a very long time.
          1. mkehrt · · focus · HN ↗
            Interesting; I assumed the write to stdout would just hang for the writing program.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.