diff options
author | filip <“filip.rabiega@gmail.com”> | 2025-07-10 12:24:33 +0200 |
---|---|---|
committer | filip <“filip.rabiega@gmail.com”> | 2025-07-10 12:24:33 +0200 |
commit | e4ea00cfc9fc7340c62dd920b4754787c4499de6 (patch) | |
tree | 2e4c036888529e99cd67a0ee59d9ac8bb5e09000 | |
parent | 1feb678fc3d52a7a3c4e31bb153783852fa08a58 (diff) | |
download | chadscripts-master.tar.gz chadscripts-master.tar.bz2 chadscripts-master.zip |
-rwxr-xr-x | auxless | 6 | ||||
-rwxr-xr-x | brightness | 5 | ||||
-rwxr-xr-x | buku-dmenu | 3 | ||||
-rwxr-xr-x | chadsearch | 7 | ||||
-rwxr-xr-x | decperc | 30 | ||||
-rwxr-xr-x | deploy | 9 | ||||
-rwxr-xr-x | inpath | 10 | ||||
-rwxr-xr-x | logrm | 2 | ||||
-rwxr-xr-x | ls_new | 14 | ||||
-rwxr-xr-x | newscript | 21 | ||||
-rwxr-xr-x | newsup | 13 | ||||
-rwxr-xr-x | printpath | 10 | ||||
-rwxr-xr-x | saferm | 14 | ||||
-rwxr-xr-x | scan | 11 | ||||
-rwxr-xr-x | tst | 3 | ||||
-rwxr-xr-x | volume | 3 |
16 files changed, 123 insertions, 38 deletions
@@ -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" @@ -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 @@ -1,8 +1,3 @@ #!/bin/sh -chadsearch () -{ - librewolf --new-window --search "$1" -} - -chadsearch $1 +librewolf --new-window --search "$1" @@ -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" @@ -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 @@ -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 @@ -10,7 +10,7 @@ fi if [ "$1" = "-s" ]; then shift else - echo "$(date): ${USER}: $@" >> $removelog + echo "$(date): ${USER}: $*" >> $removelog fi rm -i "$@" @@ -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" @@ -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 @@ -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 @@ -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" "$@" @@ -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 @@ -0,0 +1,3 @@ +#!/bin/sh + +tabbed -c st -w @@ -0,0 +1,3 @@ +#!/bin/sh + +pactl set-sink-volume @DEFAULT_SINK@ "$1" |