- grex: A command-line tool and Rust library for generating regular expressions from user-provided test cases
- cmatrix: Terminal based “The Matrix” like implementation
Interesting Links
Tip of the Week
Use json output of popular commands:
% docker image list --format "{{json .}}"
% kubectl get pods --all-namespaces --output json
% gcloud projects list --format json
Use jqp
to interactively parse the output:
% docker image list --format "{{json .}}" | jqp
Use jq
to format the json output:
% docker image list --format "{{json .}}" | jq -rj '.ID,"\t",.Size,"\t",.Repository,":",.Tag,"\n"'
% kubectl get pods --all-namespaces --output json | jq -rc '.itmes[]|.spec.containers[]|.image'
% gcloud projects list --format json | jq -rj '.[]|select(.name|contains("My Project")|not)|.name,": ",.projectId,"\n"'
Continue reading
- fzf-tab: Replace zsh’s default completion selection menu with fzf
- bashate: Code style enforcement for bash programs
Interesting Links
Tip of the Week
How to make dig
a little easier to use:
The default output of dig
includes the program version, technical information about the results, the query, the actual result, and statistics.
Note: dig
uses +
instead of -
for option flags.
# remove the version, technical info, query, and statistics sections:
% dig stackoverflow.com +nocmd +nocomment +noquestion +nostats
stackoverflow.com. 377 IN A 151.101.193.69
stackoverflow.com. 377 IN A 151.101.1.69
stackoverflow.com. 377 IN A 151.101.65.69
stackoverflow.com. 377 IN A 151.101.129.69
# the above can be re-written as:
% dig stackoverflow.com +noall +answer
# reduce the 'answer' portion even more:
% dig stackoverflow.com +short
151.101.193.69
151.101.1.69
151.101.65.69
151.101.129.69
# instead of an A record search, show other record types:
% dig NS stackoverflow.com +short
ns-cloud-e2.googledomains.com.
ns-cloud-e1.googledomains.com.
ns-1033.awsdns-01.org.
ns-358.awsdns-44.com.
% dig MX stackoverflow.com +short
1 aspmx.l.google.com.
10 alt3.aspmx.l.google.com.
10 alt4.aspmx.l.google.com.
5 alt2.aspmx.l.google.com.
5 alt1.aspmx.l.google.com.
# use a different DNS server (can help against caching):
% dig stackoverflow.com @9.9.9.9 # https://www.quad9.net
# do a reverse lookup:
% dig -x 185.199.111.153 +short
cdn-185-199-111-153.github.com.
# dig supports a config file, for example:
cat << EOF > ~/.digrc
+noall
+answer
EOF
Continue reading
- ddgr: DuckDuckGo from the terminal
- fname: Generate random, human-friendly names
Articles of Note
Tip of the Week
Reading man pages and getting help:
# on macOS, use Preview to open a man page:
% preman() { mandoc -T pdf "$(/usr/bin/man -w $@)" | open -fa Preview; }
% preman <command>
# alternatively, with `ps2pdf`:
% preman() { man -t tr | ps2pdf - | open -fa Preview; }
# open man page in a separate Terminal window:
% xmanpage() { open x-man-page://"$1"; }
% xmanpage <command>
# search man page titles:
% man -k <name>
# search man page contents:
% man -f <term>
# search user curated examples:
% curl cheat.sh/<topic>
Ref: On viewing man pages
Continue reading
- kube-linter: A static analysis tool that checks Kubernetes YAML to best practices
- shunit2: A xUnit based unit test framework for Bourne based shell scripts
Articles of Note
Tip of the Week
Easily transform strings:
# reverse a string
% echo "this is a string" | rev
gnirts a si siht
# split a string
% echo "this is a string" | cut -d' ' -f1,4
this string
# make uppercase and lowercase
% foo="My String"
% echo $foo | tr '[:upper:]' '[:lower:]'
my string
% echo ${foo:u} # or ${foo^^} in Bash
MY STRING
% echo ${foo:l} # or ${foo,,} in Bash
my string
# remove repeat letters
% bar="pool breeze puzzle tattoo"
% echo $bar | tr -s "ot"
pol breeze puzzle tato
% echo $bar | tr -s {a-z} # {a-z} expands to all letters
pol breze puzle tato
# delete characters
% echo $bar | tr -d "aeiou"
pl brz pzzl ttt
Continue reading
- vhs: Your CLI home video recorder
- radio-cli: A simple radio CLI written in rust
Articles of Note
Tip of the Week
Get information about files:
# print lines, word count, and byte size:
% cat << EOF > /tmp/file.txt
It's a jetpack, Michael. What could go wrong?
You are a worse psychiatrist than you are a son-in-law and you will never get work as an actor because you have no talent.
If you're suggesting I play favorites, you're wrong. I love all of my children equally. I don't care for Gob.
EOF
% wc /tmp/file1.txt
3 52 279 file.txt # 3 lines, 52 words, 279 bytes
# `stat` is a highly customizable program to show file and system info:
% stat file.txt
File: file.txt
Size: 279 Blocks: 8 IO Block: 4096 regular file
Device: 1,18 Inode: 33788754 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 501/ bfrank) Gid: ( 0/ wheel)
Access: 2022-11-03 21:27:10.235710583 -0400
Modify: 2022-11-03 21:27:07.537350066 -0400
Change: 2022-11-03 21:27:07.537350066 -0400
Birth: 2022-11-03 21:25:29.005628590 -0400
% stat -c "%F" /tmp/file.txt # %F = file type
regular file
# `file` shows file type and metadata
% file /tmp/file.txt
file.txt: ASCII text
% file --mime-type file.txt
file.txt: text/plain
Continue reading