
I saw a note[0] about using a script to activate Redshift in Linux and wondered what other cool, useful, or otherwise interesting scripts you might be using.
[0] https://news.ycombinator.com/item?id=21916949
[0] https://news.ycombinator.com/item?id=21916949
I've been using my "dots" script for over 10 years to give me feedback that a long task (like un-tarring a big source tree) is still running, without flooding the terminal with text. I pipe the "verbose" output of a command into the script: tar xvfz kernel.tar.gz | dots
#!/usr/bin/perl
$| = 1; $i = 0;
if ($#ARGV < 0) { $number = 1000; } else { $number = shift(@ARGV); }
while (<STDIN>) { print '.' unless ($i % $number); $i++; }
print "\n";
See also pv.
tl;dr - The flag for pv in this case is --line-mode (-l).
So, if you have a command that produces lots of lines of output (e.g., for demo purposes, "yes" - which literally floods the terminal with lines):
yes | pv -l >/dev/null
Example progress output, showing lines processed (total & rate): 405M 0:00:03 [ 140M/s] [ <=> ]I use snippy as my snippet manager. Keep them version controlled in ~/.snippy and activate it with dmenu: https://gist.github.com/coderofsalvation/46549e3788ade2f3a93...
I have another one that splits AAX files from Audible by chapters: https://github.com/captn3m0/Scripts/blob/master/split-audio-... (After stripping the DRM)
ansi2html converts terminal output to HTML: https://github.com/captn3m0/Scripts/blob/master/ansi2html.sh
dydns.sh sets up a dynamic DNS entry on CloudFlare against my current local IP address. https://github.com/captn3m0/Scripts/blob/master/dydns.sh
emojify converts emoji shortcodes to emojies on the command line: https://github.com/captn3m0/Scripts/blob/master/emojify
vtt2srt: convert vtt subtitle files to SRT https://github.com/captn3m0/Scripts/blob/master/vtt2srt
Mine watches for changes in a directory and runs a command on any save change. I use it a lot for Test Driven Development. Modify source code, save and automatically on a terminal it runs `make test` or similar.
https://gist.github.com/davidmoreno/c049e922e41aaa94e18955b9...
Have you heard of wendy[1]?
Might be useful, I'm not entirely sure if it suits your case because my experience with inotify is limited to playing around with it and nothing substantial coming from it.
1: http://z3bra.org/wendy/ (Author's blog post: http://blog.z3bra.org/2015/03/under-wendys-dress.html)
Another alternative is the entr command - https://www.systutorials.com/docs/linux/man/1-entr/