This commit is contained in:
abs3nt 2023-03-07 21:38:29 -08:00
parent 387dce4f1e
commit 8d04ddfbf1
Signed by: abs3nt
GPG Key ID: FDC6662313FA9386
7 changed files with 201 additions and 0 deletions

32
Scripts/gfxpg Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
choosefrom ()
{
select option; do # in "$@" is the default
if [ 1 -le "$REPLY" ] && [ "$REPLY" -le $(($#)) ];
then
echo $option
break;
fi
done
}
echo "connecting to cluster"
default_pg_cluster_name=${pg_cluster_name:=$(kubectl get postgresql -ojsonpath="{.items[0].metadata.name}")}
echo -e "\npostgres cluster name?"
pg_cluster_name=$(choosefrom ${pg_cluster_name:=$(kubectl get services -ojsonpath="{.items[*].metadata.name}")})
echo -e "\nuser?"
pg_user_name=$(choosefrom $(kubectl get secrets -o json | jq -r '.items[] | .data.username | select(. != null) | (@base64d)'))
echo -e "\ndatabase? default=postgres"
read pg_database
pg_database=${pg_database:="postgres"}
echo -e "\nhost port? default=5444"
read pg_host_port
pg_host_port=${pg_host_port:="5444"}
PGMASTER=$(kubectl get pods -o jsonpath={.items..metadata.name} -l application=spilo,cluster-name=$pg_cluster_name,spilo-role=master -n default)
echo "about to forward $pg_cluster_name $PGMASTER to $pg_host_port"
kubectl port-forward $PGMASTER "$pg_host_port:5432" &
export PGPASSWORD=$(kubectl get secret $(echo $pg_user_name | sed -e "s/_/-/g").$pg_cluster_name.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)
while true
do
psql postgres://$pg_user_name:$PGPASSWORD@localhost:$pg_host_port/$pg_database
sleep 1
done

14
Scripts/hashes Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
awk -v newsums="$(makepkg -g)" '
BEGIN {
if (!newsums) exit 1
}
/^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*$/ {
if (!i) print newsums; i++
next
}
1
' PKGBUILD > PKGBUILD.new && mv PKGBUILD{.new,}

29
Scripts/lockscreen.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
. ~/.cache/wal/colors.sh
swaylock \
--clock \
--timestr "%I:%M:%S" \
--indicator \
--ignore-empty-password \
--show-failed-attempts \
--daemonize \
-i $wallpaper \
--effect-blur 50x10 \
--indicator-radius 150 \
--inside-color 00000000 \
--inside-clear-color $color1 \
--inside-ver-colo $color2 \
--inside-wrong-color $color9 \
--line-color $color9 \
--line-clear-color $color9 \
--line-ver-color $color9 \
--line-wrong-color $color9 \
--ring-color $color9 \
--ring-clear-color $color9 \
--ring-ver-color $color9 \
--ring-wrong-color $color10 \
--separator-color $color14 \
--key-hl-color $color14 \
--bs-hl-color $color10 \
--text-color $color9

45
Scripts/proton Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# Usage:
# proton program.exe
#
# Example Env Vars:
# PROTONPREFIX="$HOME/proton_316"
# PROTONVERSION="Proton 3.16"
# Folder name of the Proton version found under "steamapps/common/".
# proton_version="Proton - Experimental"
proton_version="Proton - Experimental"
# Path to installation directory of Steam.
# Alternate path: "$HOME/.steam/steam"
client_dir="$HOME/.steam/steam"
# Default data folder for Proton/WINE environment. Folder must exist.
# If the environmental variable PROTONPREFIX is set, it will overwrite env_dir.
mkdir -p "$HOME/.proton/$proton_version"
env_dir="$HOME/.proton/$proton_version"
WINEPREFIX=protontricks vcrun2017
# Proton modes to run
# run = start target app
# waitforexitandrun = wait for wineserver to shut down
# getcompatpath = linux -> windows path
# getnativepath = windows -> linux path
mode=run
# ENVIRONMENTAL VARIABLES
if [ -n "${PROTONPREFIX+1}" ]
then
env_dir=$PROTONPREFIX
fi
if [ -n "${PROTONVERSION+1}" ]
then
proton_version=$PROTONVERSION
fi
# EXECUTE
export STEAM_COMPAT_CLIENT_INSTALL_PATH=$client_dir
export STEAM_COMPAT_DATA_PATH=$env_dir
"$client_dir/steamapps/common/$proton_version/proton" $mode $*

2
Scripts/set_wallpaper Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
wal --cols16 -s -i $HOME/Pictures/Wallpapers

12
Scripts/tmux Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
DIR_NAME=${PWD##*/}
tmux has-session -t $DIR_NAME 2>/dev/null
if [ $? -eq 1 ]
then
tmux new -s $DIR_NAME -d
tmux attach -t $DIR_NAME
else
tmux a -t $DIR_NAME
fi

67
Scripts/weather Executable file
View File

@ -0,0 +1,67 @@
#!/usr/local/bin/gentee
const : URL = "https://wttr.in/"
const : URLV2 = "https://v2.wttr.in/"
const : URLV3 = "https://v3.wttr.in/"
const : MOONURL = "https://wttr.in/moon@"
func dirs() arr.str {
arr.str res = {
GetEnv("HOME")+"/.config/wttr/default-city.txt",
GetEnv("HOME")+"/.wttr",
}
return res
}
func help() str {
return Format(`
Usage: wttr <region>
-v2
Use v2 (%s)
-v3
Use v3 (%s)
-m
display moon (%s)
-c
Use metric units
-f
Use imperial units
-t -today
Display today's weather
`,
URLV2,
URLV3,
MOONURL,
)
}
func request(str url) str {
map empty
map headers = {"User-Agent":"curl/7.87"}
return HTTPRequest(url, "GET", empty, headers)
}
run {
if IsArg("h") || IsArg("help") {
Println(help())
return
}
str loc = Arg("")
str url = URL
for fl in dirs() {
if ExistFile(fl): loc = TrimSpace(ReadFile(fl)); break;
}
if IsArg("v2"): url = URLV2
if IsArg("v3"): url = URLV3
if IsArg("m"): url = MOONURL
switch Arg("")
case "":
default: loc = Arg("")
switch loc
case "": url = url + "?"
default: url = url + loc +"?"
if IsArg("c"): url = url + "&m"
if IsArg("f"): url = url + "&u"
if (IsArg("t")||IsArg("today")): url = url + "&1n"
Run(`head`,"-n","-1", stdin: buf(request(url)))
}