Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-06-04 00:06:31 -04:00
parent 64d9ae79aa
commit 160e9ece27
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
19 changed files with 819 additions and 792 deletions

23
.bashrc
View File

@ -83,8 +83,7 @@ fixdh() {
strlen() {
N=$(wc -c <<< "$*")
((N--))
printf '%u
' "$N"
printf '%u\n' "$N"
}
uppweb() {
@ -100,10 +99,8 @@ caption() {
local OUT="$2"
shift 2
local TEXT="$*"
local WIDTH="$(identify -format "%[w]
" "$FILE" | head -n1)"
local HEIGHT="$(identify -format "%[h]
" "$FILE" | head -n1)"
local WIDTH="$(identify -format "%[w]\n" "$FILE" | head -n1)"
local HEIGHT="$(identify -format "%[h]\n" "$FILE" | head -n1)"
local FONT_SIZE="$(((HEIGHT+WIDTH)/20))"
convert -gravity north \( -size "${WIDTH}x" -pointsize "$FONT_SIZE" -font 'Liberation-Sans-Bold' caption:"$TEXT" -gravity Center -extent "${WIDTH}x" \) "$FILE" -append "$OUT"
}
@ -134,10 +131,8 @@ topbottom() {
local FILE="$1"
local OUT="$2"
shift 2
local WIDTH="$(identify -format "%[w]
" "$FILE" | head -n1)"
local HEIGHT="$(identify -format "%[h]
" "$FILE" | head -n1)"
local WIDTH="$(identify -format "%[w]\n" "$FILE" | head -n1)"
local HEIGHT="$(identify -format "%[h]\n" "$FILE" | head -n1)"
local FONT_SIZE="$(((HEIGHT+WIDTH)/20))"
convert -size "${WIDTH}x" -stroke black -strokewidth 3 -fill white -pointsize "$FONT_SIZE" -font 'Liberation-Sans-Bold' -gravity Center -extent "${WIDTH}x" -gravity north \( -annotate +0+0 "$1" \) -gravity south \( -annotate +0+0 "$2" \) "$FILE" -append "$OUT"
}
@ -164,8 +159,7 @@ subcipher() {
local COLOR PERM L1 line grep word
if [ $# -lt 3 ]; then
if [ $# -lt 2 ] || [[ "$1" != "0" && "$1" != "1" ]]; then
printf "Usage: [0|1] subcipher file [string...]
"
printf "Usage: [0|1] subcipher file [string...]\n"
return 1
fi
fi
@ -182,8 +176,7 @@ subcipher() {
[ $COLOR -eq 1 ] && grep="$(grep --color=always -xF "$word" /etc/dictionaries-common/words)"
printf %s "${grep:-$word} "
done
printf '
'
printf '\n'
done
}
@ -274,7 +267,7 @@ uploadhex() {
}
gshpkg() {
local re='[(]?("([^"]*)"'
local re='[\(]?\("([^"]*)"'
if [[ "$GUIX_ENVIRONMENT" ]]; then
local PACKAGES=($(while read -r line; do
[[ "$line" =~ $re ]] && printf '%s ' "${BASH_REMATCH[1]}"

View File

@ -1,5 +1,6 @@
(define-module (cobra bin)
#:use-module (guix gexp)
#:use-module (gnu packages base)
#:export (bin-torbrowser
bin-suspend-wrap
bin-suspend
@ -13,34 +14,45 @@
bin-backtick))
(define bin-torbrowser
(plain-file "bin-torbrowser" "\
(computed-file "bin-torbrowser"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
cd ~/.local/share/torbrowser/tor-browser/
guix shell --check --pure --expression='(list (@@ (gnu packages gcc) gcc-11) \"lib\")' coreutils bash grep sed gcc-toolchain patchelf gtk+ dbus-glib libxt libevent openssl file alsa-lib << EOF
guix shell --check --pure --expression='(list (@@ (gnu packages gcc) gcc-11) \"lib\")' coreutils bash grep sed gcc-toolchain patchelf gtk+ dbus-glib libxt libevent openssl file alsa-lib << \"EOF\" >" #$output "1
set -x
cd Browser
patchelf --set-interpreter \\$LIBRARY_PATH/ld-linux-x86-64.so.2 firefox.real
patchelf --set-interpreter \\$LIBRARY_PATH/ld-linux-x86-64.so.2 TorBrowser/Tor/tor
LD_LIBRARY_PATH=\\$LIBRARY_PATH ./start-tor-browser -v
EOF"))
EOT" "\nEOF"))
(chmod #$output #o755))))
(define bin-suspend-wrap
(plain-file "bin-suspend-wrap" "\
(computed-file "bin-suspend-wrap"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
sudo ~/.local/bin/__suspend
while grep -v '\\[' /sys/power/state; do
swaylock
break
done"))
done" "\nEOF"))
(chmod #$output #o755))))
(define bin-suspend
(plain-file "bin-suspend" "\
(computed-file "bin-suspend"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
echo mem > /sys/power/state"))
echo mem > /sys/power/state" "\nEOF"))
(chmod #$output #o755))))
(define bin-start-pipewire
(plain-file "bin-start-pipewire" "\
(computed-file "bin-start-pipewire"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
rm -rf /run/user/$UID/pulse
@ -49,10 +61,13 @@ rm -rf /run/user/$UID/pulse
pipewire &
pipewire-pulse &
wireplumber &"))
wireplumber &" "\nEOF"))
(chmod #$output #o755))))
(define bin-screenshot
(plain-file "bin-screenshot" "\
(computed-file "bin-screenshot"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
if [ ! -d $HOME/Pictures/Screenshots ]
@ -96,10 +111,13 @@ case $1 in
-h)helpscreen;;
-w)wofirun;;
*)fullscreen;;
esac"))
esac" "\nEOF"))
(chmod #$output #o755))))
(define bin-logout-wofi
(plain-file "bin-logout-wofi" "\
(computed-file "bin-logout-wofi"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
case \"$(printf \"logout\\nreboot\\nshutdown\\nsleep\\n\" | wofi --dmenu -i -H 500 -W 250 -x 0 -y 0 )\" in
@ -108,10 +126,13 @@ case \"$(printf \"logout\\nreboot\\nshutdown\\nsleep\\n\" | wofi --dmenu -i -H 5
'reboot') sudo reboot ;;
'shutdown') sudo poweroff ;;
*) exit 1 ;;
esac"))
esac" "\nEOF"))
(chmod #$output #o755))))
(define bin-lock
(plain-file "bin-lock" "\
(computed-file "bin-lock"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
if ! ps aux | grep -v grep | grep swaylock; then
# if [[ $(playerctl status) != \"Playing\" ]]; then
@ -122,10 +143,13 @@ if ! ps aux | grep -v grep | grep swaylock; then
SCREENOFF=$!
swaylock
kill $SUSPEND $SCREENOFF
fi"))
fi" "\nEOF"))
(chmod #$output #o755))))
(define bin-fss
(plain-file "bin-fss" "\
(computed-file "bin-fss"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
# made by aryak.vern.cc modified by cobra.vern.cc
if [[ -S \"/tmp/mpvfsfsock\" ]]; then
@ -133,10 +157,13 @@ if [[ -S \"/tmp/mpvfsfsock\" ]]; then
else
mpv --input-ipc-server=/tmp/mpvfsfsock ~/.local/share/fss.ogg
trap \"rm -rf /tmp/mpvfsfsock\" EXIT
fi"))
fi" "\nEOF"))
(chmod #$output #o755))))
(define bin-beep-wrapper
(plain-file "bin-beep-wrapper" "\
(computed-file "bin-beep-wrapper"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
while sleep 1; do
## Battery beep
@ -150,15 +177,21 @@ while sleep 1; do
BEEPED=0
fi
fi
done"))
done" "\nEOF"))
(chmod #$output #o755))))
(define bin-beep
(plain-file "bin-beep" "\
(computed-file "bin-beep"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env sh
echo $1 > /proc/acpi/ibm/beep"))
echo $1 > /proc/acpi/ibm/beep" "\nEOF"))
(chmod #$output #o755))))
(define bin-backtick
(plain-file "bin-backtick" "\
(computed-file "bin-backtick"
#~(begin
(system (string-append #$coreutils "/bin/cat << \"EOF\" >" #$output "\n" "\
#!/usr/bin/env bash
cpu() {
@ -173,4 +206,5 @@ bat() {
acpi -b | sed 's/Battery /BAT/'
}
echo \"$(cpu)% $(ram) $(bat)\""))
echo \"$(cpu)% $(ram) $(bat)\"" "\nEOF"))
(chmod #$output #o755))))

View File

@ -16,7 +16,7 @@ if [[ $HOSTNAME == pp ]]; then
PASTE_COMMAND=\"wl-paste\"
WIFI=wlan0
WM=\"bash\"
elif [[ $HOSTNAME == Xenon ]]; then
elif [[ $HOSTNAME == Oganesson ]]; then
PRIV=sudo
UPDATE=\"guix pull --branch=master && guix system reconfigure /etc/guix-config/${HOSTNAME,,}.scm && guix package -u\"
COPY_COMMAND=\"wl-copy\"

View File

@ -10,10 +10,10 @@
(gnu services mcron)
(guix gexp)
;; Deranged Guix Home Configuration Usage(TM)
;; Deranged Guix Home Usage(TM)
(cobra homedir)
(cobra bin)
(cobra config))
(cobra config)
(cobra bin))
(define webfetch-job
#~(job "*/1 * * * *"

View File

@ -7,7 +7,7 @@ if [[ $HOSTNAME == pp ]]; then
PASTE_COMMAND="wl-paste"
WIFI=wlan0
WM="bash"
elif [[ $HOSTNAME == Xenon ]]; then
elif [[ $HOSTNAME == Oganesson ]]; then
PRIV=sudo
UPDATE="guix pull --branch=master && guix system reconfigure /etc/guix-config/${HOSTNAME,,}.scm && guix package -u"
COPY_COMMAND="wl-copy"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env bash
cd ~/.local/share/torbrowser/tor-browser/
guix shell --check --pure --expression='(list (@@ (gnu packages gcc) gcc-11) "lib")' coreutils bash grep sed gcc-toolchain patchelf gtk+ dbus-glib libxt libevent openssl file alsa-lib << EOF
guix shell --check --pure --expression='(list (@@ (gnu packages gcc) gcc-11) "lib")' coreutils bash grep sed gcc-toolchain patchelf gtk+ dbus-glib libxt libevent openssl file alsa-lib << "EOF" >/gnu/store/fivbm252q6y700l89dvqm4mgdgpf0dpc-bin-torbrowser1
set -x
cd Browser
patchelf --set-interpreter \$LIBRARY_PATH/ld-linux-x86-64.so.2 firefox.real
patchelf --set-interpreter \$LIBRARY_PATH/ld-linux-x86-64.so.2 TorBrowser/Tor/tor
LD_LIBRARY_PATH=\$LIBRARY_PATH ./start-tor-browser -v
EOF
EOT