main
hashirama 2024-09-08 16:03:55 -04:00
parent 5036284a9d
commit f0233090d3
No known key found for this signature in database
GPG Key ID: 53E62470A86BC185
24 changed files with 462 additions and 50 deletions

View File

@ -63,7 +63,7 @@
"F164 709E 5FC7 B32B AEC7 9F37 1F2E 76AC E3F5 31C8")))) "F164 709E 5FC7 B32B AEC7 9F37 1F2E 76AC E3F5 31C8"))))
(channel (channel
(name 'ajattix) (name 'ajattix)
(url "http://ajattix.loophole.site/hashirama/ajattix.git") (url "https://git.ajattix.org/hashirama/ajattix.git")
(branch "main") (branch "main")
(introduction (introduction
(make-channel-introduction (make-channel-introduction

View File

@ -15,8 +15,11 @@
(rosenthal packages binaries) (rosenthal packages binaries)
(rosenthal packages emacs-xyz) (rosenthal packages emacs-xyz)
(guix transformations) (guix transformations)
(gnu packages python-xyz)
(gnu packages audio) (gnu packages audio)
(gnu packages librewolf) (gnu packages librewolf)
(gnu packages sync)
(gnu packages qt)
(gnu packages gdb) (gnu packages gdb)
(gnu packages graphics) (gnu packages graphics)
(gnu packages java) (gnu packages java)
@ -31,6 +34,9 @@
(rde features bluetooth) (rde features bluetooth)
(gnu packages gcc) (gnu packages gcc)
(gnu packages pulseaudio) (gnu packages pulseaudio)
(gnu packages enchant)
(gnu packages hunspell)
(gnu packages upnp)
(gnu packages tor) (gnu packages tor)
(gnu packages commencement) (gnu packages commencement)
(gnu packages guile-xyz) (gnu packages guile-xyz)
@ -125,7 +131,10 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
(firmware (list linux-firmware)) (firmware (list linux-firmware))
(locale "en_US.utf8") (locale "en_US.utf8")
(kernel-arguments (list "modprobe.blacklist=hid-nintendo")) (kernel-arguments (list "modprobe.blacklist=hid-nintendo"
"noatime"
))
(timezone "America/Manaus") (timezone "America/Manaus")
(keyboard-layout (keyboard-layout "us")) (keyboard-layout (keyboard-layout "us"))
(host-name "lisp-machine") (host-name "lisp-machine")
@ -160,13 +169,20 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
cmus cmus
emacs-ox-hugo emacs-ox-hugo
sbcl-coleslaw sbcl-coleslaw
numix-gtk-theme
tor tor
python-psutil
python-schedule
xsel
gerbera
ibus ibus
dconf dconf
gimp gimp
blender blender
gimp-resynthesizer gimp-resynthesizer
wmctrl wmctrl
imagemagick
zpaq
libwebp libwebp
libreoffice libreoffice
librewolf librewolf
@ -174,6 +190,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
ardour ardour
noise-repellent noise-repellent
;; ;;
;; nextcloud-client
xprop xprop
fzf fzf
zstd zstd
@ -186,6 +203,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
xrdb xrdb
noisetorch noisetorch
mpv mpv
qtwebengine ;; required by some applications, like anki
;;emasc-everywhere ;;emasc-everywhere
xdotool xdotool
xprop xprop
@ -216,6 +234,8 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
bluez bluez
blueman blueman
;; ime ;; ime
enchant
hunspell
fcitx5 fcitx5
fcitx5-gtk fcitx5-gtk
fcitx5-qt fcitx5-qt
@ -260,15 +280,19 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
;; font-apple-color-emoji ;; font-apple-color-emoji
picom picom
feh feh
xmodmap ;; ================
;; haskell
cabal-install
;; deps for xmonad ;; deps for xmonad
xmonad xmonad
xmobar xmobar
ghc ;; ridiculous, gcc and ghc are runtime dependencies , yet people didnt put in the package description ghc ;; ridiculous, gcc and ghc are runtime dependencies , yet people didnt put in the package description
ghc-xmonad-contrib
;; ==================
gcc gcc
gcc-toolchain gcc-toolchain
xmessage xmessage
ghc-xmonad-contrib xmodmap
rofi rofi
linux-libre-headers linux-libre-headers
;;-------- ;;--------
@ -284,6 +308,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
;; Below is the list of system services. To search for available ;; Below is the list of system services. To search for available
;; services, run 'guix system search KEYWORD' in a terminal. ;; services, run 'guix system search KEYWORD' in a terminal.
(services (services
(append (list (simple-service 'my-zfs-loader (append (list (simple-service 'my-zfs-loader
kernel-module-loader-service-type kernel-module-loader-service-type
'("zfs")) '("zfs"))
@ -303,7 +328,9 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
(priority 100))) (priority 100)))
;; (service oci-forgejo-service-type) ;; (service oci-forgejo-service-type)
(set-xorg-configuration (set-xorg-configuration
(xorg-configuration (keyboard-layout keyboard-layout))) (xorg-configuration
(keyboard-layout keyboard-layout)))
(udev-rules-service '8bitdo %8bitdo-udev-rules) (udev-rules-service '8bitdo %8bitdo-udev-rules)
(service nix-service-type) (service nix-service-type)
@ -317,6 +344,7 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
) )
%desktop-services) %desktop-services)
) )
(bootloader (bootloader-configuration (bootloader (bootloader-configuration
@ -347,16 +375,6 @@ KERNEL==\"xpad\", SUBSYSTEM==\"drivers\", ACTION==\"add\", ATTR{new_id}=\"2dc8 3
;; "223baecf-e5f4-453f-90c7-d33edbbae145" ;; "223baecf-e5f4-453f-90c7-d33edbbae145"
;; 'ext4)) ;; 'ext4))
;; (type "ext4")) ;; (type "ext4"))
(file-system
(mount-point "/mnt/Quartz")
(device (uuid
"b0e97572-255c-4f6e-9a0a-9a89ae99f1a5"
'ext4))
(type "ext4"))
(file-system
(mount-point "/mnt/Sources")
(device (uuid
"c01d762b-0c91-43c0-9c80-e048c4abe939"
'ext4))
(type "ext4"))
%base-file-systems))) %base-file-systems)))

