Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

191–200 of 408 posts

Re: Scripts I wrote that I use all the time

#191

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…

Given the nature of current operating systems and applications, do you think the idea of “one tool doing one job well” has been abandoned? If so, do you think a return to this model would help bring some innovation back to software development?

Rob Pike: Those days are dead and gone and the eulogy was delivered by Perl.

Re: Scripts I wrote that I use all the time

#194
post #38

I have mkcd exactly ( I wonder how many of us do, it's so obvious) I have almost the same, but differently named with scratch(day), copy(xc), markdown quote(blockquote), murder, waitfor, tryna, etc. I used to use telegram-send with a custom notification sounnd a lot for notifications from long-running scripts if I walked away from the laptop. I used to have one called timespeak that would speak the time to me every h…

I too have a `mkcd` in my .zshrc, but I implemented it slightly differently:

  function mkcd {
    newdir=$1
    mkdir -p $newdir
    cd $newdir
  }

Re: Scripts I wrote that I use all the time

#196

Earlier quoted context omitted.

I'm guessing you haven't worked in Someone Else's environment? The amount of shit you'll get for "applying your dotfiles" on a client machine or a production server is going to be legendary. Same with containers, please don't install random dotfiles inside them. The whole point of a container is to be predictable.

If, in the year 2025, you are still using a shared account called "root" (password: "password"), and it's not a hardware switch or something (and even they support user accounts these days), I'm sorry, but you need to do better. If you're the vendor, you need to do better, if you're the client, you need to make it an issue with the vendor and tell them they need to do better. I know, it's easy for me to say from the…

It’s 2025. I don’t even have the login password to any server, they’re not unicorns, they’re cattle.

If something is wrong with a server, we terminate it and spin up a new one. No need for anyone to log in.

In very rare cases it might be relevant to log in to a running server, but I haven’t done that in years.

Re: Scripts I wrote that I use all the time

#197

Earlier quoted context omitted.

I'm guessing you haven't worked in Someone Else's environment? The amount of shit you'll get for "applying your dotfiles" on a client machine or a production server is going to be legendary. Same with containers, please don't install random dotfiles inside them. The whole point of a container is to be predictable.

Someone else's environment? That should never happen. You should get your own user account and that's it.

I don’t even get an account on someone else’s server. There’s no need for me to log in anywhere unless it’s an exceptional situation.

Re: Scripts I wrote that I use all the time

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

I believe it would be possible to execute an applescript to tell the finder to delete the files in one go. It would theoretically be possible to construct/run the applescript directly in a shell script. It would be easier (but still not trivial) to write an applescript file to take the file list as an argument to then delete when calling from the shell.

Re: Scripts I wrote that I use all the time

#199
post #94
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…

`trash` is good to know, thanks! I'd been doing: "tell app \"Finder\" to move {%s} to trash" where %s is a comma separated list of "the POSIX file ".

Oooh, I just suggested in another comment that using applescript would be possible. I didn't think it would be this easy though.
Post reply on HN