summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2025-07-10 12:24:33 +0200
committerfilip <“filip.rabiega@gmail.com”>2025-07-10 12:24:33 +0200
commite4ea00cfc9fc7340c62dd920b4754787c4499de6 (patch)
tree2e4c036888529e99cd67a0ee59d9ac8bb5e09000
parent1feb678fc3d52a7a3c4e31bb153783852fa08a58 (diff)
downloadchadscripts-master.tar.gz
chadscripts-master.tar.bz2
chadscripts-master.zip
new scripts i guessHEADmaster
-rwxr-xr-xauxless6
-rwxr-xr-xbrightness5
-rwxr-xr-xbuku-dmenu3
-rwxr-xr-xchadsearch7
-rwxr-xr-xdecperc30
-rwxr-xr-xdeploy9
-rwxr-xr-xinpath10
-rwxr-xr-xlogrm2
-rwxr-xr-xls_new14
-rwxr-xr-xnewscript21
-rwxr-xr-xnewsup13
-rwxr-xr-xprintpath10
-rwxr-xr-xsaferm14
-rwxr-xr-xscan11
-rwxr-xr-xtst3
-rwxr-xr-xvolume3
16 files changed, 123 insertions, 38 deletions
diff --git a/auxless b/auxless
index 5d2e698..50f4919 100755
--- a/auxless
+++ b/auxless
@@ -1,5 +1,5 @@
#!/bin/sh
-smod () {
- cd $HOME/repos/$1 && vim config.def.h && sudo cp config.def.h config.h && sudo make clean install && cd -
-}
+[ "$#" -ne 1 ] && { echo "Usage: auxless <suckless-program>" >&2 ; exit 1; }
+
+cd "$HOME"/repos/"$1" && vim config.def.h && sudo cp config.def.h config.h && sudo make clean install && cd - || exit
diff --git a/brightness b/brightness
new file mode 100755
index 0000000..8835859
--- /dev/null
+++ b/brightness
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+monitor="eDP-1"
+
+xrandr --output $monitor --brightness "$1"
diff --git a/buku-dmenu b/buku-dmenu
index 77a059b..d77a0be 100755
--- a/buku-dmenu
+++ b/buku-dmenu
@@ -4,9 +4,6 @@ if [ "$1" == "--help" ] ; then
echo "Run the script, start typing until the desired bookmark is selected."
echo "buku and dmenu must be installed."
return 1
-elif [ "$1" == "--version" ] ; then
- echo "buku-dmenu $version"
- return 1
fi
# get all bmks | swap tabs for spaces | run dmenu | cut to ID | run buku if not empty
diff --git a/chadsearch b/chadsearch
index 824ca87..852205d 100755
--- a/chadsearch
+++ b/chadsearch
@@ -1,8 +1,3 @@
#!/bin/sh
-chadsearch ()
-{
- librewolf --new-window --search "$1"
-}
-
-chadsearch $1
+librewolf --new-window --search "$1"
diff --git a/decperc b/decperc
new file mode 100755
index 0000000..a19ed95
--- /dev/null
+++ b/decperc
@@ -0,0 +1,30 @@
+#!/usr/bin/zsh
+
+dec_into_perc () {
+ dec="$1"
+ # duplicating code, don't care
+ if echo "$dec" | grep -qE '^(-?[0-9]+\.[0-9]+|-?[0-9]|\.[0-9]+)$'; then
+ percent="$( echo "$dec * 100" | bc -l )"
+ echo "${percent}%"
+ else
+ echo "Error: not a decimal number" >&2
+ exit 1
+ fi
+}
+
+perc_into_dec () {
+ perc="$1"
+ # duplicating code, don't care
+ if echo "$perc" | grep -qE '^(-?[0-9]+\.[0-9]+%|-?[0-9]+%|\.[0-9]+%)$'; then
+ dec="{$perc%?}"
+ dec="$( echo "$dec / 100" | bc -l )"
+ echo "$dec"
+ else
+ echo "Error: not a percent" >&2
+ exit 1
+ fi
+}
+
+echo "$1" | grep -qE '^(-?[0-9]+\.[0-9]+|-?[0-9]|\.[0-9]+|-?[0-9]+\.[0-9]+%|-?[0-9]+%|\.[0-9]+%)$' &&
+ len=${#1} &&
+ [[ "${1:len-1:1}" == "%" ]] && perc_into_dec "$1" || dec_into_perc "$1"
diff --git a/deploy b/deploy
new file mode 100755
index 0000000..face70a
--- /dev/null
+++ b/deploy
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+user="root"
+host="rabiega.xyz"
+dir="/var/www/mysite/"
+
+cd "$HOME"/website/ && hugo && rsync -avz --delete "$HOME"/website/public/ ${user}@${host}:${dir} && cd - || exit
+
+exit 0
diff --git a/inpath b/inpath
index f625b17..bab47b4 100755
--- a/inpath
+++ b/inpath
@@ -1,8 +1,8 @@
#!/bin/sh
in_path () {
- local cmd=$1 path=$2 res=1
- local IFS=":"
+ cmd=$1 path=$2 res=1
+ IFS=":"
for dir in $path;
do
@@ -19,11 +19,11 @@ cmd_in_path () {
var=$1
if [ -n "$var" ]; then
- if [ $(echo "$var" | cut -c 1) = "/" ]; then
- if [ ! -x $var ]; then
+ if [ "$( echo "$var" | cut -c 1 )" = "/" ]; then
+ if [ ! -x "$var" ]; then
return 1
fi
- elif ! in_path $var "$PATH"; then
+ elif ! in_path "$var" "$PATH"; then
return 2
fi
fi
diff --git a/logrm b/logrm
index 7ba296a..bd9f29c 100755
--- a/logrm
+++ b/logrm
@@ -10,7 +10,7 @@ fi
if [ "$1" = "-s" ]; then
shift
else
- echo "$(date): ${USER}: $@" >> $removelog
+ echo "$(date): ${USER}: $*" >> $removelog
fi
rm -i "$@"
diff --git a/ls_new b/ls_new
new file mode 100755
index 0000000..edaf313
--- /dev/null
+++ b/ls_new
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# New and better ls
+ls_new () {
+ LC_ALL=C $( which ls ) -lAFh --color=always "$1" | awk '{
+ name = $9;
+ for (i = 10; i <= NF; i++) name = name " " $i;
+ print $1, $5, name
+ }' | column -t -s ' ' | tail -n +2
+}
+
+dir="$1"
+[ -z "$1" ] && dir="$(pwd)"
+ls_new "$dir"
diff --git a/newscript b/newscript
index ef450a5..c251e20 100755
--- a/newscript
+++ b/newscript
@@ -1,21 +1,16 @@
#!/bin/sh
-newscript ()
-{
- local name=$1
- cd ~/.scripts && touch "$name" && printf "#!/bin/sh\n\n" > "$name" && vim +2 "$name"
- local linecount=$(wc -l < $HOME/.scripts/$name)
- if [ "$linecount" -lt 2 ]; then
- rm -f "$HOME/.scripts/$name"
+newscript () {
+ path="$HOME/.scripts/$1"
+ touch "$path" && printf "#!/bin/sh\n\n" > "$path" && "$EDITOR" +2 "$path"
+ if [ "$( wc -l "$path" | awk '{print $1}' )" -lt 3 ]; then
+ rm -f "$path"
else
- chmod +x "$name" && cd -
+ chmod +x "$path"
fi
}
-if [ $# -ne 1 ]; then
- echo "Usage: newscript <script-name>"
- exit 1
-fi
+[ "$#" -ne 1 ] && { echo "Usage: newscript <script-name>" >&2; exit 1; }
-newscript $1
+newscript "$1"
exit 0
diff --git a/newsup b/newsup
new file mode 100755
index 0000000..c5ae4c5
--- /dev/null
+++ b/newsup
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Script by Luke Smith
+
+/usr/bin/notify-send "Updating RSS feeds..."
+
+pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
+
+echo 🔃 > /tmp/newsupdate
+pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
+/usr/bin/newsboat -x reload
+rm -f /tmp/newsupdate
+pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
+/usr/bin/notify-send "RSS feed update complete."
diff --git a/printpath b/printpath
new file mode 100755
index 0000000..55a3212
--- /dev/null
+++ b/printpath
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# This script is slow, but it works
+IFS=:
+for dir in $PATH; do
+ [ -d "$dir" ] || continue
+ for file in "$dir"/* "$dir"/.*; do
+ [ -f "$file" ] && [ -x "$file" ] && basename "$file"
+ done
+done | sort -u
diff --git a/saferm b/saferm
index 9a455fa..4d8fc7a 100755
--- a/saferm
+++ b/saferm
@@ -17,23 +17,23 @@ do
* ) flags="$flags -$opt" ;;
esac
done
-shift $(( $OPTIND - 1 ))
+shift $(( OPTIND - 1 ))
-if [ ! -d $archive ]; then
- if [ ! -w $HOME ]; then
+if [ ! -d "$archive" ]; then
+ if [ ! -w "$HOME" ]; then
echo "$0 failed: can't create $archive in $HOME" >&2
exit 1
fi
- mkdir $archive
- chmod 700 $archive
+ mkdir "$archive"
+ chmod 700 "$archive"
fi
for arg
do
newname="$archive/$(date "+%S.%M.%H.%d.%m").$(basename "$arg")"
- if [ -f "$arg" -o -d "$arg" ]; then
+ if [ -f "$arg" ] || [ -d "$arg" ]; then
$copy "$arg" "$newname"
fi
done
-exec $realrm $flags "$@"
+exec $realrm "$flags" "$@"
diff --git a/scan b/scan
new file mode 100755
index 0000000..f06d5a4
--- /dev/null
+++ b/scan
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Find all files in subdirectories (excluding top-level files)
+file=$(find . -mindepth 2 -type f 2>/dev/null | sed 's|^\./||' | sort | dmenu -i -p "Select a file:")
+
+# If a file was selected
+if [ -n "$file" ]; then
+ echo "You selected: $file"
+ # Do something with the selected file here, like open it:
+ # xdg-open "$file" # Uncomment if desired
+fi
diff --git a/tst b/tst
new file mode 100755
index 0000000..8734d35
--- /dev/null
+++ b/tst
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+tabbed -c st -w
diff --git a/volume b/volume
new file mode 100755
index 0000000..b40ecf1
--- /dev/null
+++ b/volume
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pactl set-sink-volume @DEFAULT_SINK@ "$1"