View File

@ -5,6 +5,8 @@
;; See the "Replicating Guix" section in the manual. ;; See the "Replicating Guix" section in the manual.
(use-modules (gnu home) (use-modules (gnu home)
(radix packages)
(radix packages image-viewers)
(gnu home services desktop) (gnu home services desktop)
(gnu packages) (gnu packages)
(gnu services) (gnu services)
@ -16,6 +18,7 @@
(gnu packages ebook) (gnu packages ebook)
(gnu home services syncthing) (gnu home services syncthing)
(gnu packages tor) (gnu packages tor)
(gnu packages sync)
(gnu packages package-management) (gnu packages package-management)
(gnu packages syncthing) (gnu packages syncthing)
(guix gexp) (guix gexp)
@ -121,6 +124,7 @@
;;unrar ;;unrar
qtmultimedia qtmultimedia
sylpheed sylpheed
zpaq
;; xpad-module ;; xpad-module
unzip unzip
zip zip
@ -133,6 +137,7 @@
gnupg gnupg
xprop xprop
;;nicotine+ ;;nicotine+
nextcloud-client
yt-dlp yt-dlp
higan higan
librewolf librewolf
@ -200,10 +205,11 @@
pavucontrol-qt pavucontrol-qt
mpv mpv
emacs emacs
ueberzug++
(specifications->packages (specifications->packages
(list "steam" (list "steam"
"guile" "guile"
"ueberzug++" ;; "ueberzug++"
"fcitx5-gtk4" "fcitx5-gtk4"
"fcitx5-qt" "fcitx5-qt"
"fcitx5-gtk" "fcitx5-gtk"
@ -212,6 +218,7 @@
"unrar" "unrar"
"nicotine+" "nicotine+"
"librewolf" "librewolf"
"zpaq"
"gimp" "gimp"
"foliate" "foliate"
"tor-client" "tor-client"
@ -230,10 +237,12 @@
("update" . "guix pull && sudo guix system reconfigure .config/guix/config.scm") ("update" . "guix pull && sudo guix system reconfigure .config/guix/config.scm")
("lf" . "~/.local/bin/lf/lfrun") ("lf" . "~/.local/bin/lf/lfrun")
("ps2" . "nohup flatpak run --filesystem=/mnt/Data net.pcsx2.PCSX2 > /dev/null 2>&1 &") ("ps2" . "nohup flatpak run --filesystem=/mnt/Data net.pcsx2.PCSX2 > /dev/null 2>&1 &")
("ocr" . "sudo /nix/var/nix/profiles/default/bin/manga_ocr")
("ll" . "ls -l") ("ll" . "ls -l")
("ls" . "ls -p --color=auto") ("ls" . "ls -p --color=auto")
("run_code" . "g++ -o main main.cc -Ofast -std=c++23 -s -flto -march=native -I ~/dev/ajatt/hakurei/include/ && ./main") ("run_code" . "g++ -o main main.cc -Ofast -std=c++23 -s -flto -march=native -I ~/dev/ajatt/hakurei/include/ && ./main")
("rgf" . "rg --files | rg") ("rgf" . "rg --files | rg")
("dufh" . "/nix/var/nix/profiles/default/bin/duf -hide-fs tmpfs,ext4,devtmpfs,vfat")
("mpv" . "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1") ("mpv" . "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1")
("record" . "ffmpeg -f x11grab -r 23 -s 1366x768 -i $DISPLAY -f pulse -i nui_mic_remap -filter_complex '[1:a]volume=2.0[a]' -map 0:v -map '[a]' -c:v libx264 -pix_fmt yuv420p -preset ultrafast -crf 23 -y /tmp/output.mp4") ("record" . "ffmpeg -f x11grab -r 23 -s 1366x768 -i $DISPLAY -f pulse -i nui_mic_remap -filter_complex '[1:a]volume=2.0[a]' -map 0:v -map '[a]' -c:v libx264 -pix_fmt yuv420p -preset ultrafast -crf 23 -y /tmp/output.mp4")
("isolate" . "guix shell --container --network --preserve='^DISPLAY$' \ ("isolate" . "guix shell --container --network --preserve='^DISPLAY$' \

View File

@ -42,7 +42,7 @@ if [ ! -f "$input_file" ]; then
fi fi
# Output folder and file paths # Output folder and file paths
output_folder="$HOME/Videos/converted_for_compatibility" output_folder="/mnt/Zonai/Videos/converted_for_compatibility"
output_filename="compatible-$(basename "$input_file" | sed 's/[^a-zA-Z0-9._-]/_/g')" output_filename="compatible-$(basename "$input_file" | sed 's/[^a-zA-Z0-9._-]/_/g')"
output_file="$output_folder/$output_filename" output_file="$output_folder/$output_filename"

View File

@ -1,4 +1,3 @@
EXEC_SHELL_PATH=$(command -v bash) EXEC_SHELL_PATH=$(command -v bash)

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import os
import zipfile
from PIL import Image
import sys
from io import BytesIO
def extract_cover(epub, output_path, size):
for fileinfo in epub.filelist:
if fileinfo.filename.lower().endswith(('.jpg', '.jpeg', '.png')):
cover = epub.open(fileinfo.filename)
im = Image.open(BytesIO(cover.read()))
im.thumbnail((size, size), Image.LANCZOS)
im.save(os.path.join(output_path, os.path.basename(input_file) + '.png'), "PNG")
return True
return False
if __name__ == '__main__':
input_file = sys.argv[1]
output_path = os.environ.get('THUMBNAIL_DIR', os.path.dirname(input_file))
size = int(sys.argv[2])
epub = zipfile.ZipFile(input_file, "r")
if extract_cover(epub, output_path, size):
exit(0)
else:
print("Error extracting cover")
exit(1)

12
misc/scripts/focus.sh Executable file
View File

@ -0,0 +1,12 @@
EXEC_SHELL_PATH=$(command -v bash)
while true
do
PID=$(pgrep element)
if [ -n "$PID" ]; then
echo "Killing element (PID: $PID)"
kill -9 $PID
echo "element killed successfully!"
fi
sleep 1
done

5
misc/scripts/focus_real.sh Executable file
View File

@ -0,0 +1,5 @@
EXEC_SHELL_PATH=$(command -v bash)
LOG_FILE="/tmp/element_exit.log"
setsid nohup ~/.local/bin/focus.sh > "$LOG_FILE" 2>&1 &

3
misc/scripts/gd-test Executable file
View File

@ -0,0 +1,3 @@
export LD_LIBRARY_PATH=~/Documents/lib
~/.local/bin/gd-tools

BIN
misc/scripts/gd-tools Executable file

Binary file not shown.

5
misc/scripts/goldendict Executable file
View File

@ -0,0 +1,5 @@
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
goldendict

BIN
misc/scripts/hakurei Executable file

Binary file not shown.

View File

@ -51,9 +51,15 @@ case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
image "${CACHE}.jpg" "$2" "$3" "$4" "$5" image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
;; ;;
*.epub) *.epub)
[ ! -f "$CACHE" ] && \ [ ! -f "$CACHE" ] && \
epub-thumbnailer "$1" "$CACHE" 1024 ~/.local/bin/epub_thumbnailer.sh "$1" "$CACHE" 1024
if [ -f "$CACHE" ]; then
image "$CACHE" "$2" "$3" "$4" "$5" image "$CACHE" "$2" "$3" "$4" "$5"
else
print "Error extracting cover"
exit 1
fi
;; ;;
*.cbz|*.cbr|*.cbt) *.cbz|*.cbr|*.cbt)
[ ! -f "$CACHE" ] && \ [ ! -f "$CACHE" ] && \

83
misc/scripts/lf/preview~ Executable file
View File

@ -0,0 +1,83 @@
#!/bin/sh
image() {
if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
exit 1
else
chafa "$1" -s "$4x"
fi
}
batorcat() {
file="$1"
shift
if command -v bat > /dev/null 2>&1
then
bat --color=always --style=plain --pager=never "$file" "$@"
else
cat "$file"
fi
}
CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
*.tgz|*.tar.gz) tar tzf "$1" ;;
*.tar.bz2|*.tbz2) tar tjf "$1" ;;
*.tar.txz|*.txz) xz --list "$1" ;;
*.tar) tar tf "$1" ;;
*.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;;
*.rar) unrar l "$1" ;;
*.md) glow -s dark "$1" ;;
*.7z) 7z l "$1" ;;
*.[1-8]) man "$1" | col -b ;;
*.o) nm "$1";;
*.torrent) transmission-show "$1" ;;
*.iso) iso-info --no-header -l "$1" ;;
*.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;;
*.doc) catdoc "$1" ;;
*.docx) docx2txt "$1" - ;;
*.xml|*.html) w3m -dump "$1";;
*.xls|*.xlsx)
ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv
;;
*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka)
exiftool "$1"
;;
*.pdf)
[ ! -f "${CACHE}.jpg" ] && \
pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
;;
*.epub)
[ ! -f "$CACHE" ] && \
epub-thumbnailer "$1" "$CACHE" 1024
image "$CACHE" "$2" "$3" "$4" "$5"
;;
*.cbz|*.cbr|*.cbt)
[ ! -f "$CACHE" ] && \
comicthumb "$1" "$CACHE" 1024
image "$CACHE" "$2" "$3" "$4" "$5"
;;
*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx)
[ ! -f "${CACHE}.jpg" ] && \
ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
;;
*.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif)
image "$1" "$2" "$3" "$4" "$5"
;;
*.svg)
[ ! -f "${CACHE}.jpg" ] && \
convert "$1" "${CACHE}.jpg"
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
;;
*.ino)
batorcat --language=cpp "$1"
;;
*)
batorcat "$1"
;;
esac
exit 0

