From 5ff5a82c9d6f106ba272e1773e91e7e032672dfd Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 2 Mar 2026 04:13:15 -0600 Subject: feat(hyprland): rebind mod+shift+f to allfloat, add chess setup script Add workspace allfloat toggle on mod+shift+f (was togglefloating, now on mod+shift+space only). Add scripts/setup-chess.sh for En Croissant, lc0, Maia, and Stockfish setup. Update log-cleanup to use filename dates instead of mtime. Update ssh and calibre configs. --- .../common/.config/calibre/viewer-webengine.json | 17 +- dotfiles/common/.local/bin/cron/log-cleanup | 26 ++- dotfiles/common/.ssh/config | 2 +- dotfiles/hyprland/.config/hypr/hyprland.conf | 2 +- scripts/setup-chess.sh | 223 +++++++++++++++++++++ 5 files changed, 255 insertions(+), 15 deletions(-) create mode 100755 scripts/setup-chess.sh diff --git a/dotfiles/common/.config/calibre/viewer-webengine.json b/dotfiles/common/.config/calibre/viewer-webengine.json index c06652f..de97884 100644 --- a/dotfiles/common/.config/calibre/viewer-webengine.json +++ b/dotfiles/common/.config/calibre/viewer-webengine.json @@ -66,7 +66,7 @@ }, "main_window_state": { "__class__": "bytearray", - "__value__": "AAAA/wAAAAH9AAAAAgAAAAAAAAAAAAAAAPwCAAAAAvsAAAAQAHQAbwBjAC0AZABvAGMAawAAAAAA/////wAAAIUA////+wAAABYAcwBlAGEAcgBjAGgALQBkAG8AYwBrAAAAAAD/////AAAAkwD///8AAAABAAABeAAAA9X8AgAAAAT7AAAAFgBsAG8AbwBrAHUAcAAtAGQAbwBjAGsAAAAAAAAAA9UAAAB6AP////sAAAAcAGIAbwBvAGsAbQBhAHIAawBzAC0AZABvAGMAawAAAAAAAAAD1QAAAOUA////+wAAABwAaQBuAHMAcABlAGMAdABvAHIALQBkAG8AYwBrAAAAAAD/////AAAAEQD////7AAAAHgBoAGkAZwBoAGwAaQBnAGgAdABzAC0AZABvAGMAawAAAAAA/////wAAAM4A////AAAHJAAABSIAAAAEAAAABAAAAAgAAAAI/AAAAAEAAAAAAAAAAQAAAB4AYQBjAHQAaQBvAG4AcwBfAHQAbwBvAGwAYgBhAHICAAAAAP////8AAAAAAAAAAA==" + "__value__": "AAAA/wAAAAH9AAAAAgAAAAAAAAAAAAAAAPwCAAAAAvsAAAAQAHQAbwBjAC0AZABvAGMAawAAAAAA/////wAAAIoA////+wAAABYAcwBlAGEAcgBjAGgALQBkAG8AYwBrAAAAAAD/////AAAAmgD///8AAAABAAABeAAAA9X8AgAAAAT7AAAAFgBsAG8AbwBrAHUAcAAtAGQAbwBjAGsAAAAAAAAAA9UAAACDAP////sAAAAcAGIAbwBvAGsAbQBhAHIAawBzAC0AZABvAGMAawAAAAAAAAAD1QAAAPIA////+wAAABwAaQBuAHMAcABlAGMAdABvAHIALQBkAG8AYwBrAAAAAAD/////AAAAFAD////7AAAAHgBoAGkAZwBoAGwAaQBnAGgAdABzAC0AZABvAGMAawAAAAAA/////wAAANcA////AAAHJAAABSIAAAAEAAAABAAAAAgAAAAI/AAAAAEAAAAAAAAAAQAAAB4AYQBjAHQAaQBvAG4AcwBfAHQAbwBvAGwAYgBhAHICAAAAAP////8AAAAAAAAAAA==" }, "old_prefs_migrated": true, "session_data": { @@ -106,6 +106,12 @@ "singleinstance": false }, "standalone_recently_opened": [ + { + "key": "/home/cjennings/projects/career/2026-02-27-socom-scope-planning-summary.docx", + "pathtoebook": "/home/cjennings/projects/career/2026-02-27-socom-scope-planning-summary.docx", + "timestamp": "2026-02-28T07:06:07.816Z", + "title": "U.S. Special Operations Command (SOCOM) Technical Experimentation TE26-2" + }, { "authors": [ "Admin" @@ -312,15 +318,6 @@ "pathtoebook": "/home/cjennings/Library/Dieter Lohmar/Founding Psychoanalysis Phenomenologically_ Phenomenological Theory of Subjectivity and the Ps (17064)/Founding Psychoanalysis Phenomenologically - Dieter Lohmar.pdf", "timestamp": "2022-01-01T22:55:44.420Z", "title": "Founding Psychoanalysis Phenomenologically: Phenomenological Theory of Subjectivity and the Psychoanalytic Experience (Phaenomenologica, 199)" - }, - { - "authors": [ - "Kevin Passmore" - ], - "key": "/home/cjennings/Library/Kevin Passmore/Fascism_ A Very Short Introduction (5508)/Fascism_ A Very Short Introduction - Kevin Passmore.mobi", - "pathtoebook": "/home/cjennings/Library/Kevin Passmore/Fascism_ A Very Short Introduction (5508)/Fascism_ A Very Short Introduction - Kevin Passmore.mobi", - "timestamp": "2021-11-01T00:49:09.044Z", - "title": "Fascism: A Very Short Introduction (Very Short Introductions)" } ] } diff --git a/dotfiles/common/.local/bin/cron/log-cleanup b/dotfiles/common/.local/bin/cron/log-cleanup index 651982c..e8d6ac4 100755 --- a/dotfiles/common/.local/bin/cron/log-cleanup +++ b/dotfiles/common/.local/bin/cron/log-cleanup @@ -4,10 +4,30 @@ # Services (hyprland, waybar, dunst, hypridle, gammastep) create a new # timestamped log file per session. Without cleanup these accumulate. # +# Uses the date embedded in filenames (service-YYYY-MM-DD-HHMMSS.log) +# rather than mtime, because long-running sessions keep mtime fresh +# even on old log files. +# # Intended to run daily via crontab. LOG_DIR="$HOME/.local/var/log" +DAYS=7 + +[ -d "$LOG_DIR" ] || exit 0 + +cutoff=$(date -d "$DAYS days ago" +%Y%m%d) -if [ -d "$LOG_DIR" ]; then - find "$LOG_DIR" -name "*.log" -mtime +7 -delete -fi +for f in "$LOG_DIR"/*.log; do + [ -f "$f" ] || continue + # Extract YYYY-MM-DD from filename; skip files without a date + filedate=$(basename "$f" | grep -oP '\d{4}-\d{2}-\d{2}' | head -1) + [ -n "$filedate" ] || continue + # Skip files still being written to (modified in the last 24h). + # This prevents deleting active logs from long-running sessions. + [ -n "$(find "$f" -maxdepth 0 -mtime 0)" ] && continue + # Compare as integers: YYYYMMDD + filedate_num=$(echo "$filedate" | tr -d '-') + if [ "$filedate_num" -lt "$cutoff" ]; then + rm -f "$f" + fi +done diff --git a/dotfiles/common/.ssh/config b/dotfiles/common/.ssh/config index 06a94e6..464975c 100644 --- a/dotfiles/common/.ssh/config +++ b/dotfiles/common/.ssh/config @@ -6,7 +6,7 @@ ServerAliveInterval=5 Host deepsat.ghe.com HostName deepsat.ghe.com - User git + User deepsat IdentityFile ~/.ssh/deepsat-github IdentitiesOnly yes diff --git a/dotfiles/hyprland/.config/hypr/hyprland.conf b/dotfiles/hyprland/.config/hypr/hyprland.conf index 0981dfc..e3b198f 100644 --- a/dotfiles/hyprland/.config/hypr/hyprland.conf +++ b/dotfiles/hyprland/.config/hypr/hyprland.conf @@ -208,7 +208,7 @@ bind = $mod SHIFT, C, killactive # Click waybar layout icon to cycle, or use direct keybindings: bind = $mod SHIFT, T, exec, hyprctl keyword general:layout master && hyprctl keyword master:orientation left bind = $mod SHIFT, S, exec, hyprctl keyword general:layout scrolling -bind = $mod SHIFT, F, togglefloating +bind = $mod SHIFT, F, exec, hyprctl dispatch workspaceopt allfloat bind = $mod SHIFT, SPACE, togglefloating # Master layout adjustments diff --git a/scripts/setup-chess.sh b/scripts/setup-chess.sh new file mode 100755 index 0000000..a19bf1d --- /dev/null +++ b/scripts/setup-chess.sh @@ -0,0 +1,223 @@ +#!/usr/bin/env bash +set -euo pipefail + +# En Croissant + lc0 + Maia + Stockfish setup script +# Targets Arch Linux. No sudo required (prerequisites must be pre-installed). + +APPIMAGE_DIR="$HOME/.local/bin" +APPIMAGE_PATH="$APPIMAGE_DIR/en-croissant.AppImage" +LC0_BIN="$HOME/.local/bin/lc0" +MAIA_WEIGHTS_DIR="$HOME/.local/share/maia" +MAIA_BASE_URL="https://github.com/CSSLab/maia-chess/releases/download/v1.0" +STOCKFISH_TAR_URL="https://github.com/official-stockfish/Stockfish/releases/latest/download/stockfish-ubuntu-x86-64-avx2.tar" +STOCKFISH_DIR="$HOME/.local/share/org.encroissant.app/engines/stockfish" +STOCKFISH_BIN="$STOCKFISH_DIR/stockfish-ubuntu-x86-64-avx2" +ENGINES_JSON="$HOME/.local/share/org.encroissant.app/engines/engines.json" +DESKTOP_FILE="$HOME/.local/share/applications/en-croissant.desktop" + +info() { printf '\033[1;34m==> %s\033[0m\n' "$*"; } +ok() { printf '\033[1;32m -> %s\033[0m\n' "$*"; } +skip() { printf '\033[1;33m -> %s (skipped)\033[0m\n' "$*"; } +err() { printf '\033[1;31mERROR: %s\033[0m\n' "$*" >&2; } + +# --------------------------------------------------------------------------- +# 1. Check prerequisites +# --------------------------------------------------------------------------- +info "Checking prerequisites" + +missing=() +for cmd in git meson ninja python3 curl; do + command -v "$cmd" &>/dev/null || missing+=("$cmd") +done +# Check libraries via pacman +for pkg in openblas eigen; do + pacman -Qi "$pkg" &>/dev/null || missing+=("$pkg") +done + +if (( ${#missing[@]} )); then + err "Missing packages: ${missing[*]}" + echo "Install them with: sudo pacman -S ${missing[*]}" + exit 1 +fi +ok "All prerequisites found" + +# --------------------------------------------------------------------------- +# 2. Install En Croissant AppImage +# --------------------------------------------------------------------------- +info "Installing En Croissant AppImage" + +if [[ -f "$APPIMAGE_PATH" ]]; then + skip "Already exists at $APPIMAGE_PATH" +else + mkdir -p "$APPIMAGE_DIR" + # Get latest release AppImage URL from GitHub API + appimage_url=$(curl -sL "https://api.github.com/repos/franciscoBSalgueiro/en-croissant/releases/latest" \ + | python3 -c "import sys,json; assets=json.load(sys.stdin)['assets']; print([a['browser_download_url'] for a in assets if a['name'].endswith('_amd64.AppImage')][0])") + echo " Downloading: $appimage_url" + curl -L -o "$APPIMAGE_PATH" "$appimage_url" + chmod +x "$APPIMAGE_PATH" + ok "Installed to $APPIMAGE_PATH" +fi + +# --------------------------------------------------------------------------- +# 3. Build and install lc0 from source +# --------------------------------------------------------------------------- +info "Building lc0" + +if [[ -x "$LC0_BIN" ]]; then + skip "Already exists at $LC0_BIN" +else + LC0_BUILD_DIR=$(mktemp -d /tmp/lc0-build.XXXXXX) + echo " Cloning to $LC0_BUILD_DIR" + git clone --recurse-submodules https://github.com/LeelaChessZero/lc0.git "$LC0_BUILD_DIR/lc0" + pushd "$LC0_BUILD_DIR/lc0" >/dev/null + INSTALL_PREFIX="$HOME/.local" ./build.sh + popd >/dev/null + mkdir -p "$HOME/.local/bin" + cp "$LC0_BUILD_DIR/lc0/build/release/lc0" "$LC0_BIN" + chmod +x "$LC0_BIN" + ok "Installed to $LC0_BIN" + rm -rf "$LC0_BUILD_DIR" +fi + +# --------------------------------------------------------------------------- +# 4. Download Maia weights +# --------------------------------------------------------------------------- +info "Downloading Maia weights" +mkdir -p "$MAIA_WEIGHTS_DIR" + +for elo in 1100 1200 1300 1400 1500 1600 1700 1800 1900; do + file="maia-${elo}.pb.gz" + dest="$MAIA_WEIGHTS_DIR/$file" + if [[ -f "$dest" ]]; then + skip "$file already exists" + else + echo " Downloading $file" + curl -sL -o "$dest" "$MAIA_BASE_URL/$file" + ok "$file" + fi +done + +# --------------------------------------------------------------------------- +# 5. Create Maia wrapper scripts +# --------------------------------------------------------------------------- +info "Creating Maia wrapper scripts" +mkdir -p "$HOME/.local/bin" + +for elo in 1100 1200 1300 1400 1500 1600 1700 1800 1900; do + wrapper="$HOME/.local/bin/maia-${elo}" + cat > "$wrapper" <