164 points · by lxm · 3y ago · 104 comments
Through this process I’ve created a whole idiom of commands for myself. I have no pretense that they would be useful to anyone else, and I don’t sweat them beyond their ability to make my life easier. From these incremental efforts, I find I have access to a new kind of language in my mind. Especially with Git, I find myself seeing it as an extension of my mental process, integral to how I even think about solving problems, not just a VCS I use to push code around.
By noticing how I was working, I didn’t seek to optimize where I was at, I sought to graduate to levels where what previously needed optimization just doesn’t exist.
also using ctrl+r and filter through older commands (ctrl+r to cycle) is also necessary for good mental health.
for example
alias ll="lsd --icon never -l"
alias lla="lsd --icon never -l -a" # all
alias llr="lsd --icon never -l -r -a" # reversed
alias lls="lsd --icon never -l -r -a -S" #by size
alias llt="lsd --icon never -l --tree" #tree
alias lld="lsd --icon never -l -d -a --tree" #directories tree
alias m='micro'
alias ss="git status"
alias diff="git diff --color | cat"
alias log="git log --graph --pretty=oneline --abbrev-commit"
alias lz="lazygit"
alias dc="docker-compose"
# rust
alias cr='RUST_BACKTRACE=1 cargo run'
alias clippy='cargo clippy'
... many others
Soon enough, when you start piping these, you end up with your own bash language, cca. of that time you thought it was a good idea to augment C with macros (sic!)The few times I do come up with my own stuff, it's a 2+ line function (or full shell script) that can't be duplicated in a single command and can't be done as an alias.
alias lsa=“grep ^alias $HOME/.zshrc | sort”ss is actually a 'socket stats' and will list all active connections while resolving their reverse dns name, be careful
Recently I've found a similar improvement going from "plain old" ctrl+r for history to a set of zsh extensions plus fzf - my current set of extensions is zsh-autocomplete, zsh-autosuggestions, zsh-syntax-highlighting, zsh-history-substring-search, zsh-histdb, and fzf-histdb.
I press a space before commands with sensitive information so they don’t stay in my history or throwaway commands that I’m 99% sure I won’t use again.
Complicated ones I create a function for it, but I no longer carry aliases on my shell configuration, and I prefer the legibility of my commands/history.
But I'd always alias some uncommon tasks and usages. Especially my quirky git ones:
# get default branch
alias gdefault='git remote show origin|grep -E HEAD|cut -d" " -f5'
# cd to git root
alias groot='cd "$(git rev-parse --show-toplevel)"'
# Revert last unpushed commit to the state before commiting
alias uncommit="git reset HEAD~1 --soft"
# Show all commits between head and main as one-liner
alias gl1="git log --reverse --oneline HEAD...\`gdefault\`"I disagree, experienced *nix users probably remember a TON of commands outright, after going through multiple distros/*nixes over the years.
Personally I have maybe ~30 aliases that are actually used. There's almost no point in inventing aliases that will go unused or be rapidly forgotten etc.
git has it's own alias config which I prefer to use instead. some examples: st=status, co=checkout, ci=commit, cp = cherry-pick, mod=add -u.
so that means I do 'g st' instead of 'ss', yeah, a couple extra keypresses but I'm okay with that.
I've got some bad news for you...
It does have its place, though. Each morning, I do a 5K walk, and am constantly glancing at my Apple Watch, to ensure I maintain a pace of <10 min/K. If I find myself slowing, I put on a bit of mainsail, but I don’t insist on beating my personal best.
As for my software development, I just enjoy the work, and have dealt with CRS[0], since I was about 17. It’s always been a basic challenge, and isn’t something I can control.
It’s made me very good at finding information quickly and relevantly. I’m really good at googling answers; even embarrassingly basic ones.
My work speaks for itself. I definitely perform at a pretty high level. There are many folks that are better than me, but many, many more that can’t do as well.
exec /bin/bash
Then you could do something like: ssh hostname@address -tt bash -s < /path/to/utils.sh
And have all your utilities available on the remote machine :)Out of curiousity, these servers that you're dealing with, do you have to use them for long/focused work like writing or software development, or are these more like sysadmin interactions? Have you noticed any repeated commands or sequences you find yourself running over and over? Is there any opportunity for you to write local scripts that then SSH into the targets and run those commands on your behalf? Or locally use sshfs and manipulate files like they were local.
It’s more than just frequency analysis because it helps to remember what commands happened before or after. It also needs to be smart about when two commands are actually “the same thing” but with different flags or input filenames.
Maybe something like an N-gram model.
I took a handful of math courses in school, and what I didn't realize till later was that learning how to rigourously prove things mathematically had dramatically reshaped my mind. I am left wondering what it must be like for the minds of those who have traversed that tower far higher than I ever have or will.
Anecdotally, a few years ago I made a decision to run with my (ADHD driven) impulses when deciding what to spend my time on. It was difficult to let go, but I decided to let myself just fall behind with projects / work for a year or two (or until I was fired.) Long term, the benefits have far outweighed any downsides. I actually accomplish things without burning out now, and the drastic reduction in burnout has meant that I get much more done in general (work, side projects, life, etc.) Ultimately, worrying about success, failure, self-control, etc, seem to be fairly self-defeating.
For me the point of the timer is to snap me out of the distraction or I’ll be on Hacker News for an hour.
Timers are such a big deal with ADHD. It's not news to anyone that people with ADHD suffer from time blindness, but even knowing that I'm constantly underestimating how much it affects me. Even if I'm not doing a scheduled task, having something that regularly beeps or vibrates to shake me out of whatever I'm focusing on so I can ask, "how am I feeling, what am I doing, when was the last time I drank water, have I eaten today, what should I be doing right now" is very helpful -- at least until the brain learns to tune out the beep and you have to find a new sound.
I highly recommend people having trouble with focusing or distracting to get a cheap wristwatch or some kind of timer and setting it to beep or vibrate every 10-30 minutes. Doesn't solve every problem, but helps a lot with staying just a bit more rooted in reality.
So, I've been going in the opposite direction, and prioritizing the things that I feel are important, including finite but not periodic windows of arbitrary entertainment, and a cutoff to my work day; I'm essentially experimenting with aspects of deep work and systems thinking. The phone stays out of sight or completely off unless I'm expecting a call, or it's scheduled downtime, and the rest of most days are spent deliberately on things I get the most value out of.
For things like laundry and basic chores, I just don't consider those distracting, and have been batching them at the beginning or between periods of focus during the day. They're not distracting because they don't necessarily take me out of any state of immersion. I'm still thinking about the code or decision or whatever, whereas an email or text message or internet argument fully put my brain resources somewhere else.
Any videos I need are mostly downloaded for offline viewing beforehand, articles saved to pocket, but realistically I never read them anymore, and most break time during focus periods is an actual book or silence, not for the purpose of productivity, but because I want to read books and the way I've been living hasn't enabled me to have the space to focus on them. One chapter at a time. Any random ideas or searches I try to just note for later. Sometimes I revisit them, sometimes not, it usually doesn't matter.
It's also not worthwhile in my opinion to measure short term progress, so in terms of how these systems work for me, I'll see where I am in a few months or years, assuming the specifics will change gradually.
Some things have just sort of worked themselves out. I've ended up with what I think of as a "procrastination ouroboros." Most of the projects I rotate through have various interesting parts that are in various states of completion. The big difference for me, though, is that it _is_ a rotation. I actually return to projects now, because I don't completely burn through all of my enthusiasm in the first go. One of these is a project that I've been working on for several years now, which is a first for me.
I still don't love losing days on something nonsensical because I hyperfocused. I still end up stuck on boring tasks, and it's hard to not feel like it's all laziness, etc. After years of that, though, it feels like pushing _directly_ against those impulses isn't really sustainable. It's pointless wasting extra time on self-flagellation.
I don't know that this level of granularity will actually apply to anyone else, but I think it's worthwhile to at least give yourself the space to explore things like this when you can.
(Also, I take an SSRI, a prescription stim, working from home helps, and I'm sure there are a myriad of other things / factors. I think, if nothing else, "giving in" would have helped me try some of those things earlier, and it has helped me avoid short circuiting thought processes that prevent attempts at actual change.)
Being aware of ADHD might initially seem like a good thing, but then it becomes a constant thing to "optimize" for. It becomes ever-present. "Could this behavior/issue/problem be my ADHD?".
The idea that awareness of your medical issues is somehow an affliction in itself is an incredibly condescending idea.
Sounds trite but there you go.
Anyway, the whole time it felt like being driven to optimize.. the wrong stuff. I now believe that the healthiest way to be always seems easy and happens for free, without willpower. But it requires being able to hear your own intuitive preferences, instead of rationally computing what you think they are from from what others seem to think you should be.
It is natural that this “strategy” would lead to more success in the end, which applies to any kind of challenging activity. I like the description as “subtracting”, since you kind-of have to empty your mind before doing the thing. But I believe this does not apply to practicing, where you do have to make conscious efforts and “add to” yourself a lot of stuff in order to internalize it and hopefully build up the intuition required for this flow state to work.
As some here pointed out, doesn’t have to do anything with self-optimization. Although self-optimization may lead someone to believe that a lot of conscious effort is the key to success, when it can actually set them up for failure.
Sometimes it's also good to just play and experiment. Without play we're just moody machines.
It's just really hard to do things just because they're nice in an hypercompetitive society where it sometimes feels like there just isn't enough to go around. Stepping off the treadmill is a rare privilege.
[0] Steven B. Smith's course polsci https://oyc.yale.edu/political-science/plsc-114
Funny enough, the first few things that I want to learn before a "self-optimize" includes what could happen if I failed (and how to recover from it). The combined knowledge makes the process safer (for your time and effort).
The first time I tried to drive a car, the first thing I asked the teacher even before I started the engine was "what should I do in order to make it stop?", because I expect mess ups, the knowledge on how to react to it might be valuable later.
BTW: Another thing that I've learned in my life so far is don't get too fixated on something. Life is short, putting your effort on one thing removes it from another. Not all optimization is required, which is true in software development as well as in life.
The city where I live got a few cliffs from mining operations, almost 90 degrees up down and very tall. I lived under one of them when I was little, but I never developed any passion for it. If I try to climb it base on my none-existing skills, I'll probably end up as a missing-person record and food for mountain rats. But I never feel any lost in my life for not able to climb those cliffs.
There are so many struggles we can commit our lives to fight against, the act of picking a good one is equally important as the fight itself.
which language does this?
which language does this?
Boils down to: just do the thing, don't be anxious about it.
Doesn't have anything to do with optimization.