diff --git a/README.mkdn b/README.mkdn index d412037..7ba7e62 100644 --- a/README.mkdn +++ b/README.mkdn @@ -17,3 +17,7 @@ Tips Set updated_at on a post in vim: :r! ruby -rtime -e "puts File.mtime('%:r.md').xmlschema" + +Trim CLI screenshots: + + convert *.png -set filename:name '%t' -background white -splice 0x1 -background white -splice 0x1 -trim +repage -chop 0x1 '%[filename:name].png' diff --git a/content/screen.sass b/content/screen.sass index 2a2e39c..eeccf18 100644 --- a/content/screen.sass +++ b/content/screen.sass @@ -241,6 +241,10 @@ footer max-width: 1200px min-height: 85vh +.cli-tools + h3 + margin-top: 4em + #posts width: 100% diff --git a/content/technical/2019/04/lobsters-tui.md b/content/technical/2019/04/lobsters-tui.md index bb9a204..8caa72e 100644 --- a/content/technical/2019/04/lobsters-tui.md +++ b/content/technical/2019/04/lobsters-tui.md @@ -95,12 +95,12 @@ In addition to async and TUI I also learned more about: Whilst the library and UI aren't especially useful the exercise was worth it. I got to practice a bunch of things and learn some new ones at the same time. - + [Comments on Lobsters](https://lobste.rs/s/nono6k/what_i_learnt_building_lobsters_tui_rust)


