Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

151–160 of 408 posts

Re: Scripts I wrote that I use all the time

#151
post #46

Earlier quoted context omitted.

I think it's more likely to say that this comes from a place of laziness than some enlightened peak. (I say this as someone who does the same, and is lazy). When I watch the work of coworkers or friends who have gone these rabbit holes of customization I always learn some interesting new tools to use - lately I've added atuin, fzf, and a few others to my linux install

Atuin is new to me! https://github.com/atuinsh/atuin Discussed 4 months ago: Atuin – Magical Shell History https://news.ycombinator.com/item?id=44364186 - June 2025, 71 comments

I gave it a try a few months ago, but did not work for me. My main issue is that atuin broke my workflow with fzf (If I remember correctly, pressing ctrl + r to lookup my shell history did not work well after installing atuin).

Re: Scripts I wrote that I use all the time

#153

While you're creating and testing aliases, it's handy to source your ~/.zshrc whenever you edit it: alias vz="vim ~/.zshrc && . ~/.zshrc" I alias mdfind to grep my .docx files on my Mac: docgrep() { mdfind "\"$@\"" -onlyin /Users/xxxx/Notes 2> >(grep --invert-match ' \[UserQueryParser\] ' >&2) | grep -v -e '/Inactive/' | sort } I use an `anon` function to anonymize my Mac clipboard when I want to paste something to t…

brilliant! this happens all the time and I never found a convenient way to manage

Re: Scripts I wrote that I use all the time

#154

It's weird how the circle of life progresses for a developer or whatever. - When I was a fresh engineer I used a pretty vanilla shell environment - When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP - Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use…

I use a dotfile with aliases and functions, mostly to document / remember commands I find useful. It's been a handy way to build a living document of the utils I use regularly, and is easy to migrate to each new workstation.

Re: Scripts I wrote that I use all the time

#155
post #33

> trash a.txt b.png moves `a.txt` and `b.png` to the trash. Supports macOS and Linux. The way you’re doing it trashes files sequentially, meaning you hear the trashing sound once per file and ⌘Z in the Finder will only restore the last one. You can improve that (I did it for years) but consider just using the `trash` commands which ships with macOS. Doesn’t use the Finder, so no sound and no ⌘Z, but it’s fast, offici…

Other examples where native features are better than these self-made scripts...

> vim [...] I select a region and then run :'!markdownquote

Just select the first column with ctrl-v, then "i> " then escape. That's 4 keys after the selection, instead of 20.

> u+ 2025 returns ñ, LATIN SMALL LETTER N WITH TILDE

`unicode` is widely available, has a good default search, and many options. BTW, I wonder why "2025" matched "ñ".

     unicode ñ
    U+00F1 LATIN SMALL LETTER N WITH TILDE
    UTF-8: c3 b1 UTF-16BE: 00f1 Decimal: ñ Octal: \0361
> catbin foo is basically cat "$(which foo)"

Since the author is using zsh, `cat =foo` is shorter and more powerful. It's also much less error-prone with long commands, since zsh can smartly complete after =.

I use it often, e.g. `file =firefox` or `vim =myscript.sh`.

Re: Scripts I wrote that I use all the time

#156
post #146

Earlier quoted context omitted.

I am not the author, but my bet is that he didn't know of its existence. The best part about sharing your config or knowledge is that someone will always light up your blind spots.

Or more abstractly: post anything to the internet and people will always detail how you’re wrong. Sometimes that can be useful.

That seems to be especially true on HN. Other forums there is some of that as well, but HN it seems nearly every single comment section is like 75% (random number) pointing out faults in the posted article.

Re: Scripts I wrote that I use all the time

#157

Earlier quoted context omitted.

I went through a similar cycle. Going back to simplicity wasn't about laziness for me, it was because i started working across a bunch more systems and didn't want to do my whole custom setup on all of them, especially ephemeral stuff like containers allocated on a cluster for a single job. So rather than using my fancy setup sometimes and fumbling through the defaults at other times, i just got used to operating mor…

The defaults are unbearable. I prefer using chezmoi to feel at home anywhere. There's no reason I can't at least have my aliases. I'd rather take the pain of writing scripts to automate this for multiple environments than suffer the death by a thousand cuts which are the defaults.

chezmoi is the right direction, but I don't want to have to install something on the other server, I should just be able to ssh to a new place and have everything already set up, via LocalCommand and Host * in my ~/.ssh/config

Re: Scripts I wrote that I use all the time

#158
post #156
post #146

Earlier quoted context omitted.

Or more abstractly: post anything to the internet and people will always detail how you’re wrong. Sometimes that can be useful.

That seems to be especially true on HN. Other forums there is some of that as well, but HN it seems nearly every single comment section is like 75% (random number) pointing out faults in the posted article.

I find that endearing for two reasons:

- either critique is solid and I learn something

- or commenter is clueless which makes it entertaining

there is very seldom a “middle”

Re: Scripts I wrote that I use all the time

#159

It's weird how the circle of life progresses for a developer or whatever. - When I was a fresh engineer I used a pretty vanilla shell environment - When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP - Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use…

or just ask claude etc to do it for ya

Re: Scripts I wrote that I use all the time

#160

Earlier quoted context omitted.

The nato phonetic alphabet one cracked me up. My dude you don't need that, call center employees don't know it, just say S as in Sugar like ur grandma used to.

The NATO alphabet is made of commonly known words that are hard to misspell and hard to mishear (at least the initial phonemes). The person on the other end doesn't need to be able to recite the words, they just need to be able to hear "november" and recognize that it starts with N.

Yes thank you that's a good description of what a phonetic alphabet is and how it's used.
Post reply on HN