README for gists
Introduction :: last update : 2014-06-01
"Gists" are useful code snippets or short scripts, where documentation should be self-contained.
Gists get refined over time but it is a hassle to go back to Github to update them (especially because they must be manually edited as separate entities). So for convenience, we have archived the best of the latest versions as a single collection here at Bitbucket: see <https://bitbucket.org/rsvp/gists/src>
For historians, early gist versions originating from Github may be found at <https://gist.github.com/rsvp>
Please kindly direct your wishes, comments, patches, pull requests, etc. here at Bitbucket <https://bitbucket.org/rsvp/gists>
Thank you very much, and hope these gists are helpful in your projects. They are offered under the very liberal BSD LICENSE. Note that the ".sh" file extension can be removed once the script passes your inspection.
Short descriptions below are in reverse chronological order:
execute command sequence (pipe and redirection friendly) every N seconds.
repeatedly execute any command sequence (pipe and redirection friendly).
directory tree -- display tree size structure of directory hierarchy.
readable random output from system kernel using /dev/urandom.
use awk as quick custom calculator on command line -- with easy syntax.
look-up North American region / area code within +1 country code (details are included for California area codes).
look-up country / telephone code worldwide.
given IP argument: get latitude, longitude, country, region, and locality.
pretty print json for key-value processing line-by-line. A json file is NOT easily readable especially in compact form without spaces and without newlines. The goal is a readable and grepable output, which can be further refined by awk.
interim temporary storage with tee, pager, format, diff. Fast quintessential command-line management between three storage units. Also supports gzip compressed files.
convert regex delimited lines into single column. Here's a quick example: linecol ', *' foo.csv -- so each item on a CSV line will be on its own line.
locate files much more quickly than find -- with glob and colored extended regex. Simplifies yet extends the "locate" command. Short tutorial included on the database it uses and the inherent limitations.
universal xargs properly handled from ANY standard input. Plus parallelization is activated by default. (No more hassles with the null character :-) argin.sh converts lines from stdin into arguments in order to build and execute a command individually.
quote lines using prefix and suffix strings. By default, those are double quotes.
convert column to line with optional delimiter.
extract keywords from text. Summarization designed to work with our gist freqy.sh -- and there is a hook to work with xclip.
sort and order lines by frequency of appearance -- a very useful idiom.
tame DNS utility dig with reasonable options and error handling. Emphasis on readability of output. Also gets WAN public IP address, checks local network status, and discovers who is behind sites.
list files by type (regular, directory, symbolic link, named pipe, etc.), and optionally show detailed information unavailable via the ls command (while also properly handling dot files).
look-up country name, its ISO code or foreign exchange currency symbol. The necessary data is contained within the script itself, so it's fast.
insert text above given line number (the first by default) or pattern. The shell has nice append features, but lacks a general purpose prepend which handles renaming, and also supports pipes.
reverse the order of paragraph blocks where such blocks are delimited by two or more newlines. The last block of a file is handled temporarily by an additional newline (for insurance :-).
check download speed rate via command line. Linux bash script relies on wget. Notes on rate conversion and worldwide locations.
relaxing ambient Brown noise generator (cf. white noise). Linux bash script using sox, includes Cognitive Science notes.
bash shell script to get HTTP response code with optional status message (includes verbose definitions in comment).
uniq replacement -- bash shell script to get unique lines WITHOUT prior sort -- preserves original ordering where any subsequent duplicates are removed. Duplicates do NOT have to be adjacent to each other!