From 8fc5a47b44899e134dd0b7ab4ddcee2df92946e7 Mon Sep 17 00:00:00 2001 From: Serenity-F Date: Tue, 10 Sep 2024 22:54:57 +1000 Subject: [PATCH] tidying --- home/scripts/zethra/combine-pfps | 49 ----------------- home/scripts/zethra/git-reset-author | 4 -- home/scripts/zethra/gitlvim | 3 - home/scripts/zethra/gitnvim | 3 - home/scripts/zethra/iommu-groups.sh | 9 --- home/scripts/zethra/nixos-upgrade | 49 ----------------- home/scripts/zethra/ocr-clipboard | 6 -- home/scripts/zethra/open | 3 - home/scripts/zethra/send-to-cache | 11 ---- home/scripts/zethra/show-upgrade | 14 ----- home/scripts/zethra/speak-clipboard | 27 --------- home/scripts/zethra/speak-screen | 24 -------- home/scripts/zethra/speak-selected | 27 --------- hosts/halp/configuration.nix | 82 ---------------------------- 14 files changed, 311 deletions(-) delete mode 100755 home/scripts/zethra/combine-pfps delete mode 100755 home/scripts/zethra/git-reset-author delete mode 100755 home/scripts/zethra/gitlvim delete mode 100755 home/scripts/zethra/gitnvim delete mode 100755 home/scripts/zethra/iommu-groups.sh delete mode 100755 home/scripts/zethra/nixos-upgrade delete mode 100755 home/scripts/zethra/ocr-clipboard delete mode 100755 home/scripts/zethra/open delete mode 100755 home/scripts/zethra/send-to-cache delete mode 100755 home/scripts/zethra/show-upgrade delete mode 100755 home/scripts/zethra/speak-clipboard delete mode 100755 home/scripts/zethra/speak-screen delete mode 100755 home/scripts/zethra/speak-selected delete mode 100644 hosts/halp/configuration.nix diff --git a/home/scripts/zethra/combine-pfps b/home/scripts/zethra/combine-pfps deleted file mode 100755 index d347771..0000000 --- a/home/scripts/zethra/combine-pfps +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -#This script will merge two images into one using imageMagick. -#The final result will be a picture that is split diagonally. -#The diagonal line will start from the bottom left of the image. -#Both pictures must be of the same size. -#If you do not give the filenames as part of the command line, the default names will be used (Left.jpg and Right.jpg). - -#If command line argument 1 is not provided, the value will default to the variable $LEFT_DEFAULT -LEFT_DEFAULT="Left.jpg"; -LEFT=${1:-$LEFT_DEFAULT}; - -#If command line argument 2 is not provided, the value will default to the variable $Right_DEFAULT -RIGHT_DEFAULT="Right.jpg"; -RIGHT=${2:-$RIGHT_DEFAULT}; - -#The intermediate images we will use must be png to support transparency. -#We remove the extension '.jpg' from the filenames and add the extension '.png'. -LEFT_NORM="${LEFT%.jpg}.norm.png" -RIGHT_NORM="${RIGHT%.jpg}.norm.png" -LEFT_OUT="${LEFT%.jpg}.Diagonal Up - Mask.png"; -RIGHT_OUT="${RIGHT%.jpg}.Diagonal Up - Mask.png"; -OUT="combined.png"; - -# #Read the width and height of one of the images -WIDTH_LEFT=$(identify -format %w "$LEFT"); -HEIGHT_LEFT=$(identify -format %h "$LEFT"); -WIDTH_RIGHT=$(identify -format %w "$RIGHT"); -HEIGHT_RIGHT=$(identify -format %h "$RIGHT"); - -# Find the smallest width and height of both images -WIDTH=$((WIDTH_LEFT < WIDTH_RIGHT ? WIDTH_LEFT : WIDTH_RIGHT)) -HEIGHT=$((HEIGHT_LEFT < HEIGHT_RIGHT ? HEIGHT_LEFT : HEIGHT_RIGHT)) - -# Normalize their sizes to those smallest dimensions -convert "$LEFT" -background none -resize "$WIDTH"x"$HEIGHT"^ -gravity center -extent "$WIDTH"x"$HEIGHT" "$LEFT_NORM" -convert "$RIGHT" -background none -resize "$WIDTH"x"$HEIGHT"^ -gravity center -extent "$WIDTH"x"$HEIGHT" "$RIGHT_NORM" - -convert -respect-parenthesis \ -\( "$LEFT_NORM" -gravity north -crop "$WIDTH"x"$HEIGHT"+0+0 +repage -write "$LEFT_OUT" \) `#Load first image to a new png` \ -\( "$RIGHT_NORM" -gravity east -crop "$WIDTH"x"$HEIGHT"+0+0 +repage -write "$RIGHT_OUT" \) `#Load second image to a new png` \ -\( -size "$WIDTH"x"$HEIGHT" xc:black -fill white -draw "polygon 0,0 0,"$HEIGHT" "$WIDTH",0" -write "MASK_$LEFT_OUT" \) `#Create the mask of the upper triangle` \ -\( -clone 2 -negate -write "MASK_$RIGHT_OUT" \) `#Create the mask of the lower triangle` \ -\( -clone 0 -clone 2 -alpha off -compose copy_opacity -composite -write "$LEFT_OUT" \) `#Apply the upper triangle mask to the left image` \ -\( -clone 1 -clone 3 -alpha off -compose copy_opacity -composite -write "$RIGHT_OUT" \) `#Apply the lower triangle mask to the right image` \ --delete 0-3 -compose over -composite "$OUT" `#Merge the two images together`; - -#Cleaning up -rm "MASK_$RIGHT_OUT" "MASK_$LEFT_OUT" "$LEFT_OUT" "$RIGHT_OUT" "$LEFT_NORM" "$RIGHT_NORM"; diff --git a/home/scripts/zethra/git-reset-author b/home/scripts/zethra/git-reset-author deleted file mode 100755 index 55f4e1d..0000000 --- a/home/scripts/zethra/git-reset-author +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -git rebase -r --root --exec 'git commit --amend --no-edit --reset-author' -FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --msg-filter "sed /^Signed-off-by:/d" diff --git a/home/scripts/zethra/gitlvim b/home/scripts/zethra/gitlvim deleted file mode 100755 index c4ad530..0000000 --- a/home/scripts/zethra/gitlvim +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -lvim +goto $@ diff --git a/home/scripts/zethra/gitnvim b/home/scripts/zethra/gitnvim deleted file mode 100755 index c4ad530..0000000 --- a/home/scripts/zethra/gitnvim +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -lvim +goto $@ diff --git a/home/scripts/zethra/iommu-groups.sh b/home/scripts/zethra/iommu-groups.sh deleted file mode 100755 index b58e50a..0000000 --- a/home/scripts/zethra/iommu-groups.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -shopt -s nullglob -for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do - echo "IOMMU Group ${g##*/}:" - for d in $g/devices/*; do - echo -e "\t$(lspci -nns ${d##*/})" - done; -done; - diff --git a/home/scripts/zethra/nixos-upgrade b/home/scripts/zethra/nixos-upgrade deleted file mode 100755 index 63b0347..0000000 --- a/home/scripts/zethra/nixos-upgrade +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -set -euo pipefail - -nixcfg=~/Projects/nixcfg - -cd "$nixcfg" -tmpdir="$(mktemp -d)" -outdir="$tmpdir/out" -trap "git rm -f --ignore-unmatch flake.lock" EXIT -ln -s ./hosts/$(hostname)/flake.lock . -git add flake.lock -nix flake update -nom build -o "$outdir" ".#nixosConfigurations.$(hostname).config.system.build.toplevel" -nvd diff /run/current-system "$outdir" - -if [ "$#" -gt 0 ] && [ "$1" = "-y" ]; then - echo 'Skipping prompt' -else - echo - while true; do - read -p 'Do you want to process with upgrade [Y/n]' yn - case "$yn" in - [Yy]* ) - break - ;; - [Nn]* ) - exit 1 - ;; - "") - break - ;; - * ) - ;; - esac - done -fi - -echo Upgrading... - -# Do system upgrade -sudo rsync -rl --delete --exclude=".*" . /etc/nixos -sudo ln -s "/etc/nixos/hosts/$(hostname)/hardware-configuration.nix" /etc/nixos/hardware-configuration.nix -sudo nixos-rebuild switch - -if [ $(git status --porcelain ./hosts/$(hostname)/flake.lock | wc -l) -gt 0 ]; then - git rm -f flake.lock - git add ./hosts/$(hostname)/flake.lock - git commit -m "System upgrade $(hostname)" -fi diff --git a/home/scripts/zethra/ocr-clipboard b/home/scripts/zethra/ocr-clipboard deleted file mode 100755 index 61e3a6e..0000000 --- a/home/scripts/zethra/ocr-clipboard +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd "$(mktemp -d)" -wl-paste > in.png -tesseract in.png out -wl-copy < out.txt diff --git a/home/scripts/zethra/open b/home/scripts/zethra/open deleted file mode 100755 index d642a41..0000000 --- a/home/scripts/zethra/open +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -xdg-open "$@" >/dev/null 2>&1 & disown diff --git a/home/scripts/zethra/send-to-cache b/home/scripts/zethra/send-to-cache deleted file mode 100755 index 832a271..0000000 --- a/home/scripts/zethra/send-to-cache +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ]; then - REMOTE='root@noraa.gay' -else - REMOTE="$1" -fi - -nix build . -nix store sign -k /etc/nixos/secrets/cache-priv-key.pem ./result/ -nix copy --to "ssh-ng://$REMOTE" ./result/ diff --git a/home/scripts/zethra/show-upgrade b/home/scripts/zethra/show-upgrade deleted file mode 100755 index 033047b..0000000 --- a/home/scripts/zethra/show-upgrade +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -euo pipefail - -nixcfg=~/Projects/nixcfg - -tempdir=$(mktemp -d /tmp/tmp.nix-updateinfo.XXX) -git clone --reference "$nixcfg" "$nixcfg" "$tempdir" -cd $tempdir -nix flake lock --update-input nixpkgs -nix build ".#nixosConfigurations.$(hostname).config.system.build.toplevel" -nvd diff /run/current-system ./result - -cd ~- -rm -rf "$tempdir" diff --git a/home/scripts/zethra/speak-clipboard b/home/scripts/zethra/speak-clipboard deleted file mode 100755 index dffdd1b..0000000 --- a/home/scripts/zethra/speak-clipboard +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -PIDFILE='/tmp/speak.pid' - -if [ -f "$PIDFILE" ]; then - PID=$(cut -f 1 $PIDFILE) - DIR=$(cut -f 2 $PIDFILE) - kill "$PID" - rm -f "$PIDFILE" - rm -rf "$DIR" -else - DIR=`mktemp -d` - xclip -sel clip -o > "$DIR/text" - RHVoice-test -r 140 -i "$DIR/text" -o "$DIR/out.wav" - mpv "$DIR/out.wav" & - # set -m - # festival --tts < "$DIR/text" & - PID="$!" - # set +m - echo "Making pid file, $PID $PIDFILE" - printf "$PID\t$DIR" > "$PIDFILE" - wait $(jobs -p) - echo "Speech done" - rm -rf "$DIR" - rm -f "$PIDFILE" -fi - diff --git a/home/scripts/zethra/speak-screen b/home/scripts/zethra/speak-screen deleted file mode 100755 index 66b65aa..0000000 --- a/home/scripts/zethra/speak-screen +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -PIDFILE='/tmp/speak.pid' - -if [ -f "$PIDFILE" ]; then - PID=$(cut -f 1 $PIDFILE) - DIR=$(cut -f 2 $PIDFILE) - kill "$PID" - rm -f "$PIDFILE" - rm -rf "$DIR" -else - DIR=`mktemp -d` - spectacle -rbno "$DIR/in.png" - tesseract "$DIR/in.png" - | tr '|' 'I' > "$DIR/text" - RHVoice-test -r 140 -i "$DIR/text" -o "$DIR/out.wav" - mpv "$DIR/out.wav" & - PID="$!" - echo "Making pid file, $PID $PIDFILE" - printf "$PID\t$DIR" > "$PIDFILE" - wait $(jobs -p) - echo "Speech done" - rm -rf "$DIR" - rm -f "$PIDFILE" -fi diff --git a/home/scripts/zethra/speak-selected b/home/scripts/zethra/speak-selected deleted file mode 100755 index 7533fcd..0000000 --- a/home/scripts/zethra/speak-selected +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -PIDFILE='/tmp/speak.pid' - -if [ -f "$PIDFILE" ]; then - PID=$(cut -f 1 $PIDFILE) - DIR=$(cut -f 2 $PIDFILE) - kill "$PID" - rm -f "$PIDFILE" - rm -rf "$DIR" -else - DIR=`mktemp -d` - xsel > "$DIR/text" - RHVoice-test -r 140 -i "$DIR/text" -o "$DIR/out.wav" - mpv "$DIR/out.wav" & - # set -m - # festival --tts < "$DIR/text" & - PID="$!" - # set +m - echo "Making pid file, $PID $PIDFILE" - printf "$PID\t$DIR" > "$PIDFILE" - wait $(jobs -p) - echo "Speech done" - rm -rf "$DIR" - rm -f "$PIDFILE" -fi - diff --git a/hosts/halp/configuration.nix b/hosts/halp/configuration.nix deleted file mode 100644 index 36cc7e1..0000000 --- a/hosts/halp/configuration.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ inputs, outputs, config, lib, pkgs, ... }: - -{ - imports = [ - # Include the results of the hardware scan. - # ./hardware-configuration.nix - # "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix" - # ./disko-config.nix - # ./network-configuration.nix - ../../core/configuration.nix - - ]; - - # Enable swap on luks - # boot = { - # loader = { - # systemd-boot = { - # enable = true; - # configurationLimit = 7; - # }; - # efi = { - # canTouchEfiVariables = true; - # efiSysMountPoint = "/boot/efi"; - # }; - # }; - # initrd = { - # systemd.enable = true; - # secrets = { - # "crypto_keyfile.bin" = null; - # }; - # luks = { - # devices."luks-DISK_UUID" = { - # device = "/dev/disk/by-uuid/DISK_UUID"; - # keyfile = "/crypto_keyfile.bin"; - # }; - # }; - }; - }; - - services.fstrim.enable = true; - - # powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - - hardware = { - - cpu.intel.updateMicrocode = true; - enableAllFirmware = true; - bluetooth.enable = false; - - opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-compute-runtime - intel-media-driver - vaapiIntel - vaapiVdpau - libvdpau-va-gl - ]; - }; - - }; - - nix = { - # settings = { - # }; - gc = { - automatic = true; - dates = "daily"; - options = "--delete-older-than 3d"; - persistent = true; - }; - }; - - environment.systemPackages = with pkgs; [ - umr - radeontop - radeontools - radeon-profile - amdgpu_top - ]; - -}