Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

131–140 of 408 posts

Re: Scripts I wrote that I use all the time

#131

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…

The moment of true enlightenment is when you finally decide to once and for all memorize all the arguments and their order for those command line utilities that you use at an interval that's just at the edge of your memory: xargs, find, curl, rsync, etc.

That, plus knowing how to parse a man file to actually understand how to use a command (a skill that takes years to master) pretty much removes the need for most aliases and scripts.

Re: Scripts I wrote that I use all the time

#132

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…

> 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

Does this mean that you learned to code to earn a paycheck? I'm asking because I had written hundreds of scripts and Emacs Lisp functions to optimize my PC before I got my first job.

Re: Scripts I wrote that I use all the time

#135
I've started using snippets for code reviews, where I find myself making the same comments (for different colleagues) regularly. I have a keyboard shortcut opening a fuzzy search to find the entry in a single text file. That saves a lot of time.

As an aside, I find most of these commands very long. I tend to use very short aliases, ideally 2 characters. I'm assuming the author uses tab most of the time, if the prefixes don't overlap beyond 3 characters it's not that bad, and maybe the history is more readable.

Re: Scripts I wrote that I use all the time

#136
> `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 receiver does not know it.

Re: Scripts I wrote that I use all the time

#137
Not really a one liner but this comes in handy for quick dns on multiple hostnames:

https://gist.github.com/jgbrwn/7dd4b262c544f750cb0291161b2ec...

(actually avoids having to do a one liner like: for h in {1..5}; do dig +short A mail”${h}”.domain.com @1.1.1.1 )

Hmm speaking of which I need to add in support for using a specific DNS server

Re: Scripts I wrote that I use all the time

#138
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…

For trash on macOS, I recommend https://github.com/ali-rantakari/trash Does all the right things and works great. There’s a similar tool that works well on Linux/BSDs that I’ve used for years, but I don’t have my FreeBSD desktop handy to check.

[deleted]

Re: Scripts I wrote that I use all the time

#139
post #28

Earlier quoted context omitted.

why is this interesting to you? the whole point of doing all of this is to be more efficient in the long run. of course there is an initial setup cost and learning curve after which you will hopefully feel quite efficient with your development environment. you are making it sound like it is not worth the effort because you have to potentially spend time learning "it"? i do not believe that it takes long to "learning"…

It's interesting because there's a significant chance one wastes more time tinkering around with custom scripts than saving in the long run. See https://xkcd.com/1205/ For example. The "saves 5 seconds task that I do once a month" from the blog post. Hopefully the author did not spend more than 5 minutes writing said script and maintaining it, or they're losing time in the long run.

Sometimes, you explore to have ideas. By fixing a few problems like these, you learn about technologies that can help you in another situation.

Re: Scripts I wrote that I use all the time

#140
post #55

I have a bunch of little scripts and aliases I've written over the years, but none are used more than these... alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' alias .......='cd ../../../../../..'

fish lets you cd to a folder without 'cd' although you still need the slashes. I use it all the time.

    c $> pwd
    /a/b/c
    c $> dir1
    dir1 $> ..
    c $> ../..
    / $>
Post reply on HN