BIN
misc/scripts/loophole Executable file

Binary file not shown.

23
misc/scripts/mullvad.sh Executable file
View File

@ -0,0 +1,23 @@
EXEC_SHELL_PATH=$(command -v bash)
MULLVAD="/nix/var/nix/profiles/default/bin/mullvad-daemon"
LOG_FILE="/tmp/mullvad.log"
# Create the log directory if it doesn't exist
mkdir -p "$(dirname "$LOG_FILE")"
# Check if Navidrome is already running
if pgrep -x "mullvad" > /dev/null; then
echo "mullvad is already running. Exiting."
else
# Run Navidrome command, redirecting output to the log file and detaching it from the terminal
setsid nohup $MULLVAD > "$LOG_FILE" 2>&1 &
echo "mullvad started and detached from the terminal."
fi

BIN
misc/scripts/noisetorch Executable file

Binary file not shown.

View File

@ -1,19 +1,46 @@
#!/bin/sh EXEC_SHELL_PATH=$(command -v bash)
export THUMBNAIL_DIR="$HOME/.cache/lf/epub"
set -e set -e
# Define cleanup function to close file descriptor and remove FIFO file
cleanup() { cleanup() {
exec 3>&- exec 3>&-
rm "$FIFO_UEBERZUG" rm "$FIFO_UEBERZUG"
} }
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then # Check if running over SSH and exit if true
lf "$@" [[ -n $SSH_CLIENT || -n $SSH_TTY ]] && exit 0
else
[ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" # Create necessary directories
[[ ! -d $HOME/.cache/lf ]] && mkdir -p "$HOME/.cache/lf"
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
mkfifo "$FIFO_UEBERZUG" mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
# Start ueberzugpp in background
ueberzugpp layer -s <"$FIFO_UEBERZUG" -p json &
exec 3>"$FIFO_UEBERZUG" exec 3>"$FIFO_UEBERZUG"
trap cleanup EXIT trap cleanup EXIT
lf "$@" 3>&-
case "$1" in
*.epub)
EPUB_FILE="$1"
THUMBNAIL_DIR="$HOME/.cache/lf/epub"
mkdir -p "$THUMBNAIL_DIR"
THUMBNAIL_PATH="${THUMBNAIL_DIR}/${EPUB_FILE%.epub}.png"
# Check if the thumbnail exists, if not, generate it
if [[ ! -f $THUMBNAIL_PATH ]]; then
$HOME/.config/lf/epub_thumbnailer.sh "$EPUB_FILE" 256
fi fi
# Open the generated thumbnail with nsxiv
nsxiv "$THUMBNAIL_DIR" &
# just a workaround, will fix to display the file instead of the
# whole folder
;;
*)
exit 0
;;
esac

