From bca1293df3b26bcb280ca0463e993ea2931365f9 Mon Sep 17 00:00:00 2001 From: rpriven Date: Mon, 9 Jun 2025 20:51:46 -0600 Subject: [PATCH] Added tools.yaml and fre.sh --- espanso/.config/espanso/match/base.yml | 33 +++++ fre.sh | 111 ++++++++++++++ tools.yaml | 191 +++++++++++++++++++++++++ zsh/.aliases | 2 + 4 files changed, 337 insertions(+) create mode 100755 fre.sh create mode 100644 tools.yaml diff --git a/espanso/.config/espanso/match/base.yml b/espanso/.config/espanso/match/base.yml index 3a563e3..b7443ec 100644 --- a/espanso/.config/espanso/match/base.yml +++ b/espanso/.config/espanso/match/base.yml @@ -76,6 +76,39 @@ matches: ## Resources + - trigger: :tfi + replace: | + --- + solved: + bonus_flag: + flag: + link: + --- + + We find the link in Chapter 4 of the comic: + + https://tficomic.io/ + + We visit the link (which expands to: ) and we get the bonus flag: + + ``` + + ``` + + And the real challenge is: + + " + + " + + + + And we get the flag: + + ``` + + ``` + - trigger: :meat replace: 🥩 search_terms: diff --git a/fre.sh b/fre.sh new file mode 100755 index 0000000..8ecb752 --- /dev/null +++ b/fre.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash +set -euo pipefail + +TOOLS_FILE="$(dirname "$0")/tools.yaml" +LOGFILE="$(dirname "$0")/quick-install.log" + +log() { echo "[INFO] $(date '+%F %T') $*" | tee -a "$LOGFILE"; } +log_warn() { echo "[WARN] $(date '+%F %T') $*" | tee -a "$LOGFILE"; } +log_err() { echo "[ERROR] $(date '+%F %T') $*" | tee -a "$LOGFILE"; } + +require_tools() { + for tool in yq gum; do + if ! command -v "$tool" &>/dev/null; then + log_err "This script requires '$tool'. Please install it first." + exit 1 + fi + done +} + +get_tools_for_category() { + local category="$1" + yq e ".${category}[]" "$TOOLS_FILE" +} + +check_and_prepare_install_list() { + local category="$1" + local install_list=() + local ppas_to_add=() + + # Read each item (YAML block) in the category + local length + length=$(yq e "length(.${category})" "$TOOLS_FILE") + for i in $(seq 0 $((length - 1))); do + local name ppa + name=$(yq e ".${category}[$i].name" "$TOOLS_FILE") + ppa=$(yq e ".${category}[$i].ppa // \"\"" "$TOOLS_FILE") + + if ! command -v "$name" &>/dev/null; then + install_list+=("$name") + if [[ -n "$ppa" ]]; then + ppas_to_add+=("$ppa") + fi + fi + done + + # Remove duplicate PPAs + mapfile -t ppas_to_add < <(printf '%s\n' "${ppas_to_add[@]}" | sort -u) + + echo "${install_list[*]}" + echo "${ppas_to_add[*]}" +} + +install_category() { + local category="$1" + + log "Processing category: $category" + + read -r -a to_install ppas < <(check_and_prepare_install_list "$category") + + if [[ ${#to_install[@]} -eq 0 ]]; then + log "All tools in '$category' are already installed." + return + fi + + # Show the user what will be installed + gum style --foreground 212 --bold "Category: $category" + gum style --foreground 99 "The following tools will be installed:" + printf '%s\n' "${to_install[@]}" | gum format + + if ! gum confirm "Proceed with installing these tools?"; then + log_warn "User declined installation for category: $category" + return + fi + + # Add PPAs if any + if [[ ${#ppas[@]} -gt 0 ]]; then + for ppa in "${ppas[@]}"; do + log "Adding PPA: $ppa" + sudo add-apt-repository -y "$ppa" + done + sudo apt update + fi + + log "Installing packages for category: $category" + sudo apt install -y "${to_install[@]}" +} + +main() { + require_tools + log "Starting tool installation from $TOOLS_FILE" + + # Read all top-level categories from tools.yaml + mapfile -t categories < <(yq e 'keys | .[]' "$TOOLS_FILE") + + # Let user select categories to install + selected_categories=$(gum choose --no-limit --header "Select categories to install:" "${categories[@]}") + + if [[ -z "$selected_categories" ]]; then + log_warn "No categories selected. Exiting." + exit 0 + fi + + # Loop through selected categories and install + while IFS= read -r category; do + install_category "$category" + done <<< "$selected_categories" + + log "✅ All done." +} + +main "$@" diff --git a/tools.yaml b/tools.yaml new file mode 100644 index 0000000..b8c7edc --- /dev/null +++ b/tools.yaml @@ -0,0 +1,191 @@ +# tools.yaml + +necessities: + - apt + - apt-utils + - curl + - fd-find + - fzf + - git + - gnupg + - gzip + - jq + - less + - lsb-release + - nala + - ncdu + - net-tools + - ripgrep + - sed + - sudo + - tar + - tmux + - tree + - unzip + - util-linux + - vim + - wget + - xclip + - xxd + - zoxide + - zsh + +privacy: + - age + - aide + - clamav + - clamtk + - gpgv + - keepassxc + - lynis + - mat2 + - mullvad-browser + - protonvpn-cli + - protonvpn-stable-release + - veracrypt + +modern_cli: + - bat + - btop + - delta + - duf + - dust + - entr + - exa + - fd-find + - gitui + - helix + - micro + - most + - nnn + - procs + - silversearcher-ag + - taskwarrior + - tldr + - tig + +dev: + - build-essential + - cmake + - docker + - docker-buildx + - docker-compose + - gcc-12-base + - jq + - libclang-dev + - npm + - openjdk-17-jre + - pipx + - pkg-config + - python3-pip + - shellcheck + - vite + +desktop: + - alacritty + - cmatrix + - feh + - flameshot + - kitty + - neofetch + - onlyoffice-desktopeditors + - pdfsam + - redshift-gtk + - remmina + - ulauncher + - vlc + - wezterm + +pentest: + - auditd + - binwalk + - fail2ban + - fping + - foremost + - gvm + - hashcat + - hashid + - john + - nmap + - steghide + - tcpdump + - testdisk + - tshark + +other: + - aptitude + - deborphan + - debsums + - entr + - evolution + - iproute2 + - iputils-ping + - login + - netcat-openbsd + - screen + - software-properties-common + - stow + - systemd-timesyncd + - unzip + - usbutils + - xdotool + - xsel + +wishlist: + - atuin # shell history sync + - glow # markdown preview + - dua-cli # disk usage analyzer + +go_tools: + - code_helper + - fabric + - glow + - gum + - hugo + - katana + - lazygit + - nuclei + - pdtm + - termshark + - to_pdf + - vhs + +rust_tools: + - atac + - atuin + - bandwhich + - cargo -> rustup + - cargo-clippy -> rustup + - cargo-fmt -> rustup + - cargo-make + - cargo-miri -> rustup + - clippy-driver -> rustup + - duf + - dust + - eza + - fubar + - gping + - hexyl + - just + - makers + - navi + - onefetch + - oniux + - procs + - rls -> rustup + - rust-analyzer -> rustup + - rust-gdb -> rustup + - rust-gdbgui -> rustup + - rust-lldb -> rustup + - rust-script + - rustc -> rustup + - rustdoc -> rustup + - rustfmt -> rustup + - rustup + - sd + - taskwarrior + - tokei + - ttyper + - xh + - zellij + diff --git a/zsh/.aliases b/zsh/.aliases index 550b130..3350fc2 100644 --- a/zsh/.aliases +++ b/zsh/.aliases @@ -54,6 +54,7 @@ alias dc=docker-compose f() { fd $1 -exec bat {} + } +alias i='sudo apt install' alias j='journalctl -f' alias jj='pbpaste | jsonpp | pbcopy' alias jjj='pbpaste | jsonpp' @@ -77,6 +78,7 @@ alias vp='fd --type f --hidden --exclude .git | fzf --preview "bat {1} --color=a alias vv='hx $(fzf --preview="bat {} --color=always")' alias gr='glow $(fzf --preview="bat {} --color=always")' alias xx='exit' +alias eixt='exit' alias yy='yazi'