Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

241–250 of 408 posts

Re: Scripts I wrote that I use all the time

#241
post #156

Earlier quoted context omitted.

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.

Although I normally loathe pedantic assholes, I've found the ones on HN seem to be more tolerable because they typically know they'll have to back up what they're saying with facts (and ideally citations). I've found that pedantic conversations here seem to actually have a greater potential for me to learn something from them than other forums/social platforms. On other platforms, I see someone providing a pedantic r…

> I've found the ones on HN seem to be more tolerable because they typically know they'll have to back up what they're saying with facts (and ideally citations).

Can you back this up with data? ;-)

I see citations and links to sources about as little as on reddit around here.

The difference I see is in the top 1% comments, which exist in the first place, and are better on average (but that depends on what other forums or subreddits you compare it to, /r/AskHistorians is pretty good for serious history answers for example), but not in the rest of the comments. Also, less distractions, more staying on topic, the joke replies are punished more often and are less frequent.

Re: Scripts I wrote that I use all the time

#242

One of my biggest headaches is stripping specific number of bytes from the head or tail of a binary file. and I couldn't find any built-in tool for that, so I wrote one in C++.

Last X bytes: dd bs=1 skip=X First X bytes: dd bs=X count=1

Thanks, there were few errors after testing.

1. stripping fist X bytes: dd bs=1 skip=X

2. stripping last X bytes: truncate -s -X

Re: Scripts I wrote that I use all the time

#243

Earlier quoted context omitted.

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 like atuin but why is it so slow when first opening (hitting up) in the shell?

Either it wasn't a design goal or they are stupid. Why don't you tell us?

The right way this would work is via a systemd service and then it should be instant.

Re: Scripts I wrote that I use all the time

#244
My most important script has been to remap CapsLock as a kind of custom Meta key, that transforms (when pressed) the Space into Return, hjkl into arrows, io into PgUp/PgDn, and 1-9 into function keys. Now I have a 60% keyboard that takes 0 space on my desk. And I am reaaaally happy with this setup.

[that, plus LinkHint plugin for Firefox, and i3 for WM is my way to go for a better life]

Re: Scripts I wrote that I use all the time

#246

Earlier quoted context omitted.

I can't imagine a scenario where I would want to reimplement rm just for this.

[flagged]

https://news.ycombinator.com/newsguidelines.html

> Be kind. Don't be snarky. Converse curiously; don't cross-examine. Edit out swipes.

Instead of being rude to a fellow human making an inoffensive remark, you could’ve spent your words being kind and describing the scenario you claim exists. For all you know, maybe they did ask ChatGPT and were unconvinced by the answer.

As a side note, I don’t even understand how your swipe would make sense. If anything, needing ChatGPT is what demonstrates a lack of imagination (having the latter you don’t need the former).

Re: Scripts I wrote that I use all the time

#247

Earlier quoted context omitted.

Although I normally loathe pedantic assholes, I've found the ones on HN seem to be more tolerable because they typically know they'll have to back up what they're saying with facts (and ideally citations). I've found that pedantic conversations here seem to actually have a greater potential for me to learn something from them than other forums/social platforms. On other platforms, I see someone providing a pedantic r…

And the worst of it gets flagged and even dead-ed so most skip it after a bit, as I assumed would happen recently https://news.ycombinator.com/item?id=45649771

Yes, flagging mechanism on HN is evil.

Re: Scripts I wrote that I use all the time

#248

> `nato bar` returns Bravo Alfa Romeo. I use this most often when talking to customer service and need to read out a long alphanumeric string, which has only happened a couple of times in my whole life. But it’s sometimes useful! Even more useful is just learning the ICAO Spelling Alphabet (aka NATO Phonetic Alphabet, of which it is neither). It takes like an afternoon and is useful in many situations, even if the re…

Some time ago I tried to tell my email address to someone in Japan over the phone who did not speak English very well. It turned out to be basically impossible. I realized later one could probably come up with a phonetic alphabet of English words most Japanese know!

Re: Scripts I wrote that I use all the time

#250
I have a bunch, but one that I rarely see mentioned but use all the time is memo(1) (https://github.com/aktau/dotfiles/blob/master/bin/memo).

It memoizes the command passed to it.

  $ memo curl https://some-expensive.com/api/call | jq . | awk '...'
Manually clearing it (for example if I know the underlying data has changed:

  $ memo -c curl https://some-expensive.com/api/call
In-pipeline memoization (includes the input in the hash of the lookup):

  $ cat input.txt | memo -s expensive-processor | awk '...'
This allows me to rapidly iterate on shell pipelines. The main goal is to minimize my development latency, but it also has positive effects on dependencies (avoiding redundant RPC calls). The classic way of doing this is storing something in temporary files:

  $ curl https://some-expensive.com/api/call > tmpfile
  $ cat tmpfile | jq . | awk '...'
But I find this awkward, and makes it harder than necessary to experiment with the expensive command itself.

  $ memo curl https://some-expensive.com/api/call | jq . | awk '...'
  $ memo curl --data "param1=value1" https://some-expennsive.com/api/call | jq . | awk '...'
Both of those will run curl once.

NOTE: Currently environment variables are not taken into account when hashing.

Post reply on HN