Just some stuff about me.
Here's my dotfiles repository.
What links here:
written in Go - compiled, cross-platform, simple, single binary. even on a minimal OS, you just need to curl the binary from Github releases, extract the tar.gz, and you can immediately use it.
Vim key bindings out of the box. including things like marks.
client-server model. no need for tabs, just open multiple terminals/tmux splits/whatever with lf instances and copy-paste between them.
uses the XDG specification by default.
keeps track of selected files in a simple way. ~/.local/share/files: first line is mode (move/copy), rest are filenames. you determine the separator.
configurable in shell. which really just means configurable in any language. want to do shell script only? fine. want to call out to a program in Python that interfaces with a Rust library? fine. want to use a perl one-liner? fine. also, you choose the shell. as long as it’s POSIX-compatible.
here’s how powerful it is. Want to create a transient C program that gets compiled on the fly and then removed? Sure:
cmd crazy_command !{{
execfile="$(mktemp)"
trap 'rm $f' INT TERM EXIT
cc -x c -o "$execfile" - <<'EOF' \
&& "$execfile" $fx
#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[]) {
printf("Running as %s\n", argv[0]);
printf("argnum\tfname length\tfname\n");
for (unsigned long i = 1; i < argc; ++i) {
printf("%lu\t%lu\t%s\n", i, strlen(argv[i]), argv[i]);
}
}
EOF
rm "$execfile"
trap - INT TERM EXIT
}}
Or let’s say you have an nginx log like this and select it:
172.31.15.176 - - [03/Oct/2019:06:54:09 +0000] "GET / HTTP/1.1" 200 5127 "-" "ELB-HealthChecker/2.0"
172.31.41.111 - - [03/Oct/2019:06:54:55 +0000] "GET /api/dataset/csv HTTP/1.1" 401 15 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"
172.31.15.176 - - [03/Oct/2019:07:03:00 +0000] "GET / HTTP/1.1" 499 0 "-" "ELB-HealthChecker/2.0"
You can create a function to visualize all response codes with an image from http.cat:
cmd lookup_code ${{
tmp=$(mktemp)
trap 'rm $tmp' INT TERM EXIT
grep '"GET ' $f \
| cut -d'"' -f3 \
| cut -d' ' -f2 \
| while read -r code; do
curl -sL https://http.cat/"$code" -o "$tmp" \
&& sxiv $tmp >/dev/null 2>&1
done
rm "$tmp"
trap - INT TERM EXIT
}}