Read the linked article.
This reminded me to ask: To what extent are people still coding by hand these days? In my profession (academia), literally no one codes anymore. On one hand, it sucks because the joy and fun of programming has been replaced by constant agent orchestration tasks, but on the other hand, it’s hard to go back to the way things were before because the productivity gain is so good.
I remember learning a lot of these programming tricks over the years. They would give me happiness: learning something new about nvim, or some new shortcut in the Fish shell, or a new Vim macro, or the difference between 1 bracket or 2 brackets in Bash scripts, etc. But now it seems like all of them are irrelevant, and I wanted to see how others think about the situation.
I would probably retitle this less as “programming tricks” rather instead make it “bash/zsh CLI tricks” as this only really tangentially refers to programming.
nice content
I do hand-code for the most part. I will use LLMs as a “smart reference” when I can’t recall how to do something or maybe to scaffold out a starting point if I’m working in a less familiar language or framework. I use them as a better search engine, where I would have probably have looked at Stack Overflow, mdn, or online docs in the past.
I’m fortunate I guess in that most of my work tasks have very loosely defined deadlines, if any at all.
Also in academia but I’m old and my real work is done withy students. I’m coding by hand much less than I used to (boo) but solving more problems with code myself than I used to (yay). Having an llm do things turns out to be similar to having a student do them but with fast turnaround and it’s fine to have them work on your home automation system. ![]()
Only a few of these are actual programming tricks. The problem with sharing them is that they’ll typically seem obvious to you, since you know them. It’s difficult to know what is actually unknown to other people, and if you share stuff everybody knows you risk coming off as arrogant.
Here’s one that I think more people should know: avoid branches. If I can do the same thing without an if statement and even a logical expression, the code typically both becomes easier to understand for people and easier to run for the CPU.
If you want to level up your Zsh history experience, I built zhist[1] specifically for that. It uses fzf underneath, but provides considerably more context than simply using fzf. There’s a demo video in the README.
I would love for someone to package up some kind of script or AI skill that evaluates your current terminal config/set-up and applies all of these tips and tricks. For instance, it might detect that you currently use ag, install ripgrep, and offer a short tutorial on how users accustomed to ag should use it. Or it might look at the history of git commands you’ve run and offer tips on efficiency improvements.
At a previous company, I shared a trick on slack every day with the engineering team, both technical and company-specific, and folks found them pretty useful.
I would find that annoying, however to not be seen as a jerk I wouldn’t say anything.
My favorite is generating a sequential resultset of the numbers 1-4096 in SQL Server with this simple query:
;with [[][[as(select 1 union select 0),[]]as(select 1 from [[][[ ]]]]],[[][[ _),]][as(select 1 from []] ]]]]],[]] _),[[[[]as(select 1 from ]][ ]]]]],]][] _),[[[]][]]as(select 1 from [[[[] ]]]]],[[[[] _)select _ from(select row_number()over (order by _)from [[]]])[[][[;
/s
Additional tip:
In the macOS terminal you can…
Ctrl + Option + -
…and it’ll undo your typing.
Dunno about other OS keys!
I hand code entirely at work still, while almost all of my colleagues do not and I am still able to keep up. I do use coding agents on personal projects, but have not felt the impetus to switch to agent based coding at work.
I don’t mean this to brag, mostly to point out that in my line of work, actually writing the code is not the biggest bottleneck.
For context I work on greenfield network security appliances
My coding by hand is always exploratory. Either I’m getting familiar with a new library/platform or I’m sizing up the architecture of the software. Then it’s a heavy dose of copy/pasting, snippets, and emacs-fu. What I spend most time on is reading docs. Apart from that, it’s thinking (mostly away from the computer).
I still hand code backends and frontends. I also review code by reading it manually, and ideally running it and then screenshot’ing receipts of it working and attaching those in my PR approval.
I started writing little “that’s useful to remember” tips on my website. Bit more durable than shell history, and you can share them!
I think I would prefer an optional separate channel specifically for people to share such things with each other who wanted to see that exact sorta thing. Then nobody gets bothered by it who’s not interested in such things, and people who are have a place that’s dedicated to exactly that.
Wrote “script” by accident once in my terminal. Turns out the unfortunate naming of that gnu tool from unix days makes it rather unknown.
Record a debugging terminal session including output to a file. Its pretty great.
Im not TYPING a lot of code by hand anymore (still some, inference is slower than typing in a few cases) but im still in the shell zipping around doing other stuff like i always have, the LLM is helpful in a lot of ways but it in no way shape or form is the ideal way to interact with a computer.
So i still get daily use out of these tricks.
Are there people that are literally ONLY interacting with a computer via an LLM? thats crazy if its true
I’m struggling to comprehend how branches can be avoided (or why one would want to, as they are the cornerstone of programming). I can only think how to obfuscate them, which is rarely useful.