This commit is contained in:
Serenity-F 2024-09-10 22:54:57 +10:00
parent b7d44f1f62
commit 8fc5a47b44
14 changed files with 0 additions and 311 deletions

View file

@ -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";

View file

@ -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"

View file

@ -1,3 +0,0 @@
#!/bin/sh
lvim +goto $@

View file

@ -1,3 +0,0 @@
#!/bin/sh
lvim +goto $@

View file

@ -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;

View file

@ -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

View file

@ -1,6 +0,0 @@
#!/bin/sh
cd "$(mktemp -d)"
wl-paste > in.png
tesseract in.png out
wl-copy < out.txt

View file

@ -1,3 +0,0 @@
#!/bin/sh
xdg-open "$@" >/dev/null 2>&1 & disown

View file

@ -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/

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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