Fix typos, tidy formatting, & improve writing

This is what late-night boredom does to you. lol
pull/99/head
terminalforlife 4 years ago
parent d7473ac185
commit 2ce193c0ba

@ -1,7 +1,7 @@
# sum integers from a file or stdin, one integer per line:
# sum integers from a file or STDIN, one integer per line:
printf '1\n2\n3\n' | awk '{ sum += $1} END {print sum}'
# using specific character as separator to sum integers from a file or stdin
# using specific character as separator to sum integers from a file or STDIN
printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'
# print a multiplication table
@ -16,30 +16,30 @@ awk -v RS='' '/42B/' file
# display only first column from multi-column text
echo "first-column second-column third-column" | awk '{print $1}'
# Use awk solo; without the need for something via STDIN.
# Use AWK solo; without the need for something via STDIN.
awk BEGIN'{printf("Example text.\n")}'
# Accessing environment variables from within awk.
# Accessing environment variables from within AWK.
awk 'BEGIN{print ENVIRON["LS_COLORS"]}'
# One method to count the number of lines; in this case, read from STDIN.
free | awk '{i++} END{print i}'
# Output a (unique) list of available sections under which to create a DEB package.
# Output unique list of available sections under which to create a DEB package.
awk '!A[$1]++{print($1)}' <<< "$(dpkg-query --show -f='${Section}\n')"
# Using process substitution (`<()` is NOT command substitution), with AWK and its
# associative array variables, we can print just column 2 for lines whose first
# column is equal to what's between the double-quotes.
# Using process substitution (`<()` is NOT command substitution), with AWK and
# its associative array variables, we can print just column 2 for lines whose
# first column is equal to what's between the double-quotes.
awk '{NR!=1&&A[$1]=$2} END{print(A["Mem:"])}' <(free -h)
# While below is an easier and simpler solution to the above, it's not at all the
# same, and in other cases, the above is definitely preferable; more accurate.
# While below is an easier and simpler solution to the above, it's not at all
# the same, and in other cases, the above is definitely preferable.
awk '/^Mem:/{print($2)}' <(free -h)
# Output a unique-d list of uppercase-only, sigil-omitted variables used in [FILE].
# Output list of unique uppercase-only, sigil-omitted variables used in [FILE].
awk '{for(F=0; F<NF; F++){if($F~/^\$[A-Z_]+$/){A[$F]++}}} END{for(I in A){X=substr(I, 2, length(I)); printf("%s\n", X)}}' [FILE]
# Output only lines from FILE between PATTERN_1 and PATTERN_2. Good for log files.
# Output only lines from FILE between PATTERN_1 and PATTERN_2. Good for logs.
awk '/PATTERN_1/,/PATTERN_2/{print}' [FILE]
# Pretty-print a table of an overview of the non-system users on the system.

@ -10,10 +10,10 @@ python -m SimpleHTTPServer
# Python 3
python -m http.server 8000
# SMTP-Server for debugging, messages will be discarded, and printed on stdout.
# SMTP-Server for debugging, messages will be discarded, and printed on STDOUT.
python -m smtpd -n -c DebuggingServer localhost:1025
# Pretty print a json
# Pretty print a JSON
python -mjson.tool
# Zen of Python

@ -22,7 +22,7 @@ sgdisk -l=sgdisk-sda.bak
# Clone your current device's partition layout '/dev/sda' to another drive '/dev/sdc'
sgdisk -R=/dev/sdc /dev/sda
# If both drives will be in the same computer, you need to randomize the GUID's after cloning
# If both drives will be in the same computer, you need to randomize the GUIDs after cloning
sgdisk -G /dev/sdc

@ -1,7 +1,7 @@
# siteciphers (Bash-Snippets)
# Checks the available ciphers for the SSL of an https site.
# Checks the available ciphers for the SSL of an HTTPS site.
# Determine the available SSL ciphers for an https website
# Determine the available SSL ciphers for an HTTPS website
siteciphers github.com
# Determine the ciphers setting the delay between requests (default is 1 sec)

@ -1,6 +1,6 @@
# This is a shell builtin available in bash, but not in the Bourne Shell (`sh`).
# The contents of FILE (assuming shell script) will be sourced into the current
# session, allowing external use of things like its functions and variables.
# This is a shell built-in available in Bash, but not in the Bourne Shell
# (`sh`). The contents of FILE (assuming shell script) will be sourced into the
# current session, allowing external use of its functions, variables, etc.
source FILE
# The above can be written in short-hand, for the same effect:
. FILE

@ -1,28 +1,30 @@
# svgo
#
# SVG Optimizer: a Nodejs-based tool for optimizing Scalable Vector Graphics files.
# It applies a series of transformation rules (plugins), which can be toggled individually.
# SVG Optimizer: a Node.js-based tool for optimizing Scalable Vector Graphics
# files. It applies a series of transformation rules (plugins), which can be
# toggled individually.
# Optimize a file using the default plugins (overwrites the original file):
# Optimize a file using the default plugins, overwriting the original file.
svgo test.svg
# Optimize a file and save the result to another file:
# Optimize a file and save the result to another file.
svgo test.svg test.min.svg
# Optimize all SVG files within a folder (overwrites the original files):
svgo -f path/to/folder/with/svg/files
# Optimize all SVG files within a directory, overwriting the original files.
svgo -f path/to/directory/with/svg/files
# Optimize all SVG files within a folder and save the resulting files to another folder:
svgo -f path/to/input/folder -o path/to/output/folder
# Optimize all SVG files within a directory and save the resulting files to
# another directory.
svgo -f path/to/input/dir -o path/to/output/dir
# Optimize SVG content passed from another command, and save the result to a file:
# Optimize SVG content passed from another command, then save result to a file.
cat test.svg | svgo -i - -o test.min.svg
# Optimize a file and print out the result:
# Optimize a file and print out the result.
svgo test.svg -o -
# Optimize a file making sure a given plugin is enabled:
# Optimize a file making sure a given plugin is enabled.
svgo --enable=plugin_name
# Show available plugins:
# Show available plugins.
svgo --show-plugins

@ -1,10 +1,10 @@
# weather (Bash-Snippets)
# Provides a 3 day forecast on your current location or a specified location
# Provides a 3-day forecast on your current location or a specified location
# Get a 3 day forecast for your current location as determined by your ip address
# Get 3-day forecast for your current location as determined by your IP address
weather
# Get a 3 day forecast for any location
# Get 3-day forecast for any location
weather Tokyo
# Get the current moon phase

Loading…
Cancel
Save