Previous Post: [Cross Compiling Rust for FreeBSD With Docker](/technical/2019/03/cross-compile-freebsd-rust-binary-with-docker/) - +Next Post: [An Illustrated Guide to Useful Command Line Tools](/technical/2019/10/useful-command-line-tools/) [repo]: https://git.sr.ht/~wezm/lobsters [ansi_term]: https://crates.io/crates/ansi_term diff --git a/content/technical/2019/10/useful-command-line-tools.md b/content/technical/2019/10/useful-command-line-tools.md new file mode 100644 index 0000000..936e192 --- /dev/null +++ b/content/technical/2019/10/useful-command-line-tools.md @@ -0,0 +1,333 @@ +Inspired by [a similar post by Ben Boyter][boyter] this a list of useful +command line tools that I use. It's not a list of every tool I use. These are +tools that are new or typically not part of a standard POSIX command line +environment. + +This post is a living document and will be updated over time. It should be +obvious that I have a **strong** preference for fast tools without a large +runtime dependency like Python or node.js. Most of these tools are portable +to \*BSD, Linux, macOS. Many also work on Windows. For OSes that ship up +to date software many are available via the system package repository. + +**About my CLI environment:** I use the [zsh] shell, [Pragmata Pro] font, and +[base16 default dark][base16] color scheme. My prompt is generated by +[promptline]. + +## Table of Contents + +* [Alacritty](#alacritty) +* [alt](#alt) +* [bat](#bat) +* [chars](#chars) +* [dot](#dot) +* [dust](#dust) +* [eva](#eva) +* [exa](#exa) +* [fd](#fd) +* [hexyl](#hexyl) +* [jq](#jq) +* [mdcat](#mdcat) +* [pass](#pass) +* [Podman](#podman) +* [Restic](#restic) +* [ripgrep](#ripgrep) +* [shotgun](#shotgun) +* [skim](#skim) +* [slop](#slop) +* [Syncthing](#syncthing) +* [tig](#tig) +* [titlecase](#titlecase) +* [Universal Ctags](#ctags) +* [watchexec](#watchexec) +* [z](#z) +* [zola](#zola) + + +### Alacritty ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +Alacritty is fast terminal emulator. Whilst not strictly a command line tool, it +does host everything I do in the command line. It is the terminal emulator in use +in all the screenshots on this page. + +Homepage + + +### alt ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`alt` is a tool for finding the alternate to a file. E.g. the header for an +implementation or the test for an implementation. I use it paired with Neovim +to easily toggle between tests and implementation. + + $ alt app/models/page.rb + spec/models/page_spec.rb + +Homepage + + +### bat ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`bat` is an alternative to the common (mis)use of `cat` to print a file to the +terminal. It supports syntax highlighting and git integration. + +![bat screenshot](/images/cli/bat.png) + +Homepage + + +### chars ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`chars` shows information about Unicode characters matching a search term. + +![chars screenshot](/images/cli/chars.png) + +Homepage + + +### dot ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`dot` is a dotfiles manager. It maintains a set of symlinks according to a mappings file. +I use it to manage [my dotfiles][dotfiles]. + +![dot screenshot](/images/cli/dot.png) + +Homepage + + +### dust ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`dust` is an alternative `du -sh`. It calculates the size of a directory tree, printing +a summary of the largest items. + +![dust screenshot](/images/cli/dust.png) + +Homepage + + +### exa ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`exa` is a replacement for `ls` with sensible defaults and added features like a +tree view, git integration, and optional icons. I have `ls` aliased to `exa` in +my shell. + +![exa screenshot](/images/cli/exa.png) + +Homepage + + +### eva ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`eva` is a command line calculator similar to `bc`, with syntax highlighting +and persistent history. + +![eva screenshot](/images/cli/eva.png) + +Homepage + + +### fd ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`fd` is an alternative to `find` and has a more user friendly command line interface +and respects ignore files, like `.gitignore`. The combination of its speed and ignore +file support make it excellent for searching for files in git repositories. + +![fd screenshot](/images/cli/fd.png) + +Homepage + + +### hexyl ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`hexyl` is a hex viewer that uses Unicode characters and colour to make the output more +readable. + +![hexyl screenshot](/images/cli/hexyl.png) + +Homepage + + +### jq ![Language: Go](https://img.shields.io/badge/language-Go-%2300ADD8) + +`jq` is kind of like `awk` for JSON. It lets you transform and extract information from JSON +documents. + +![jq screenshot](/images/cli/jq.png) + +Homepage + + +### mdcat ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`mdcat` renders Markdown files in the terminal. In supported terminals (not +Alacritty) links are clickable (without the url being visible like in a web +browser) and images are rendered. + +![mdcat screenshot](/images/cli/mdcat.png) + +Homepage + + +### pass ![Language: sh](https://img.shields.io/badge/language-sh-%2389e051) + +`pass` is a password manager that uses GPG to store the passwords. I use it with the +[passff] Firefox extension and [Pass for iOS] on my phone. + +![pass screenshot](/images/cli/pass.png) + +Homepage + + +### Podman ![Language: Go](https://img.shields.io/badge/language-Go-%2300ADD8) + +`podman` is an alternative to Docker that does not require a daemon. Containers are run as +the user running Podman so files written into the host don't end up owned by root. The CLI +is largely compatible with the `docker` CLI. + +![podman screenshot](/images/cli/podman.png) + +Homepage + + +### Restic ![Language: Go](https://img.shields.io/badge/language-Go-%2300ADD8) + +`restic` is a backup tool that performs client side encryption, de-duplication and +supports a variety of local and remote storage backends. + +Homepage + + +### ripgrep ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +ripgrep (`rg`) recursively searches file trees for content in files matching a +regular expression. It's extremely fast, and respects ignore files and binary +files by default. + +![ripgrep screenshot](/images/cli/ripgrep.png) + +Homepage + + +### shotgun ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`shotgun` is a tool for taking screenshots on X.org based environments. +All the screenshots in this post were taken with it. It pairs well with +`slop`. + + $ shotgun $(slop -c 0,0,0,0.75 -l -f "-i %i -g %g") eva.png + +Homepage + + +### skim ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`skim` is a fuzzy finder. It can be used to fuzzy match input fed to it. I use it +with Neovim and zsh for fuzzy matching file names. + +![skim screenshot](/images/cli/skim.png) + +Homepage + + +### slop ![Language: C++](https://img.shields.io/badge/language-C%2B%2B-%23f34b7d) + +`slop` (Select Operation) presents a UI to select a region of the screen or a +window and prints the region to stdout. Works well with `shotgun`. + + $ slop -c 0,0,0,0.75 -l -f "-i %i -g %g" + -i 8389044 -g 1464x1008+291+818 + +Homepage + + +### Syncthing ![Language: Go](https://img.shields.io/badge/language-Go-%2300ADD8) + +Syncthing is a decentralised file synchronisation tool. Like Dropbox but self +hosted and without the need for a central third-party file store. + +Homepage + + +### tig ![Language: C](https://img.shields.io/badge/language-C-%23444444) + +`tig` is a ncurses TUI for git. It's great for reviewing and staging changes, viewing +history and diffs. + +![tig screenshot](/images/cli/tig.png) + +Homepage + + +### titlecase ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`titlecase` is a little tool I wrote to format text using a [title case format +described by John Gruber][df-titlecase]. It correctly handles puctuation, and words like +iPhone. I use it to obtain consistent titles on all my blog posts. + + $ echo 'an illustrated guide to useful command line tools' | titlecase + An Illustrated Guide to Useful Command Line Tools + +I typically use it from within Neovim where selected text is piped through it in-place. +This is done by creating a visual selection and then typing: `:!titlecase`. + +Homepage + + +### Universal Ctags ![Language: C](https://img.shields.io/badge/language-C-%23444444) + +Universal Ctags is a fork of exuberant ctags that is actively maintained. +`ctags` is used to generate a `tags` file that `vim` and other tools can use to +navigate to the definition of symbols in files. + + $ ctags --recurse src + +Homepage + + +### watchexec ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`watchexec` is a file a directory watcher that can run commands in response to +file system changes. Handy for auto running tests or restarting a development +web server when source files change. + + # run command on file change + $ watchexec -w content cobalt build + + # kill and restart server on file change + $ watchexec -w src -s SIGINT -r 'cargo run' + +Homepage + + +### z ![Language: sh](https://img.shields.io/badge/language-sh-%2389e051) + +`z` tracks your most used directories and allows you to jump to them with a +partial name. + +![z screenshot](/images/cli/z.png) + +Homepage + + +### zola ![Language: Rust](https://img.shields.io/badge/language-rust-%23dea584) + +`zola` is a full-featured very fast static site compiler. + +![zola screenshot](/images/cli/zola.png) + +Homepage + + + +


