Earlier quoted context omitted.
15 years of Linux and I learn something new all the time...
Its why I keep coming back, now how do I remember to use this and not go back to using tmpfiles :)
Scripts I wrote that I use all the time
291–300 of 408 posts
Re: Scripts I wrote that I use all the time
#292I 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…
Re: Scripts I wrote that I use all the time
#293mksh is already the MirBSD Korn SHell
Re: Scripts I wrote that I use all the time
#294Re: Scripts I wrote that I use all the time
#295Earlier quoted context omitted.
> reference them when forgetting syntax If you have to do that, the script needs improvement. Always add a `--help` which explains what it does and what arguments it takes.
If you write these sorts of things in Python, argparse is worth investigating: https://docs.python.org/3/library/argparse.html - it's pretty easy to use, makes it easy to separate the command line handling from the rest of the code, and, importantly, will generate a --help page for you. And if you want something it can't do, you can still always write the code yourself!
Re: Scripts I wrote that I use all the time
#296Re: Scripts I wrote that I use all the time
#297Re: Scripts I wrote that I use all the time
#298I've written on this before, but I have an extensive collection of "at" scripts. This started 25+ years ago when I dragged a PC tower running BSD to a friend's house, and their network differed from mine. So I wrote an @friend script which did a bunch of ifconfig foo. Over time that's grown to an @foo script for every project I work on, every place I frequent that has some kind of specific setup. They are prefixed wi…
I'm stealing the top comment here because you probably know what I'm asking. I've always wanted a linux directory hook that runs some action. Say I have a scripts dir filled with 10 different shells scripts. I could easily have a readme or something to remember what they all do. What I want is some hook in a dir that every time I cd into that dir it runs the hook. Most of the time it would be a simple 'cat usage.txt'…
Re: Scripts I wrote that I use all the time
#299So if you're in your projects folder and want to keep working on your latest project, I just type "cdn" to go there.
Re: Scripts I wrote that I use all the time
#300I 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…