cliday

  • About

2023-01-27

January 27, 2023

CLI Tools

  1. tut: TUI for Mastodon with vim inspired keys
  2. sampler: Tool for shell commands execution, visualization and alerting

Interesting Links

  1. Gather Linux system info with CPU-X
  2. Free up space on your Linux system with this open source tool
  3. 5 Factors When Considering FreeBSD vs. Linux: Packages

Tip of the Week

Working with data formats:

# create json with https://github.com/jpmens/jo
% foo="$(jo -p cities=$(jo boston=ma miami=fl seattle=wa))"

# interact with json with https://github.com/noahgorstein/jqp
% echo "$foo" | jqp

# read and manipulate json with https://github.com/stedolan/jq
% echo "$foo" | jq '.cities.boston'
"ma"

# convert json to yaml with https://github.com/kislyuk/yq
% echo "$foo" | yq -y .
cities:
  boston: ma
  miami: fl
  seattle: wa

# convert json to xml
% echo "$foo" | yq -x .
<cities>
  <boston>ma</boston>
  <miami>fl</miami>
  <seattle>wa</seattle>
</cities>

# covert toml to json to yaml
% cat << EOF > /tmp/toml
[servers]

[servers.alpha]
ip = "10.0.0.1"
role = "frontend"

[servers.beta]
ip = "10.0.0.2"
role = "backend"
EOF

% cat /tmp/toml | tomlq -c | yq -y .
servers:
  alpha:
    ip: 10.0.0.1
    role: frontend
  beta:
    ip: 10.0.0.2
    role: backend
Continue reading

2023-01-20

January 20, 2023

CLI Tools

  1. gitignore.io: Create useful .gitignore files for your project
  2. YouPlot: A command line tool that draw plots on the terminal

Interesting Links

  • Unix/Linux Command Combinations That Every Developer Should Know
  • Founder of FreeDOS recounts the story so far, and the future
  • 20 Things I’ve Learned in my 20 Years as a Software Engineer
  • CHM Makes Apple Lisa Source Code Available to the Public

Tip of the Week

Break up long single-line strings over multiple lines:

# newlines will be concatenated without added spaces
printf "%s\n" \
  "Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering " \
  "animata corpora quaeritis. Summus brains sit, morbo vel maleficia? De apocalypsi gorger " \
  "omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil " \
  "stalking monstra adventus resi dentevil vultus comedat cerebella viventium."
Continue reading

2023-01-13

January 13, 2023

CLI Tools

  1. nexe: Create a single executable out of your node.js apps
  2. git-absorb: git commit --fixup, but automatic

Interesting Links

  • The forgotten mistake that killed Japan’s software industry
  • Linux: find Windows 10/11 OEM product key command
  • Terminals and pseudoterminals

Tip of the Week

Using shell history to be quick and efficient:

  • The ‘arrow-up’ key inserts your previous command
  • Use ctrl-r keyboard shortcut to search through your history
  • Zsh has a builtin r (alias for fc -e -) command:
      % kubectl --context dev-gke get pods -n namespace
      % r dev=prod
      kubectl --context prod-gke get pods -n namespace
    
  • The history command, which is really just fc, has numerous flags:
    • fc alone open your editor of choice to edit the last command
    • fc -l prints your recent history
    • fc <num> opens your editor with the command with that history ID
    • fc <num> <num> edits commands in that range
    • fc -s <num> runs the command without editing
  • The ever-popular !! for executing the previous command without editing
    • !!:s/foo/bar executes the last command, replacing the first ‘foo’ with ‘bar’ (like r)
    • !!:gs/foo/bar is the same as above, except replacing all instances of ‘foo’
    • !!:$ inserts the last argument from the previous command into your new command (aliased to !$)
        % mkdir /tmp/baz
        % cd !$
        cd /tmp/baz
      

You can find more info in Unix Power Tools, 3rd Edition.

Continue reading

2023-01-06

January 6, 2023

CLI Tools

  1. wtf: The personal information dashboard for your terminal
  2. euporie: Jupyter notebooks in the terminal

Interesting Links

  • Telegraph and the Unix Shell
  • The Year 2038 Problem
  • Historical Source Code That Every Developer Should See
  • A year of building for the terminal

Tip of the Week

Tips for managing your SSH keys:

# Generate cryptographically strong keys:
ssh-keygen -t ed25519
ssh-keygen -t rsa -b 4096  # the bit-length is important, see below

# Regenerate a public key from a private key:
ssh-keygen -yf /path/to/private-key > /path/to/public-key.pub

# Update your passphrase (entering a new blank passphrase effectively removes the passphrase):
ssh-keygen -pf /path/to/private-key

# Show key info (fingerprint):
ssh-keygen -lf /path/to/keyfile

For more information:

  • On key strength and bit-length: Comparing SSH Keys
  • How to manage SSH keys with 1Password
  • Managing ssh-agent with keychain
Continue reading

2022-12-16

December 16, 2022

CLI Tools

  1. gh-dash: A beautiful CLI dashboard for GitHub
  2. arttime: A cross-platform application that blends the beauty of text-art with functionality of clock / timer / pattern-based time manager

Interesting Links

  • What did Unix fans learn from the end of Unix workstations?
  • How to schedule tasks using the Linux ‘at’ command
  • Initial Support for Rust in the Linux Kernel Is Finally Released
  • Highlights from Git 2.39

Tip of the Week

Now that we have a decent corpus of CLI tools from #cliday, here’s a handy “one-liner” to pull down a full list:

# these commands assume BSD versions (i.e. macOS)
curl -LJs https://github.com/bradleyfrank/cliday/tarball/gh-pages \
  | tar -xOzf - --strip-components=2 "bradleyfrank-cliday-*/_posts" \
  | grep -E '^(1|2)\.\s\[.*\]\(.*\):\s.*$' \
  | cut -d' ' -f2- \
  | sort

# curl: follow redirects, use the server-provided filename, and be silent
# tar: extract, to stdout, decompress with gzip, the file _from_ stdin
# grep: use extended regex, finding lines matching markdown links
# cut: use a space for a delimiter, show everything from field #2 on
# sort: alphabetize the output

Slightly more fancy, pipe it through glow:

curl -LJs https://github.com/bradleyfrank/cliday/tarball/gh-pages \
  | tar -xOzf - --strip-components=2 "bradleyfrank-cliday-*/_posts" \
  | grep -E '^(1|2)\.\s\[.*\]\(.*\):\s.*$' \
  | sed -r "s/^(1|2)\./-/g" \
  | sort \
  | glow -

# sed: with extended regex, replace the ordered list with unordered list
# glow: pipe from stdin
Continue reading
Prev Next

Powered by Jekyll with Type Theme