Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

251–260 of 408 posts

Re: Scripts I wrote that I use all the time

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

One more from me:

  mkcd() {
    mkdir -p -- "$1" &&
    cd -- "$1"
  }

Re: Scripts I wrote that I use all the time

#253
post #64

Earlier quoted context omitted.

I have setup a shortcut: alt+. to run cd.., it's pretty cool. I also aliased - to run cd -

but alt-. in bash is used for pasting the last argument to the previous command into the current one.

Good point, when working with keybindings, you'll inevitably end up overriding built-ins. I see it as a trade-off, between something I don't know of (and wouldn't use) and something I find useful. Works for me :)

Re: Scripts I wrote that I use all the time

#254
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` is widely available

It's not installed by default on macOS or Ubuntu, for me.

Re: Scripts I wrote that I use all the time

#257
Here are some snippets that we've compiled over time:

https://snhps.com

They're not all necessarily the most efficient/proper way to accomplish a task, but they're nice to have on hand and be able to quickly share.

Admittedly, their usefulness has been diminished a bit since the rise of LLMs, but they still come in handy from time to time.

Re: Scripts I wrote that I use all the time

#258
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.

    >YOU DON'T UNDERSTAND. I NEED TO BE CONSTANTLY OPTIMIZING MY UPTIME. THE SCIENCE DEMANDS IT. TIMEMAXXING. I CAN'T FREELY EXPLORE OR BRAINSTORM, IT'S NOT XKCD 1205 COMPLIANT. I MUST EVALUATE EVERY PROPOSED ACTIVITY AGAINST THE TIME-OPTIMIZATION-PIVOT-TABLE.

Re: Scripts I wrote that I use all the time

#259

on my ubuntu, `date -I` does iso dates Also re: alphabet $ echo {a..z} a b c d e f g h i j k l m n o p q r s t u v w x y z

date -I even works on macOS, which I was pleasantly surprised by!

If you want the exact alphabet behaviour as the OP:

    $ echo {a..z} $'\n' {A..Z} | tr -d ' '

Re: Scripts I wrote that I use all the time

#260

Earlier quoted context omitted.

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.

This doesn't make sense.

You said you were already using someone else's environment.

You can't later say that you don't.

Whether or not shell access makes sense depends on what you are doing, but a well written application server running in a cloud environment doesn't need any remote shell account.

It's just that approximately zero typical monolithic web applications meet that level of quality and given that 90% of "developers" are clueless, often they can convince management that being stupid is OK.

Post reply on HN