cliday

  • About

2023-04-07

April 7, 2023

CLI Tools

  1. taskwarrior: Command line Task Management
  2. zellij: A terminal workspace with batteries included

Interesting Links

  1. JSON vs XML
  2. New buckling spring keyboards recreate IBM’s iconic Model F for modern computers

Tip of the Week

How to get more functionality from a tmux popup window:

For a basic popup window that can be moved around the screen, the command is :display-popup. This requires Ctrl-C to close, and you lose the work done on that screen (i.e. it’s not a tmux pane).

The first trick is to make the popup into a nested tmux window: :display-popup -E "tmux new-session -A -s popup". Now you can can issue a disconnect command (prefix + d) and reattach to that session using the same :display-popup command again.

If you’d rather not have recursive tmux sessions (that is, you want a completely separate tmux server running in the popup), you can tell tmux to start a new server by using a different socket: :display-popup -E "tmux -L popup-socket new-session -A -s popup".

If your tmux is heavily customized and you want a minimal or different tmux profile instead, you can specify the config to use: :display-popup -E "tmux -L popup-socket -f /opt/homebrew/opt/tmux/share/tmux/example_tmux.conf new-session -A -s popup".

Popup windows are further customizable; for example, you can set width and height: :display-popup -E -w 50% -h 50% "tmux new-session -A -s popup".

And finally, you can bind it all to a shortcut: bind 'P' display-popup -E "tmux -L popup-socket -f /opt/homebrew/opt/tmux/share/tmux/example_tmux.conf new-session -A -s popup".

Continue reading

2023-03-31

March 31, 2023

CLI Tools

  1. autocomplete: IDE-style autocomplete for your existing terminal & shell
  2. nerdctl: Docker-compatible CLI for containerd, with support for Compose, Rootless, eStargz, OCIcrypt, IPFS, …

Interesting Links

  1. Nix Turns 20. What the Hell Is It?
  2. Nostalgic for VB? BASIC is anything but dead
  3. Understanding the Origins of DTrace
  4. The Origin of the word Daemon
  5. Use sysfs to restart failed PCI devices

Tip of the Week

Quickly bookmark a command from your history:

# view your recent commands:
% history  # this is equivalent to `fc -l`

# show a specific range from history:
% fc -l <start> <end>  # e.g. `fc -l 5 10` to show the 5th through 10th entries

# drop the index number to get just the command:
% fc -ln

# pipe the results to `fzf` to make selection easier:
% fc -ln | fzf -1 -0 --multi

# and finally append the selection to a file for reference:
% fc -ln | fzf -1 -0 --multi >> /path/to/command/history

# wrap it in a function, with some default values, to call anytime:
% cmdbookmark() { fc -ln "${1:-1}" "${2:--1}" | fzf -1 -0 --multi >> /path/to/command/history; }
Continue reading

2023-03-24

March 24, 2023

CLI Tools

  1. git-sim: Visually simulate Git operations in your own repos with a single terminal command
  2. enhancd: A next-generation cd command with your interactive filter

Interesting Links

  1. So you’ve installed fzf. Now what?
  2. Bringing my GitHub workflow into Neovim using 1Password CLI
  3. I’m Now a Full-Time Professional Open Source Maintainer
  4. Use sysfs to restart failed PCI devices

Tip of the Week

Creating files with defined sizes:

# method 1: create a full file
% dd if=/dev/zero of=/tmp/disk1.img bs=2GB count=1
% du -h /tmp/disk1.img
1.9G    /tmp/disk1.img
% du -h --apparent-size /tmp/disk1.img
1.9G    /tmp/disk1.img

# method 2: create a sparse file
% truncate -s 2GB /tmp/disk2.img
% du -h /tmp/disk2.img
0       /tmp/disk2.img
% du -h --apparent-size /tmp/disk2.img
1.9G    /tmp/disk2.img

# method 3: create a file with reserved space
% fallocate -l 2GB /tmp/disk3.img
% du -h /tmp/disk3.img
1.9G    /tmp/disk3.img
% du -h --apparent-size /tmp/disk3.img
1.9G    /tmp/disk3.img
Continue reading

2023-03-17

March 17, 2023

CLI Tools

  1. toipe: yet another typing test, but crab flavoured
  2. ov: Feature-rich terminal-based text viewer

Interesting Links

  1. Highlights from Git 2.40
  2. Disambiguating Arm, Arm ARM, Armv9, ARM9, ARM64, Aarch64, A64, A78, …
  3. cURL, the omnipresent data tool, is getting a 25th birthday party this month

Tip of the Week

Performing arithmetic in Bash:

% count=0
% ((count+=5))  # increment variable
% echo $count   # prints "5"

% i=$((count+5))
% echo $count   # prints "5"
% echo $i       # prints "10"

% echo "10 / 3" | bc            # prints "3"
% echo "10 / 3" | bc -l         # prints "3.33333333333333333333"
% echo "scale=2; 10/3" | bc -l  # prints "3.33"
% echo "3^2" | bc               # prints "9"
Continue reading

2023-03-10

March 10, 2023

CLI Tools

  1. countryfetch: A cli tool for fetching information about countries
  2. erdtree: A multi-threaded file-tree visualizer and disk usage analyzer

Interesting Links

  1. 3 fundamental tools to troubleshoot Linux performance problems
  2. A new version of APT is coming to Debian 12
  3. Some possible reasons for 8-bit bytes
  4. How to run containers on Mac with Podman
  5. Zellij Adds Stacked Panes and Swap Layouts
  6. Who created the idea(s) of the first loop constructs?

Tip of the Week

Displaying text in the terminal:

# because I like this trick: download three paragraphs of lorem ipsum:
% curl -s -X POST https://lipsum.com/feed/json -d "amount=3" -d "what=paras" -d "start=true" \
  | jq -r '.feed.lipsum' | fmt -w 80 > /tmp/lorem.txt

cat /tmp/lorem.txt     # print entire file, not scrollable
cat -n /tmp/lorem.txt  # prints entire file with line numbers
view /tmp/lorem.txt    # opens the file in Vim in read-only mode
more /tmp/lorem.txt    # print with scroll down, clears the screen at exit
less /tmp/lorem.txt    # print with bidirectinal scroll, clears the screen at exit, configurable
bat /tmp/lorem.txt     # includes syntax highlighting; see `https://github.com/sharkdp/bat`

# using `head` and `tail`:
tail -n2 /tmp/lorem.txt  # print the last two lines
tail -n+2 /tmp/lorem.txt  # print all but the first two lines
head -n2 /tmp/lorem.txt  # print the first two lines
head -n-2 /tmp/lorem.txt  # print all but the last two lines
Continue reading
Next

Powered by Jekyll with Type Theme