View File

@ -1,8 +1,11 @@
EXEC_SHELL_PATH=$(command -v bash) EXEC_SHELL_PATH=$(command -v bash)
export QT_XCB_GL_INTEGRATION=none
export QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox"
export DISABLE_QT5_COMPAT=1
# Run Anki with nohup, redirecting output to a log file # Run Anki with nohup, redirecting output to a log file
nohup flatpak run net.ankiweb.Anki > anki.log 2>&1 & nohup /nix/var/nix/profiles/default/bin/anki-bin > anki.log 2>&1 &
# Disown the process to remove it from the shell's job table # Disown the process to remove it from the shell's job table
disown disown

View File

@ -0,0 +1,44 @@
EXEC_SHELL_PATH=$(command -v bash)
send_most_recent_image_via_telegram() {
# Specify the correct folder paths
folder_path_x="/mnt/Data/mpv-screenshots/"
folder_path_y="/mnt/Data/mpv-screenshots/screenshots/"
# Check if both folders exist
if [ ! -d "$folder_path_x" ] || [ ! -d "$folder_path_y" ]; then
echo "Error: One or both folders do not exist."
return 1
fi
# Get the most recent file from FolderX
most_recent_x=$(find "$folder_path_x" -maxdepth 1 \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.tiff" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1)
# Get the most recent file from FolderY
most_recent_y=$(find "$folder_path_y" -maxdepth 1 \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.tiff" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1)
# Compare the modification times and choose the most recent file
if [ "$(echo "$most_recent_x" | cut -d' ' -f 1)" -gt "$(echo "$most_recent_y" | cut -d' ' -f 1)" ]; then
most_recent_file="$most_recent_x"
else
most_recent_file="$most_recent_y"
fi
# Check if telegram-desktop is installed
if ! command -v telegram-desktop &> /dev/null; then
echo "Error: telegram-desktop is not installed."
return 1
fi
# Activate telegram-desktop window
wmctrl -x -a telegram-desktop
# Send the most recent image file via telegram-desktop
telegram-desktop -sendpath "$(echo "$most_recent_file" | cut -d' ' -f 2-)"
echo "Sent most recent image file via telegram-desktop: $(echo "$most_recent_file" | cut -d' ' -f 2-)"
}
# Execute the function
send_most_recent_image_via_telegram

View File

@ -0,0 +1,40 @@
EXEC_SHELL_PATH=$(command -v bash)
send_most_recent_video_via_telegram() {
# Specify the correct folder path
folder_path="$HOME/Videos"
# Check if the folder exists
if [ ! -d "$folder_path" ]; then
echo "Error: Folder does not exist."
return 1
fi
# Check if the folder is empty
if [ -z "$(find "$folder_path" -maxdepth 1 \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.flv" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.webm" \) -print -quit)" ]; then
echo "Error: Folder does not contain any video files."
return 1
fi
# Get the most recent video file
most_recent_video=$(find "$folder_path" -maxdepth 1 \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.flv" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.webm" \) -exec stat --format='%Y %n' {} + | sort -nr | head -n 1 | cut -d ' ' -f 2-)
file_path="$most_recent_video"
# Check if telegram-desktop is installed
if ! command -v telegram-desktop &> /dev/null; then
echo "Error: telegram-desktop is not installed."
return 1
fi
# Activate telegram-desktop window
wmctrl -x -a telegram-desktop
# Send the most recent video file via telegram-desktop
telegram-desktop -sendpath "$file_path"
echo "Sent most recent video file via telegram-desktop: $file_path"
}
# Execute the function
send_most_recent_video_via_telegram

58
misc/scripts/wallpapers-lua.sh Executable file
View File

@ -0,0 +1,58 @@
EXEC_SHELL_PATH=$(command -v bash)
lua=$(which lua)
pid=$$
"$lua" <<EOF
-- Set the directory containing the wallpapers
local wallpaper_dir = "~/wallpapers"
-- Get a list of all files in the directory
local files = {}
for file in io.popen("find " .. wallpaper_dir .. " -type f -print0 | xargs -0 -I {} echo {}"):lines() do
table.insert(files, file)
end
print("Files:")
for i, file in ipairs(files) do
print(file)
end
-- Create a pid file to store the process ID
local pid_file = "/tmp/wallpapers.pid"
local pid = io.open(pid_file, "w")
pid:write(tostring($pid))
pid:close()
-- Set the process name
local cmdline_file = "/proc/$pid/comm"
local cmdline = io.open(cmdline_file, "w")
cmdline:write("wallpapers")
cmdline:close()
while true do
-- Read true random data from /dev/random
local random_file = io.open("/dev/random", "rb")
local random_bytes = random_file:read(4)
random_file:close()
-- Convert the random bytes to a Lua number
local random_number = 0
for i = 1, #random_bytes do
random_number = random_number * 256 + string.byte(random_bytes, i)
end
-- Use the random number to select a wallpaper
local wallpaper_index = random_number % #files + 1
local random_wallpaper = files[wallpaper_index]
print("Random wallpaper:", random_wallpaper)
-- Set the wallpaper with feh, escaping the filename properly
local command = "feh --bg-fill '" .. random_wallpaper:gsub("'", "'\\''") .. "'"
os.execute(command)
-- Wait 30 seconds before changing the wallpaper again
os.execute("sleep 30")
end
EOF

39
misc/scripts/zfs.sh Executable file
View File

@ -0,0 +1,39 @@
EXEC_SHELL_PATH=$(command -v bash)
sudo zpool import Data && sudo zpool import Zonai && sudo zpool import kisshot
: ' Some really important info in case that the computer does not recognize the pools by their name:
pool: Data
state: ONLINE
scan: scrub repaired 0B in 14:41:28 with 0 errors on Thu Apr 25 17:54:33 2024
config:
NAME STATE READ WRITE CKSUM
Data ONLINE 0 0 0
ata-ST4000DM004-2CV104_ZFN4QK48 ONLINE 0 0 0
errors: No known data errors
pool: Zonai
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
Zonai ONLINE 0 0 0
sde ONLINE 0 0 0
errors: No known data errors
pool: kisshot
state: ONLINE
config:
NAME STATE READ WRITE CKSUM
kisshot ONLINE 0 0 0
ata-TOSHIBA_HDWL110_12DFP4BTT ONLINE 0 0 0
'

View File

@ -47,7 +47,7 @@ import XMonad.Actions.FocusNth (swapNth)
import XMonad.Layout.LimitWindows import XMonad.Layout.LimitWindows
import XMonad.Actions.CopyWindow import XMonad.Actions.CopyWindow
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Actions.SpawnOn
@ -72,17 +72,17 @@ myKeys =
] ++ ] ++
[ ("M-d", spawn "rofi -show run") [ ("M-d", spawn "rofi -show run")
, ("M-s", spawn "bash -c dictpopup") , ("M-s", spawn "bash -c dictpopup")
, ("M-S-e", spawn "flameshot full --path=/mnt/Data/mpv-screenshots/screenshots/light_novels") , ("M-S-e", spawnAndShift "ws7" "goldendict")
, ("M-e", runOrRaise "goldendict" (className =? "GoldenDict-ng")) , ("M-e", runOrRaise "goldendict" (className =? "GoldenDict-ng"))
, ("M-p", runOrRaise "librewolf" (className =? "librewolf-default")) , ("M-p", runOrRaise "librewolf" (className =? "librewolf-default"))
, ("M-S-g", spawn "~/.local/bin/mpv-tube.sh") , ("M-S-g", easySwap)
, ("M-S-c", spawn "emacsclient --eval '(emacs-everywhere)'") , ("M-S-c", spawnAndShift "ws8" "qbittorrent")
, ("M-S-p", runOrRaise "nyxt" (className =? "Nyxt")) , ("M-S-p", runOrRaise "nyxt" (className =? "Nyxt"))
, ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window , ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window
, ("M-`", runOrRaise "emacs" (className =? "Emacs")) , ("M-`", runOrRaise "emacs" (className =? "Emacs"))
, ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm. , ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm.
, ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q , ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q
, ("M-m", spawn "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1 --idle") , ("M-m", spawn "mpv --idle")
, ("M-S-r", spawn "~/.local/bin/run_anki.sh") , ("M-S-r", spawn "~/.local/bin/run_anki.sh")
, ("M-S-d", spawn "~/.local/bin/recent_journal.py | popup") , ("M-S-d", spawn "~/.local/bin/recent_journal.py | popup")
, ("M-r", runOrRaise "~/.local/bin/run_anki.sh" (className =? "Anki")) , ("M-r", runOrRaise "~/.local/bin/run_anki.sh" (className =? "Anki"))
@ -91,7 +91,8 @@ myKeys =
, ("M-f", viewEmptyWorkspace) -- View an empty workspace , ("M-f", viewEmptyWorkspace) -- View an empty workspace
, ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots") , ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots")
, ("M-w", spawn "~/.local/bin/copy_image.sh") , ("M-w", spawn "~/.local/bin/copy_image.sh")
, ("M-v", easySwap) , ("M-S-b", spawn "kill -9 $(pgrep mpv)")
, ("M-v", spawn "maim --select --hidecursor --format=png --quality 1 /tmp/manga/screenshot.png")
] ]
@ -110,7 +111,7 @@ myConfig = def
-- spawnOnce "xrandr --output DisplayPort-0 --mode 1366x768 --pos 1366x0 --rotate left --output HDMI-A-0 --primary --mode 1366x768 --pos 0x0 --rotate normal --output DVI-D-0 --off" -- spawnOnce "xrandr --output DisplayPort-0 --mode 1366x768 --pos 1366x0 --rotate left --output HDMI-A-0 --primary --mode 1366x768 --pos 0x0 --rotate normal --output DVI-D-0 --off"
spawnOnce "xrandr --output HDMI-A-0 --mode 1366x768 --pos 0x0 --rotate normal" spawnOnce "xrandr --output HDMI-A-0 --mode 1366x768 --pos 0x0 --rotate normal"
spawnOnce "xrdb /home/hashirama/.Xresources" spawnOnce "xrdb /home/hashirama/.Xresources"
spawnOnce "/home/hashirama/.local/bin/rotate_wallpapers.sh" spawnOnce "feh --bg-fill wallpaper.jpg"
spawnOnce "picom -b" spawnOnce "picom -b"
spawnOnce "polybar top-monitor-1" spawnOnce "polybar top-monitor-1"
spawnOnce "fcitx5 -d -r" spawnOnce "fcitx5 -d -r"
@ -134,8 +135,15 @@ myManageHook :: ManageHook
myManageHook = composeAll myManageHook = composeAll
[ className =? "Gimp" --> doFloat [ className =? "Gimp" --> doFloat
, isDialog --> doFloat , isDialog --> doFloat
, className =? "GoldenDict-ng" --> doShift "ws7"
, className =? "qBittorrent" --> doShift "ws8"
, manageSpawn
] ]
spawnAndShift :: WorkspaceId -> String -> X ()
spawnAndShift ws app = do
spawn app
windows $ W.shift ws
myTheme :: Theme myTheme :: Theme
myTheme = def myTheme = def