1. Adriano
  2. gists

Overview

HTTPS SSH

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:

refresh.sh

execute command sequence (pipe and redirection friendly) every N seconds.

repeat.sh

repeatedly execute any command sequence (pipe and redirection friendly).

dirt.sh

directory tree -- display tree size structure of directory hierarchy.

randout.sh

readable random output from system kernel using /dev/urandom.

aw.sh

use awk as quick custom calculator on command line -- with easy syntax.

telamerica.sh

look-up North American region / area code within +1 country code (details are included for California area codes).

telcountry.sh

look-up country / telephone code worldwide.

tagscrape.sh

scrape content between given html tag.

ip2geo.sh

given IP argument: get latitude, longitude, country, region, and locality.

jason.sh

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.

sto.sh

interim temporary storage with tee, pager, format, diff. Fast quintessential command-line management between three storage units. Also supports gzip compressed files.

linecol.sh

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.

locat.sh

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.

argin.sh

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.

quotel.sh

quote lines using prefix and suffix strings. By default, those are double quotes.

colline.sh

convert column to line with optional delimiter.

keywords.sh

extract keywords from text. Summarization designed to work with our gist freqy.sh -- and there is a hook to work with xclip.

freqy.sh

sort and order lines by frequency of appearance -- a very useful idiom.

digy.sh

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.

lstest.sh

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).

country.sh

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.

prepend.sh

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.

flippar.sh

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 :-).

netspeed.sh

check download speed rate via command line. Linux bash script relies on wget. Notes on rate conversion and worldwide locations.

noise.sh

relaxing ambient Brown noise generator (cf. white noise). Linux bash script using sox, includes Cognitive Science notes.

httpstatus.sh

bash shell script to get HTTP response code with optional status message (includes verbose definitions in comment).

uniqnosort.sh

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!