1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
dece 5ab4f60b0b gemtext-index 2022-02-10 19:29:58 +01:00
dece 2fbb5b1d53 update-manually-installed-software 2022-02-10 19:29:52 +01:00
2 changed files with 58 additions and 0 deletions

18
gemtext-index.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
# Create a Gemtext index from the files in the directory and their main title.
# Spaces in file names are escaped (but not tabs or other heresies).
usage() {
echo "Usage: $0 [-h] [DIR]"
echo "Print a Gemtext index of the directory."
echo " -h show usage"
echo " DIR use this directory instead of the working dir"
}
[[ "$1" == "-h" ]] && usage && exit 0
DIR="${1:-.}"
for file in "$DIR"/*.gmi; do
title="$(head -n 1 "$file" | cut -c 3-)"
echo "=> ${file// /%20} $title"
done

View file

@ -0,0 +1,40 @@
#!/bin/zsh -e
# Short Zsh script to compare some of my manually installed software against
# what is apparently available on Github, PyPI or whatever remote hell.
# Requires curl.
GH="https://github.com"
GH_TAIL="releases/latest"
get_latest_tag() {
redirect="$(curl "$1" -v 2>&1 | grep "^< location:")"
echo "${redirect##*/}"
}
check_neovim() {
echo "# Neovim"
echo "Installed: $(nvim -v | head -n 1)"
echo "Available: $(get_latest_tag "$GH/neovim/neovim/$GH_TAIL")"
}
check_alacritty() {
echo "# Alacritty"
echo "Installed: $(alacritty -V)"
echo "Available: $(get_latest_tag "$GH/alacritty/alacritty/$GH_TAIL")"
}
check_cheat() {
echo "# Cheat"
echo "Installed: $(cheat -v)"
echo "Available: $(get_latest_tag "$GH/cheat/cheat/$GH_TAIL")"
}
check_python_packages() {
echo "# Python user packages"
pip3 list -o --user
}
(( $+commands[nvim] )) && check_neovim
(( $+commands[alacritty] )) && check_alacritty
(( $+commands[cheat] )) && check_cheat
check_python_packages