Live data from Hacker News

Scripts I wrote that I use all the time

evanhahn.com

91–100 of 408 posts

Re: Scripts I wrote that I use all the time

#91
post #70

Earlier quoted context omitted.

When I had one nix computer, I wanted to customize it heavily. Now I have many nix computers and I want them consistent and with only the most necessary packages installed.

For anyone else reading this comment who was confused because this seems like the opposite of what you'd expect about Nix: Hacker News ate the asterisks and turned them into italics.

use a backslash. \*

(had to use a double backslash to render that correctly)

Re: Scripts I wrote that I use all the time

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

Re: Scripts I wrote that I use all the time

#95

My fav script to unpack anything, found a few years ago somewhere # ex - archive extractor # usage: ex function ex() { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xjf $1 ;; *.tar.gz) tar xzf $1 ;; *.tar.xz) tar xf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; *.tgz) tar xzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1;; *.7z) 7z x $1 ;; *) echo "'$1' can…

That's brilliant. Now I need its compressing counterpart.

Re: Scripts I wrote that I use all the time

#97
post #6

This is exactly the kind of stuff I'm most interested in finding on HN. How do other developers work, and how can I get better at my work from it? What's always interesting to me is how many of these I'll see and initially think, "I don't really need that." Because I'm well aware of the effect (which I'm sure has a name - I suppose it's similar to induced demand) of "make $uncommon_task much cheaper" -> "$uncommon_ta…

https://raw.githubusercontent.com/fliptheweb/bash-shortcuts-... has served me very well.

Re: Scripts I wrote that I use all the time

#99
post #6

This is exactly the kind of stuff I'm most interested in finding on HN. How do other developers work, and how can I get better at my work from it? What's always interesting to me is how many of these I'll see and initially think, "I don't really need that." Because I'm well aware of the effect (which I'm sure has a name - I suppose it's similar to induced demand) of "make $uncommon_task much cheaper" -> "$uncommon_ta…

I'd love to see a cost benefit analysis of the author's approach vs yours, which includes the time it took the author to create the scripts, remember/learn to use them/reference them when forgetting syntax, plus time spent migrating whenever changing systems.

Sometimes it's rather matter of sanity than time management. I once created systemd service which goes to company web page and downloads some files which I sometimes need. This script was pretty hacky, and writing it took me a lot of time - probably more than clicking manually on this page in the long run. But clicking it so annoying, that I feel it was totally worth.

Re: Scripts I wrote that I use all the time

#100

Earlier quoted context omitted.

Does zsh support this out-of-the-box? Because I definitely never had to setup any of these kinds of aliases but have been using this shorthand dot notation for years.

Yes it does.

Not on my Mac.

    zsh: permission denied: ..
    zsh: command not found: ...
Post reply on HN