cliday

  • About

2022-06-03

June 3, 2022

  1. fd: A simple, fast and user-friendly alternative to ‘find’
  2. bandwhich: Terminal bandwidth utilization tool
  3. fileicon: macOS CLI for managing custom icons for files and folders

Tip of the week: How to batch install Homebrew packages for a quick bootstrap:

# On the existing system, dump all installed packages (taps, formulas, casks, and app store):
% brew bundle dump
# This creates a 'Brewfile' in the current directory:
% cat Brewfile
# Copy this file to a new system and run:
% brew bundle install
# To keep your system up-to-date using this method check out:
% brew bundle --help
# Pair this with `stow` to quickly install dotfiles and get a new system running in no time!
Continue reading

2022-05-27

May 27, 2022

  1. lazydocker: The lazier way to manage everything docker
  2. fzf: A command-line fuzzy finder
  3. git-xargs: Make updates across multiple Github repositories with a single command

Tip of the week: How to make a loading animation:

frames="/ | \ -"
while :; do
for f in $frames; do printf "
%s Loading..." "$f"; sleep 0.5; done
done
Continue reading

2022-05-20

May 20, 2022

  1. exa: A modern replacement for ls
  2. buku: Personal mini-web in text
  3. treeage: Listing contents of repository in a tree-like format with age metric

Tip of the week: Move around directories quickly with various Zsh builtin methods:

# Return immediately to the previous directory:
% cd -

# With zsh, enable auto_cd [in ~/.zshrc] to move around without `cd`:
% setopt auto_cd
% .. # Go up a directory
% ../foo # Go up a directory and enter the 'foo' directory
% ../.. # Go up two directories

# Set a "bookmarked" directory once auto_cd is enabled:
% cdpath=(/path/to/important_directory)
% cd important_directory/subdirectory

# Keep a running list of directories visited:
% setopt auto_pushd
% cd /usr/local/bin; cd ~/.local/bin; cd ~/.config/gcloud
% echo $dirstack # See your directory stack
% cd -2 # Jump to element '2' in the stack (counting from the right, starting at zero)
% cd +1 # Jump to element '1' in the stack (counting from the left, starting at zero)

# Now the fun begins:
% setopt pushd_ignore_dups # Prevent duplicates in the stack
% cd "$(printf '%s
' "${dirstack[@]}" | fzf)"
Continue reading

2022-05-13

May 13, 2022

  1. tablemark-cli: Generate markdown tables from JSON data
  2. gh-cli: GitHub’s official command line tool
  3. bandwhich: Terminal bandwidth utilization tool

Tip of the week: Quickly retrieve a deleted file from a Git repository:

% file="./repo/path/to/file"
git checkout $(git rev-list -n 1 HEAD -- "$file")~1 -- "$file"

Don’t know the full path of the file?

% filename="filename"
% sha="$(git log --all --full-history -1 --format=%H -- "**/$filename.*")" && \
git checkout "$sha"~1 -- "$(git diff-tree --no-commit-id --name-only -r "$sha" | grep "$filename")"
Continue reading

2022-05-06

May 6, 2022

  1. git-sweep: Clean up Git branches that have been merged into master
  2. bat: A cat(1) clone with wings
  3. rdfind: find duplicate files utility

Tip of the week: You can avoid manually working with temp files by using ZSH process substitution:

Example:

% echo "Banana
Apple
Cucumber" > /path/to/file1
% sort /path/to/file1 > /path/to/file1 # Fails!

# Solution with a temp file:
% temp1=$(mktemp)
% sort /path/to/file1 > "$temp1"
% mv "$temp1" /path/to/file1

# Solution with process substitution:
% mv =(sort /path/to/file1) /path/to/file1
Continue reading
Prev Next

Powered by Jekyll with Type Theme