+ +Previous Post: [What I Learnt Building a Lobsters TUI in Rust](/technical/2019/04/lobsters-tui/) + + +[boyter]: https://boyter.org/posts/my-list-of-useful-command-line-tools/ +[dotfiles]: https://github.com/wezm/dotfiles +[df-titlecase]: https://daringfireball.net/2008/05/title_case +[base16]: https://github.com/chriskempson/base16 +[Pragmata Pro]: https://www.fsd.it/shop/fonts/pragmatapro/ +[promptline]: https://github.com/edkolev/promptline.vim +[zsh]: https://www.zsh.org/ +[passff]: https://github.com/passff/passff +[Pass for iOS]: https://github.com/mssun/passforios diff --git a/content/technical/2019/10/useful-command-line-tools.yaml b/content/technical/2019/10/useful-command-line-tools.yaml new file mode 100644 index 0000000..b66054b --- /dev/null +++ b/content/technical/2019/10/useful-command-line-tools.yaml @@ -0,0 +1,13 @@ +--- +title: An Illustrated Guide to Useful Command Line Tools +extra: A short description and screenshot of some useful command line tools I use that aren't part of typical POSIX environment. +kind: article +section: technical +created_at: 2019-04-25T16:12:49+10:00 +#updated_at: 2019-03-30T10:02:56+11:00 +article_class: cli-tools +keywords: + - cli + - tools + - rust +short_url: diff --git a/layouts/article.html b/layouts/article.html index 06c68fa..b4bdf98 100644 --- a/layouts/article.html +++ b/layouts/article.html @@ -1,5 +1,5 @@ <% post_date = WezM::Helpers.parse_post_date(@item) %> -
+>

<%=h @item[:title] %>

diff --git a/output/images/cli/bat.png b/output/images/cli/bat.png new file mode 100644 index 0000000..a04aed2 Binary files /dev/null and b/output/images/cli/bat.png differ diff --git a/output/images/cli/chars.png b/output/images/cli/chars.png new file mode 100644 index 0000000..df64f33 Binary files /dev/null and b/output/images/cli/chars.png differ diff --git a/output/images/cli/dot.png b/output/images/cli/dot.png new file mode 100644 index 0000000..3fee650 Binary files /dev/null and b/output/images/cli/dot.png differ diff --git a/output/images/cli/dust.png b/output/images/cli/dust.png new file mode 100644 index 0000000..708dbb3 Binary files /dev/null and b/output/images/cli/dust.png differ diff --git a/output/images/cli/eva.png b/output/images/cli/eva.png new file mode 100644 index 0000000..4266d73 Binary files /dev/null and b/output/images/cli/eva.png differ diff --git a/output/images/cli/exa.png b/output/images/cli/exa.png new file mode 100644 index 0000000..aa48a37 Binary files /dev/null and b/output/images/cli/exa.png differ diff --git a/output/images/cli/fd.png b/output/images/cli/fd.png new file mode 100644 index 0000000..450abf3 Binary files /dev/null and b/output/images/cli/fd.png differ diff --git a/output/images/cli/hexyl.png b/output/images/cli/hexyl.png new file mode 100644 index 0000000..7e30d95 Binary files /dev/null and b/output/images/cli/hexyl.png differ diff --git a/output/images/cli/jq.png b/output/images/cli/jq.png new file mode 100644 index 0000000..c76d343 Binary files /dev/null and b/output/images/cli/jq.png differ diff --git a/output/images/cli/mdcat.png b/output/images/cli/mdcat.png new file mode 100644 index 0000000..60bc031 Binary files /dev/null and b/output/images/cli/mdcat.png differ diff --git a/output/images/cli/pass.png b/output/images/cli/pass.png new file mode 100644 index 0000000..e1903b9 Binary files /dev/null and b/output/images/cli/pass.png differ diff --git a/output/images/cli/podman.png b/output/images/cli/podman.png new file mode 100644 index 0000000..a002ed7 Binary files /dev/null and b/output/images/cli/podman.png differ diff --git a/output/images/cli/ripgrep.png b/output/images/cli/ripgrep.png new file mode 100644 index 0000000..315a3ef Binary files /dev/null and b/output/images/cli/ripgrep.png differ diff --git a/output/images/cli/skim.png b/output/images/cli/skim.png new file mode 100644 index 0000000..28b4a30 Binary files /dev/null and b/output/images/cli/skim.png differ diff --git a/output/images/cli/tig.png b/output/images/cli/tig.png new file mode 100644 index 0000000..cabcd4c Binary files /dev/null and b/output/images/cli/tig.png differ diff --git a/output/images/cli/z.png b/output/images/cli/z.png new file mode 100644 index 0000000..914929c Binary files /dev/null and b/output/images/cli/z.png differ diff --git a/output/images/cli/zola.png b/output/images/cli/zola.png new file mode 100644 index 0000000..943199e Binary files /dev/null and b/output/images/cli/zola.png differ diff --git a/output/images/lobsters.png b/output/images/lobsters.png new file mode 100644 index 0000000..b4be1a6 Binary files /dev/null and b/output/images/lobsters.png differ