From 06696ca201682f63ea50da3ab41d992ed6b61816 Mon Sep 17 00:00:00 2001 From: ene Date: Sat, 25 Feb 2023 07:54:37 +0100 Subject: Feat(packages): Add my scripts --- home-manager/packages/scripts/apps/aumo | 53 +++++ home-manager/packages/scripts/apps/con2pdf | 101 +++++++++ .../deprecated/riR/compare_all_files(has_been_riR) | 87 ++++++++ .../packages/scripts/apps/deprecated/riR/config | 147 +++++++++++++ .../apps/deprecated/riR/lf-move-fill(has_been_riR) | 40 ++++ .../packages/scripts/apps/deprecated/walldl | 174 +++++++++++++++ .../packages/scripts/deprecated/clear_systemd | 27 +++ home-manager/packages/scripts/deprecated/comp | 32 +++ home-manager/packages/scripts/deprecated/csd | 11 + home-manager/packages/scripts/deprecated/dua | 6 + home-manager/packages/scripts/deprecated/dua-up | 3 + .../packages/scripts/deprecated/enhanched_neofetch | 3 + home-manager/packages/scripts/deprecated/git-init | 11 + .../packages/scripts/deprecated/java_compiler/clpa | 15 ++ .../packages/scripts/deprecated/java_compiler/fmt | 16 ++ .../packages/scripts/deprecated/java_compiler/jc | 34 +++ .../packages/scripts/deprecated/java_compiler/jj | 58 +++++ .../packages/scripts/deprecated/java_compiler/lib | 41 ++++ .../packages/scripts/deprecated/java_compiler/new | 37 ++++ .../deprecated/java_compiler/no-pack/jc-no-pack | 22 ++ .../deprecated/java_compiler/no-pack/jj-no-pack | 57 +++++ .../packages/scripts/deprecated/remove_start | 29 +++ .../scripts/deprecated/shell_script_os_setup/lo | 11 + .../deprecated/locate_rewrite/locate | 2 + .../locate_rewrite/update_locate_database | 8 + .../scripts/small_functions/deprecated/order | 12 ++ .../scripts/small_functions/deprecated/ply-pre | 33 +++ .../packages/scripts/small_functions/dldragon | 28 +++ .../packages/scripts/small_functions/gtk-themes | 24 +++ home-manager/packages/scripts/small_functions/mocs | 15 ++ .../packages/scripts/small_functions/screen_shot | 11 + home-manager/packages/scripts/wrappers/backsnap | 3 + .../packages/scripts/wrappers/deprecated/clippy | 56 +++++ .../scripts/wrappers/deprecated/pacman/pacComp | 28 +++ .../scripts/wrappers/deprecated/pacman/pacF | 19 ++ .../scripts/wrappers/deprecated/pacman/pacS | 14 ++ .../wrappers/deprecated/pacman/packages_scan | 20 ++ .../packages/scripts/wrappers/deprecated/tidal-dl | 11 + .../packages/scripts/wrappers/deprecated/xi | 12 ++ .../packages/scripts/wrappers/deprecated/xs | 233 +++++++++++++++++++++ home-manager/packages/scripts/wrappers/ll | 13 ++ home-manager/packages/scripts/wrappers/llp | 19 ++ home-manager/packages/scripts/wrappers/spodi | 39 ++++ home-manager/packages/scripts/wrappers/virsh-del | 14 ++ home-manager/packages/scripts/wrappers/yti | 36 ++++ 45 files changed, 1665 insertions(+) create mode 100755 home-manager/packages/scripts/apps/aumo create mode 100755 home-manager/packages/scripts/apps/con2pdf create mode 100755 home-manager/packages/scripts/apps/deprecated/riR/compare_all_files(has_been_riR) create mode 100755 home-manager/packages/scripts/apps/deprecated/riR/config create mode 100755 home-manager/packages/scripts/apps/deprecated/riR/lf-move-fill(has_been_riR) create mode 100755 home-manager/packages/scripts/apps/deprecated/walldl create mode 100755 home-manager/packages/scripts/deprecated/clear_systemd create mode 100755 home-manager/packages/scripts/deprecated/comp create mode 100755 home-manager/packages/scripts/deprecated/csd create mode 100755 home-manager/packages/scripts/deprecated/dua create mode 100755 home-manager/packages/scripts/deprecated/dua-up create mode 100755 home-manager/packages/scripts/deprecated/enhanched_neofetch create mode 100755 home-manager/packages/scripts/deprecated/git-init create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/clpa create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/fmt create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/jc create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/jj create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/lib create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/new create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack create mode 100755 home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack create mode 100755 home-manager/packages/scripts/deprecated/remove_start create mode 100755 home-manager/packages/scripts/deprecated/shell_script_os_setup/lo create mode 100755 home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/locate create mode 100755 home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/update_locate_database create mode 100755 home-manager/packages/scripts/small_functions/deprecated/order create mode 100755 home-manager/packages/scripts/small_functions/deprecated/ply-pre create mode 100755 home-manager/packages/scripts/small_functions/dldragon create mode 100755 home-manager/packages/scripts/small_functions/gtk-themes create mode 100755 home-manager/packages/scripts/small_functions/mocs create mode 100755 home-manager/packages/scripts/small_functions/screen_shot create mode 100755 home-manager/packages/scripts/wrappers/backsnap create mode 100755 home-manager/packages/scripts/wrappers/deprecated/clippy create mode 100755 home-manager/packages/scripts/wrappers/deprecated/pacman/pacComp create mode 100755 home-manager/packages/scripts/wrappers/deprecated/pacman/pacF create mode 100755 home-manager/packages/scripts/wrappers/deprecated/pacman/pacS create mode 100755 home-manager/packages/scripts/wrappers/deprecated/pacman/packages_scan create mode 100755 home-manager/packages/scripts/wrappers/deprecated/tidal-dl create mode 100755 home-manager/packages/scripts/wrappers/deprecated/xi create mode 100755 home-manager/packages/scripts/wrappers/deprecated/xs create mode 100755 home-manager/packages/scripts/wrappers/ll create mode 100755 home-manager/packages/scripts/wrappers/llp create mode 100755 home-manager/packages/scripts/wrappers/spodi create mode 100755 home-manager/packages/scripts/wrappers/virsh-del create mode 100755 home-manager/packages/scripts/wrappers/yti (limited to 'home-manager/packages/scripts') diff --git a/home-manager/packages/scripts/apps/aumo b/home-manager/packages/scripts/apps/aumo new file mode 100755 index 00000000..863dcf32 --- /dev/null +++ b/home-manager/packages/scripts/apps/aumo @@ -0,0 +1,53 @@ +#!/bin/sh +# shellcheck disable=SC2046,2086 + +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +if [ "$1" = "-u" ];then udisksctl unmount -b $(cat $HOME/.cache/aumo/mnt_disk); exit 0; fi +all_available_disks=$(mktemp) +awk '{print $4}' /proc/partitions | sed '1 s|.*||' > "$all_available_disks" + +mounted_disk=$(mktemp) +awk '{print $1}' /proc/mounts > "$mounted_disk" + +unmounted_disks=$(mktemp) + +for i in $(cat $all_available_disks);do + if ! grep -qw "/dev/$i" $mounted_disk && ! ls /sys/block/$i/*/partition > /dev/null 2> /dev/null;then echo $i >> $unmounted_disks;fi +done + + +u=1 +disk=-1 +while [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ];do + + [ "$1" = "-v" ] && for i in $(cat $unmounted_disks);do + sudo fdisk -l "/dev/$i" + done + + for i in $(cat $unmounted_disks);do + printf "%4s) %s\n" "$u" "$i" + u=$(( u + 1 )) + done + + printf "%4s) Exit\n" "0" + printf "Input number: " + read -r disk + + [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}') ] && printf "Wrong number. Please retry\n" + [ $disk -eq 0 ] && exit 0 +done + +mnt_disk="/dev/$(awk -v n=$disk 'NR==n' $unmounted_disks)" + +if ! [ "$1" = "-v" ] && [ -n "$1" ];then sudo mount "$mnt_disk" "$1" && exit 0;fi +[ -n "$2" ] && sudo mount "$mnt_disk" "$1" && exit 0 +if mount | grep -q ~/mnt ;then dien "Something is mounted at ~/mnt";else udisksctl mount -b "$mnt_disk";fi + +[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo +echo $mnt_disk >> $HOME/.cache/aumo/mnt_disk +rm $all_available_disks +rm $mounted_disk +rm $unmounted_disks +[ -d /tmp/LIB_FILE_TEMP_DIR/ ] && rm -r /tmp/LIB_FILE_TEMP_DIR/ diff --git a/home-manager/packages/scripts/apps/con2pdf b/home-manager/packages/scripts/apps/con2pdf new file mode 100755 index 00000000..7d23fe82 --- /dev/null +++ b/home-manager/packages/scripts/apps/con2pdf @@ -0,0 +1,101 @@ +#! /bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +# Vars +counter=0; +a_set=false; +pw=$(pwd) + +usage() { + cat << EOF + This is a help doc! + -p for path + -h for help + -n for name + -g gen pdf dir + -r for number of pages per pdf +EOF +exit 0; +} + +# Ops +while getopts ":hp:n:gr:" flag;do + case "$flag" in + p) + Command_path=$OPTARG + ;; + n) + name=$OPTARG + ;; + g) + gen=true + ;; + r) + pages=$OPTARG + ;; + h) + usage;; + *) + usage;; + + esac + done +[ -z "$pages" ] && die "No pages set" + + +# Scan +if [ -z $Command_path ];then + tm=$(mktemp -d) + cd $tm || die "Bug" + + for i in $(seq $pages);do + scanimage --format=tiff --progress \ + --source ADF --device="airscan:w1:Brother DCP-9022CDW" \ + --batch=%d.tif --batch-increment=$pages --batch-start=$i + [ $? -ne 0 ] && scanimage --format=tiff --progress \ + --source ADF --device="airscan:w1:Brother DCP-9022CDW" \ + --batch=%d.tif --batch-increment=$pages --batch-start=$i + if [ $pages -ge 2 ];then + msg "Finished first turn, please change side!"; + readp "Ready to continue?" noop + fi + done +else + tm=$Command_path; +fi +cd $pw || die "Bug" + +# mk pdf +if [ "$gen" = true ];then + mkdir pdfs + cd pdfs/ || die "Bug" +fi + +while IFS= read -r i;do + + if [ $pages -ge 2 ];then + a_set=false; + if [ -z "$a" ];then + a="$i" + a_set=true; + : $((counter += 1)) + fi + + if [ -n "$a" ] && ! [ "$a_set" = true ];then + convert "$a" "$i" -compress jpeg -quality 70 "$name"_"$counter".pdf + a= + fi + else + : $((counter += 1)) + convert "$i" -compress jpeg -quality 70 "$name"_"$counter".pdf + fi + + +done < "$(tmp "ls $tm | sort -n | awk -v a=$tm -v c='/' '{printf a} {printf c} {print \$0}' ")" + + +rm -r $tm +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/apps/deprecated/riR/compare_all_files(has_been_riR) b/home-manager/packages/scripts/apps/deprecated/riR/compare_all_files(has_been_riR) new file mode 100755 index 00000000..023a2bbf --- /dev/null +++ b/home-manager/packages/scripts/apps/deprecated/riR/compare_all_files(has_been_riR) @@ -0,0 +1,87 @@ +#! /bin/bash + +tmp=$(mktemp) +tmp2=$(mktemp) +pstr="[=======================================================================]" +printf "Path to filter: " +read path + +## USE FIND INSTEAD OF LS +cd $path +results +echo "" > results + +declare weirdchars=" &\'" + +function normalise_and_rename() { + declare -a list=("${!1}") + for fileordir in "${list[@]}"; + do + newname="${fileordir//[${weirdchars}]/_}" + [[ ! -a "$newname" ]] && \ + mv "$fileordir" "$newname" || \ + echo "Skipping existing file, $newname." + done +} + +declare -a dirs files + +while IFS= read -r -d '' dir; do + dirs+=("$dir") +done < <(find -type d -print0 | sort -z) + +normalise_and_rename dirs[@] + +while IFS= read -r -d '' file; do + files+=("$file") +done < <(find -type f -print0 | sort -z) + +normalise_and_rename files[@] + +find $path > $tmp +total=$(cat $tmp | wc -l) +#ls -RAx1 --group-directories-first $path | awk NF | awk ' !/\//' > $tmp +#cat $tmp +#exit +for ((i = 1; i <= $(cat $tmp | wc -l); i++)) +do + FILE1=$(cat $tmp | awk -v n=$i 'NR == n {printf $0}') + printf "\r%3d.%1d%% %.${pd}s" $(( $i * 100 / $total )) $(( ($i * 1000 / $total) % 10 )) $pstr + if [ -d ${FILE1} ]; then + printf '%s is a Directory\n' "$FILE1" + else + echo ${FILE1} >> $tmp2 + fi +done +echo "##########################################################################################################################################" +echo "changing to search" +total=$(cat $tmp2 | wc -l) + +for ((i = 1; i <= $(cat $tmp2 | wc -l); i++)) +do + FILE1=$(cat $tmp2 | awk -v n=$i 'NR == n {printf $0}') + printf "total : %3d.%1d%% %.${pd}s\n" $(( $i * 100 / $total )) $(( ($i * 1000 / $total) % 10 )) $pstr + + for ((x = 1; x <= $(cat $tmp2 | wc -l); x++)) + do + FILE2=$(cat $tmp2 | awk -v n=$x 'NR == n {printf $0}') + printf "\r%3d.%1d%% %.${pd}s" $(( $x * 100 / $total )) $(( ($x * 1000 / $total) % 10 )) $pstr + if [ $x -eq $i ]; then + ((x=x+1)) + FILE2=$(cat $tmp2 | awk -v n=$x 'NR == n {printf $0}') + elif [ $(wc -c $FILE2 | awk '{print $1}') != $(wc -c $FILE1 | awk '{print $1}') ]; then + : + else + if cmp --silent "$FILE1" "$FILE2"; then + printf ' %s \n' "$FILE2" >> results + + fi + fi + done +done +echo +echo "#########################################################################" + +cat $dir +rm $tmp +rm $tmp2 diff --git a/home-manager/packages/scripts/apps/deprecated/riR/config b/home-manager/packages/scripts/apps/deprecated/riR/config new file mode 100755 index 00000000..b5607a16 --- /dev/null +++ b/home-manager/packages/scripts/apps/deprecated/riR/config @@ -0,0 +1,147 @@ +#!/bin/sh +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +git_repo_home="$XDG_CONFIG_HOME"/git_repo +[ -d "$git_repo_home" ] || mkdir "$git_repo_home" +launch_dir="$(dirname "$(readlink -f "$0")")" + +. "$launch_dir"/utils + +add() { + name=$(basename "$1") + while clean files | awk '{print $1}' | grep -w "^$name$" > /dev/null;do + printf "\"%s\" already exists, new name for link: " "$name" + read -r name + done + cp "$1" "$git_repo_home"/"$name" + { + printf "%s " "$name"; + printf "%s " "$1"; + printf "%s\n" "$(stat -c "%a" "$1")" + } >> "$git_repo_home"/files +} + +remove() { + tmp=$(grepw "$1") + if pre_check "$tmp";then + file_path="$(awk '{print $2}' "$tmp")" + file_name="$(awk '{print $1}' "$tmp")" + + rm "$git_repo_home"/"$file_name" + grep -v "$1" "$git_repo_home"/files > "$tmp" + cat "$tmp" > "$git_repo_home"/files + fi +} + +gitw() { + git --git-dir="$git_repo_home"/.git --work-tree="$git_repo_home" "$@" +} + +deploy_files() { + tmp=$(grepw "$1") + if pre_check "$tmp";then + file_path="$(awk '{print $2}' "$tmp")" + file_name="$(awk '{print $1}' "$tmp")" + file_bits="$(awk '{print $3}' "$tmp")" + + if [ -e "$file_path" ] && ! cmp "$git_repo_home"/"$file_name" "$file_path" > /dev/null;then + if overwrite_check "$file_path" "$file_name" "file" ;then + cp -f "$git_repo_home"/"$file_name" "$file_path" + fi + elif cmp "$git_repo_home"/"$file_name" "$file_path" > /dev/null;then + [ "$AUTO_GEN" = "Y" ] || msg "File is already deployed" + else + cp "$git_repo_home"/"$file_name" "$file_path" + chmod "$file_bits" "$file_path" + fi + fi +} + +update() { + tmp=$(grepw "$1") + if pre_check "$tmp";then + file_path="$(awk '{print $2}' "$tmp")" + file_name="$(awk '{print $1}' "$tmp")" + + if [ -e "$file_path" ] && ! cmp "$git_repo_home"/"$file_name" "$file_path" > /dev/null;then + if overwrite_check "$file_path" "$file_name" "backup" ;then + cp -f "$file_path" "$git_repo_home"/"$file_name" + fi + elif cmp "$git_repo_home"/"$file_name" "$file_path" > /dev/null;then + [ "$AUTO_GEN" = "Y" ] || msg "File does not need to be updated" + else + die "File does not exist on the system!" + fi + fi +} + +usage() { + cat << EO +This is config, an easy dotfiles backup service! + +help Outputs this help +add Adds the specified files +remove Removes the specified files +commit Same as 'config git commit' +git Runs git with the arguments in the backup directory +deploy Copies the specified file, or all files to their location +dump Dumps the 'files' file +update Updates the specified file, or all files if none are supplied +grep Searches for the supplied string in the 'files' file +EO +exit "$1" +} + +case "$1" in + "help") + shift 1 + usage 0 + ;; + "add") + shift 1 + while [ "$1" != "" ];do + add "$(readlink -f "$1")" + shift 1 + done + ;; + "remove") + shift 1 + shift_througth "remove" "$@" + ;; + "commit") + shift 1 + gitw commit + ;; + "git") + shift 1 + gitw "$@" + ;; + "deploy") + shift 1 + shift_througth "deploy_files" "$@" + ;; + "dump") + shift 1 + cat "$git_repo_home"/files + ;; + "update") + shift 1 + shift_througth "update" "$@" + ;; + "grep") + shift 1 + tmp=$(grepw "$1") + cat "$tmp" + ;; + *) + echo "Option $1 not recognized!" + usage 1 + ;; + + esac + + + + + if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/apps/deprecated/riR/lf-move-fill(has_been_riR) b/home-manager/packages/scripts/apps/deprecated/riR/lf-move-fill(has_been_riR) new file mode 100755 index 00000000..8a216b6b --- /dev/null +++ b/home-manager/packages/scripts/apps/deprecated/riR/lf-move-fill(has_been_riR) @@ -0,0 +1,40 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +tmp=$(mktemp); +out=$(mktemp); +clean $XDG_CONFIG_HOME/lf/rel_dirs > $tmp; + +get_hot_key() { + printf g + if ! [ "$i" = "$(readlink -f "$(cat $tmp | sed -n -e ${a}p)")" ];then + printf "%s" "$(basename "$(cat $tmp | sed -n -e ${a}p)" | cut -c 1)"; # i.e. /home/dt/school + fi + #if ! [ "$(realpath i)" = "$(cat $tmp | sed -n -e ${a}p)" ];then + # i = /home/dt/school/informatik + printf "%s" "$(basename $i | cut -c 1)"; + printf "%s" "$(basename $i | cut -c 2)"; + #fi + if [ $i = "$(cat $tmp | sed -n -e ${1}p)" ];then + printf '.'; + fi + +} + + +for a in $(seq "$(cat $tmp | wc -l )");do + echo $a >> $out; + + while IFS= read -r i;do + printf "map %s cd %s\n" "$(get_hot_key "$a")" "$i" >> $out; + done < "$(tmp find "$(cat $tmp | sed -n -e ${a}p)" -maxdepth 1)" + echo >> $out; +done + +cat $out # | awk '{print $2}' | sort | uniq -d; + +rm $tmp; +rm $out; +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/apps/deprecated/walldl b/home-manager/packages/scripts/apps/deprecated/walldl new file mode 100755 index 00000000..3b6752db --- /dev/null +++ b/home-manager/packages/scripts/apps/deprecated/walldl @@ -0,0 +1,174 @@ +#!/bin/bash +############################################################ +# Help # +############################################################ +Help() +{ + # Display Help + echo "Fetch all images accociated with a given URL." + echo + echo "options:" + echo "-h Print this Help." + echo "-H For Sites with hrefs" + echo "-L For Sites without hrefs" + echo "-C For generated Code" + echo +} + +############################################################ +############################################################ +# Main program # +############################################################ +############################################################ +############################################################ +# Create all needed tmp files and variables. # +############################################################ +Tav() { + pstr="[=======================================================================]" + out="$(mktemp)" + html="$(mktemp)" + NR="$(mktemp)" + printf "URL for Website: " + read url + dir=$(echo "$url" | awk '{ gsub(":|https",""); print $0 }') + try=HighRes +} +############################################################ +# Define downloader engines # +############################################################ +HighRes() { + # For Websites that have hrefs for bigger images + curl -sS $url | awk 'BEGIN { FS="\"";} /href=/ && /img src/ && !/index.html/ { print $2 } ' | awk '!a[$0]++' | sort > $out +} +LowRes() { + # For Websites that don't have hrefs + wget --quiet --output-document=${html} $url + cat $html | tidy --custom-tags pre --show-warnings no -q -output $html + cat $html | awk 'BEGIN { FS="\"";} /src=/ {print $2}' > $out +} +GenCode() { + # For Generated Code blocks + wget --quiet --output-document=${html} $url + cat $html | tidy --custom-tags pre --show-warnings no -q -output $html + + cat $html | awk ' / $NR + for ((i = 1; i <= $(cat $NR | wc -l); i++)) + do + lnNums=$(cat $NR | awk -v n=$i ' NR == n {print $0} ') + let "lnNums++" + cat $html | awk -v n=$lnNums 'BEGIN { FS="\"";} NR == n { print $2 } ' >> $out + done +} +############################################################ +# Process the input options. Add options as needed. # +############################################################ +# Get the options +while getopts ":hHLGV" option; do + case $option in + H) + proc=HighRes + ;; + L) + proc=LowRes + ;; + G) + proc=GenCode + ;; + V) + ver=true + ;; + \?) # Invalid option + echo "Error: Invalid option" + ;; + * | h) + Help + exit;; + esac +done +############################################################ +# Download it # +############################################################ +Down() { + total=$(cat $out | wc -l) + if [ $total -eq 0 ]; + then + case $try in + HighRes) + if [ ver ]; + then + echo "trying HighRes engine" + fi + HighRes + try="GenCode" + Down + ;; + LowRes) + if [ ver ]; + then + echo "trying LowRes engine" + fi + LowRes + try=":(" + Down + ;; + GenCode) + if [ ver ]; + then + echo "trying GenCode engine" + fi + GenCode + try="LowRes" + Down + ;; + *) + echo "Nothing found" + exit + ;; + esac + + else + cat $out + read -p "Do you want to download this to ${WALLPAPERDIR}/${dir}?(y/n) " -n 1 -r + echo + + if [[ $REPLY =~ ^[Yy]$ ]]; + then + mkdir -p ${WALLPAPERDIR}/${dir} + cd ${WALLPAPERDIR}/${dir} + url=$(echo $url | awk ' BEGIN {FS="/";} {printf "%s//%s/", $1, $3 } ' ) + # cycle throught all pictures and download them + for ((i = 0; i <= $total; i++ )) + do + awk -v n=$i 'FNR == n ' ${out} | xargs printf "$url%s\n" | xargs curl -OsS + pd=$(( $i * 73 / $total )) + printf "\r%3d.%1d%% %.${pd}s" $(( $i * 100 / $total )) $(( ($i * 1000 / $total) % 10 )) $pstr + done + printf "\n" + echo "downloaded to ${WALLPAPERDIR}${dir}" + rm -f "$out" + rm -f "$html" + rm -f "$NR" + fi + fi +} +############################################################ +# Call the functions # +############################################################ + +Tav +# case $proc in +# HighRes) +# HighRes +# ;; +# LowRes) +# LowRes +# ;; +# GenCode) +# GenCode +# ;; +# *) +# echo "No engine specified" +# exit +# ;; +# esac +Down diff --git a/home-manager/packages/scripts/deprecated/clear_systemd b/home-manager/packages/scripts/deprecated/clear_systemd new file mode 100755 index 00000000..56cfe95e --- /dev/null +++ b/home-manager/packages/scripts/deprecated/clear_systemd @@ -0,0 +1,27 @@ +#! /bin/bash + +tmp=$(mktemp) +tmp2=$(mktemp) +tmp3=$(mktemp) + +cat /mnt/pack > $tmp +cat /mnt/pack2 > $tmp2 + +if [ $(cat $tmp2 | wc -l) -gt $(cat $tmp | wc -l) ];then + cat $tmp2 > $tmp3 + cat $tmp > $tmp2 + cat $tmp3 > $tmp +fi + +for ((i=1; i<=$(cat $tmp | wc -l) ; i++)) +do + if grep -Fxq "$(awk -v n=$i 'NR==n' $tmp)" $tmp2; then + : + else + echo "$(awk -v n=$i 'NR==n' $tmp)" + fi +done + +rm $tmp +rm $tmp2 +rm $tmp3 diff --git a/home-manager/packages/scripts/deprecated/comp b/home-manager/packages/scripts/deprecated/comp new file mode 100755 index 00000000..e29cae5c --- /dev/null +++ b/home-manager/packages/scripts/deprecated/comp @@ -0,0 +1,32 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +file=$HOME/hi +tmp=$(mktemp) + +file2=$HOME/hi2 +tmp2=$(mktemp) +cat $file | awk -F "," '{ + for (i = 1; i <= 100; i++) { + if ($i == 0) { + } else { + print $i + } + } +}' | clean > $tmp + +cat $file2 | awk -F "," '{ + for (i = 1; i <= 100; i++) { + if ($i == 0) { + } else { + print $i + } + } +}' | clean > $tmp2 + +diff -y $tmp $tmp2 + +rm $tmp +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/csd b/home-manager/packages/scripts/deprecated/csd new file mode 100755 index 00000000..33105314 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/csd @@ -0,0 +1,11 @@ +#! /bin/zsh +function cd () { + if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then + [[ ! -e ${1:h} ]] && return 1 + print "Correcting ${1} to ${1:h}" + builtin cd ${1:h} + else + builtin cd "$@" + fi +} + diff --git a/home-manager/packages/scripts/deprecated/dua b/home-manager/packages/scripts/deprecated/dua new file mode 100755 index 00000000..628fa6f2 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/dua @@ -0,0 +1,6 @@ +#! /bin/bash + +tmp=$(mktemp) +cat $DUA_DATABASE > $tmp + +cat $tmp | awk '{print $1}' | sort diff --git a/home-manager/packages/scripts/deprecated/dua-up b/home-manager/packages/scripts/deprecated/dua-up new file mode 100755 index 00000000..2201f351 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/dua-up @@ -0,0 +1,3 @@ +#! /bin/bash +sudo btrfs filesystem du --raw / > $DUA_DATABASE +echo "done" diff --git a/home-manager/packages/scripts/deprecated/enhanched_neofetch b/home-manager/packages/scripts/deprecated/enhanched_neofetch new file mode 100755 index 00000000..2026341f --- /dev/null +++ b/home-manager/packages/scripts/deprecated/enhanched_neofetch @@ -0,0 +1,3 @@ +#! /bin/bash + +export ENHANCHED_NEOFETCH='$(pacman -Qn | wc -l) (pacman), $(pacman -Qm | wc -l) (aur), $(($(cargo install --list | wc -l ) / 2)) (cargo)' diff --git a/home-manager/packages/scripts/deprecated/git-init b/home-manager/packages/scripts/deprecated/git-init new file mode 100755 index 00000000..fd1f5399 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/git-init @@ -0,0 +1,11 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +cp -R $HOME/.local/share/git-template/* "$(pwd)" +[ -d ./.git ] || git init + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/java_compiler/clpa b/home-manager/packages/scripts/deprecated/java_compiler/clpa new file mode 100755 index 00000000..c33ed025 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/clpa @@ -0,0 +1,15 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +pw=$(pwd) +[ "$n" = "n" ] || cd .. +noColor=yes . ./lib + +unset CLASSPATH + +while IFS= read -r i;do + export CLASSPATH=$CLASSPATH$i: +done < "$(tmp cat "$(tmp "find $(pwd)/libs | sed 1d") $(tmp "find $(pwd)/scr | sed 1d")")" +cd $pw + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/java_compiler/fmt b/home-manager/packages/scripts/deprecated/java_compiler/fmt new file mode 100755 index 00000000..4dce0c02 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/fmt @@ -0,0 +1,16 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +cd ..; +pw=$(pwd); +cd ..; + +while IFS= read -r i;do + java -jar google-java-format-1.15.0-all-deps.jar -i $i +done < "$(tmp "find $pw/scr | sed 1d")" + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/java_compiler/jc b/home-manager/packages/scripts/deprecated/java_compiler/jc new file mode 100755 index 00000000..8f95108c --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/jc @@ -0,0 +1,34 @@ +#!/bin/sh +# shellcheck disable=SC2086 + +cd .. +noColor=yes . ./lib + +export CLASSPATH= +scr=$(mktemp) + +while IFS= read -r a;do + export CLASSPATH=$CLASSPATH$a: +done < "$(tmp "find libs/ | sed 1d")" + +while IFS= read -r a;do + echo "$a" >> $scr +done < "$(tmp "find scr/ | sed 1d")" + +n=n . ./clpa + +#while IFS= read -r a;do +# rm "$a" +#done < "$(tmp "find target/ | sed 1d")" + +javac -d target/ $(cat $scr | tr '\n' ' ') +if [ "$1" = "r" ];then + cd target || die "bug" + java Main + cd .. +else + ./jj target/ libs/ +fi + +rm $scr +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/java_compiler/jj b/home-manager/packages/scripts/deprecated/java_compiler/jj new file mode 100755 index 00000000..6d6a5aed --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/jj @@ -0,0 +1,58 @@ +#!/bin/sh +# shellcheck disable=SC2086 +noColor=yes . ./lib + +help() { +cat << EOF +Add all dirs with trailing / + +\$1 = java .class files dir +\$2 = java .jar files dir + +if you want to update libs delete this: +$wd/libs.cache + +EOF +exit 0 +} + + +class=$(mktemp) +jar=$(mktemp) +pwd=$(pwd) + +mkdir "$pwd"/out/cache 2> /dev/null +wd="$pwd"/out/cache +[ "$1" = "-h" ] && help +[ "$1" = "--help" ] && help + +[ -z "$1" ] && error "no args" && help && exit 1 +[ -z "$2" ] && error "no args" && help && exit 1 + +while IFS= read -r i;do + cp "$i" $wd/"$(basename $i)" +done < "$(tmp "find $1 | sed 1d" )" + +while IFS= read -r i;do + if ! grep "^$i$" "$wd"/libs.cache;then + echo "$i" | sed "s|$2||" >> "$wd"/libs.cache + cd $wd + jar -xf "$pwd"/"$i" + cd $pwd + fi +done < "$(tmp "find $2 | sed 1d" )" + +while IFS= read -r a;do + echo "$a" | sed "s|$wd/||" >> $jar +done < "$(tmp "find $wd | sed 1d")" + + + +cd "$wd" || die "No $wd" +jar -c -f myJar.jar -e Main $(cat $jar | tr '\n' ' ') + +mv myJar.jar "$pwd"/out/myJar.jar + +rm $jar +rm $class +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/deprecated/java_compiler/lib b/home-manager/packages/scripts/deprecated/java_compiler/lib new file mode 100755 index 00000000..8446d1ce --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/lib @@ -0,0 +1,41 @@ +#!/bin/sh +# shellcheck disable=SC2059,SC2066 + + + +out() { printf "$1 $2\n" "$(out2 "$@")"; } +out2() { shift 2; for i in "$*";do printf "$i";done; } + + +if [ "$noColor" = "yes" ];then +error() { >&2 out "==> ERROR:" "$*"; } >&2 +warning() { >&2 out "==> WARNING:" "$*"; } >&2 +msg() { out "==>" "$*"; } +msg2() { out " ->" "$*"; } + +readp() { printf "..> $1"; read -r "$2"; } + +else +error() { >&2 out "\033[1;91m==> ERROR:\033[0m" "\033[1;93m$*\033[0m"; } >&2 +warning() { >&2 out "\033[1;91m==> WARNING:\033[0m" "\033[1;93m$*\033[0m"; } >&2 +msg() { out "\033[1;96m==>\033[0m" "\033[1;93m$*\033[0m"; } +msg2() { out "\033[1;96m ->\033[0m" "\033[1;93m$*\033[0m"; } + +readp() { printf "\033[1;96m..>\033[0m \033[1;93m$1\033[0m"; read -r "$2"; } +fi + + + + + +dien() { error "$@" "failed"; exit 1; } +die() { error "$@"; exit 1; } + +clean() { awk '{if (NF) {if (!/^#/) {if (!/^[[:blank:]]*#/) {print $0}}}}' "$1"; } +# shellcheck disable=SC2294 +tmp() { + [ -d /tmp/LIB_FILE_TEMP_DIR/ ] || mkdir /tmp/LIB_FILE_TEMP_DIR/ + tmp=$(mktemp -p /tmp/LIB_FILE_TEMP_DIR/); + eval "$@" 1> "$tmp"; + echo "$tmp"; +} diff --git a/home-manager/packages/scripts/deprecated/java_compiler/new b/home-manager/packages/scripts/deprecated/java_compiler/new new file mode 100755 index 00000000..577558b0 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/new @@ -0,0 +1,37 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ./lib + + +[ -z "$1" ] && die "Requires name" +mkdir "$1" +pw="$1" + +ln -sr jc ./$pw/jc +ln -sr jj ./$pw/jj +ln -sr clpa ./$pw/clpa +ln -sr lib ./$pw/lib +ln -sr fmt ./$pw/fmt + +cd $pw +mkdir libs +mkdir -p out/cache +mkdir scr +mkdir target + +cat > scr/Main.java << EOL +public class Main { + public static void main(String[] args) { + System.out.println("Hello, world!"); + } +} +EOL +cat > .gitignore << EOL +/target +.gitignore +/out +EOL +git init > /dev/null +[ -d /tmp/LIB_FILE_TEMP_DIR/ ] && rm -r /tmp/LIB_FILE_TEMP_DIR/ +exit 0 diff --git a/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack new file mode 100755 index 00000000..bc9db9de --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack @@ -0,0 +1,22 @@ +#!/bin/sh +# shellcheck disable=SC2086 + +. ./lib +cd .. + +export CLASSPATH= +scr=$(mktemp) + +while IFS= read -r a;do + export CLASSPATH=$CLASSPATH$a: +done < "$(tmp "find libs/ | sed 1d")" + +while IFS= read -r a;do + echo "$a" >> $scr +done < "$(tmp "find scr/ | sed 1d")" + +javac -d target/ $(cat $scr | tr '\n' ' ') +../jj target/ libs/ +[ "$1" = "r" ] && java -jar out/myJar.jar + +rm $scr diff --git a/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack new file mode 100755 index 00000000..90a9e74e --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack @@ -0,0 +1,57 @@ +#!/bin/sh +# shellcheck disable=SC2086 +. ./lib + +help() { +cat << EOF +Add all dirs with trailing / + +\$1 = java .class files dir +\$2 = java .jar files dir + +if you want to update libs delete this: +"$wd"/libs.cache + +EOF +exit 0 +} + + +class=$(mktemp) +jar=$(mktemp) +pwd=$(pwd) + +mkdir "$pwd"/out/cache 2> /dev/null +wd="$pwd"/out/cache +[ "$1" = "-h" ] && help +[ "$1" = "--help" ] && help + +[ -z "$1" ] && echo "no args" && help && exit 1 +[ -z "$2" ] && echo "no args" && help && exit 1 + +while IFS= read -r i;do + cp "$i" $wd/"$(basename $i)" +done < "$(tmp "find $1 | sed 1d" )" + +while IFS= read -r i;do + if ! grep "^$i$" "$wd"/libs.cache;then + echo "$i" | sed "s|$2||" >> "$wd"/libs.cache + cd $wd + jar -xf "$pwd"/"$i" + cd $pwd + fi +done < "$(tmp "find $2 | sed 1d" )" + +while IFS= read -r a;do + echo "$a" | sed "s|$wd/||" >> $jar +done < "$(tmp "find $wd | sed 1d")" + + + +cd "$wd" || die "No $wd" +jar -c -f myJar.jar -e Main $(cat $jar | tr '\n' ' ') + +mv myJar.jar "$pwd"/out/myJar.jar + +rm $jar +rm $class diff --git a/home-manager/packages/scripts/deprecated/remove_start b/home-manager/packages/scripts/deprecated/remove_start new file mode 100755 index 00000000..b745a4d1 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/remove_start @@ -0,0 +1,29 @@ +#! /bin/bash + +cd "$i" || exit 1 +rm -r /tmp/scr +mkdir /tmp/scr/ +star='#!/bin/sh\n\n# shellcheck source=/dev/null\n. /root/.local/lib/shell/lib' + +for i in "$1"/*;do + awk ' + !/out2\(/ && + !/readp\(/ && + !/# shellcheck/ && + !/^#!\/bin\/sh/ && + !/^#! \/bin\/sh/ && + !/^#! \/bin\/bash/ && + !/^#!\/bin\/bash/ && + !/^out\(/ && + !/^error\(/ && + !/^warning\(/ && + !/^msg\(/ && + !/msg2\(/ && + !/^die\(/ && + !/^dien\(/ + ' "$i" > /tmp/scr/"$(basename "$i")" + sed -i "1 s|.*|$star\n&|" /tmp/scr/"$(basename "$i")" + +done + + diff --git a/home-manager/packages/scripts/deprecated/shell_script_os_setup/lo b/home-manager/packages/scripts/deprecated/shell_script_os_setup/lo new file mode 100755 index 00000000..eb204b94 --- /dev/null +++ b/home-manager/packages/scripts/deprecated/shell_script_os_setup/lo @@ -0,0 +1,11 @@ +#!/bin/sh + +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +stty -ctlecho +sudo loadkeys $HOME/keymap.map + +sh -c "$*" +sudo loadkeys "$(awk 'BEGIN {FS="="} {if (NR==1) {print $2;}}' /etc/vconsole.conf)" diff --git a/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/locate b/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/locate new file mode 100755 index 00000000..3dbddae9 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/locate @@ -0,0 +1,2 @@ +#! /bin/bash +awk --assign=se=$1 ' $0 ~ se {print $0} ' "${LOCATE_DATABASE}" diff --git a/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/update_locate_database b/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/update_locate_database new file mode 100755 index 00000000..88330ff6 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/deprecated/locate_rewrite/update_locate_database @@ -0,0 +1,8 @@ +#! /bin/bash +LOCATE_DATABASE="/home/dt/.cache/locate.db" +if [ ! -e ${LOCATE_DATABASE} ]; then + touch ${LOCATE_DATABASE} +fi +echo $(date) > ${LOCATE_DATABASE} +sudo find / >> ${LOCATE_DATABASE} + diff --git a/home-manager/packages/scripts/small_functions/deprecated/order b/home-manager/packages/scripts/small_functions/deprecated/order new file mode 100755 index 00000000..1471fcbd --- /dev/null +++ b/home-manager/packages/scripts/small_functions/deprecated/order @@ -0,0 +1,12 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +file=$HOME/hi3 +cat $file | clean | awk '{ + print (""$2" => {println!(\""$1"\")}") +}' + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/small_functions/deprecated/ply-pre b/home-manager/packages/scripts/small_functions/deprecated/ply-pre new file mode 100755 index 00000000..8e40486c --- /dev/null +++ b/home-manager/packages/scripts/small_functions/deprecated/ply-pre @@ -0,0 +1,33 @@ +#!/bin/sh + +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +## Preview Plymouth Splash ## +## by _khAttAm_ ## +## www.khattam.info ## +## License: GPL v3 ## + +chk_root () { + + if [ ! "$( id -u )" -eq 0 ]; then + echo Must be run as root + exit 1 + fi + +} + +chk_root + +DURATION=$1 + +if [ $# -ne 1 ]; then + DURATION=5 +fi + +plymouthd; plymouth --show-splash ; +for i in $(seq 1 $DURATION); do + plymouth --update=test"$i" ; sleep 1; +done; +plymouth quit diff --git a/home-manager/packages/scripts/small_functions/dldragon b/home-manager/packages/scripts/small_functions/dldragon new file mode 100755 index 00000000..b15390b8 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/dldragon @@ -0,0 +1,28 @@ +#!/bin/sh +# Provides the ability to download a file by dropping it into a window + +url=$(dragon -t -x) + +if [ -n "$url" ]; then + printf "File Name: " + name="" + while [ -z $name ] || [ -e $name ] + do + read -r name + if [ -e "$name" ]; then + printf "File already exists, overwrite (y|n): " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + printf "File Name: " + fi + fi + done + + # Download the file with curl + [ -n "$name" ] && curl -o "$name" "$url" || exit 1 +else + exit 1 +fi diff --git a/home-manager/packages/scripts/small_functions/gtk-themes b/home-manager/packages/scripts/small_functions/gtk-themes new file mode 100755 index 00000000..27303c27 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/gtk-themes @@ -0,0 +1,24 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + + +# usage: import-gsettings +config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" +if [ ! -f "$config" ]; then exit 1; fi + +gnome_schema="org.gnome.desktop.interface" +gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" +icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" +cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" +font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" +gsettings set "$gnome_schema" gtk-theme "$gtk_theme" +gsettings set "$gnome_schema" icon-theme "$icon_theme" +gsettings set "$gnome_schema" cursor-theme "$cursor_theme" +gsettings set "$gnome_schema" font-name "$font_name" + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/small_functions/mocs b/home-manager/packages/scripts/small_functions/mocs new file mode 100755 index 00000000..e14a84c8 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/mocs @@ -0,0 +1,15 @@ +#! /bin/bash +if [[ "$(pgrep mocp)" -eq 0 ]]; +then + mocp -M "${XDG_CONFIG_HOME}"/moc -S + if [[ $1 -eq 0 ]]; + then + mocp -M "${XDG_CONFIG_HOME}"/moc -v 12 + else + mocp -M "${XDG_CONFIG_HOME}"/moc -v "$1" + fi + mocp -M "${XDG_CONFIG_HOME}"/moc -p + mymocp& +else + mocp -M "${XDG_CONFIG_HOME}"/moc -G +fi diff --git a/home-manager/packages/scripts/small_functions/screen_shot b/home-manager/packages/scripts/small_functions/screen_shot new file mode 100755 index 00000000..152feb36 --- /dev/null +++ b/home-manager/packages/scripts/small_functions/screen_shot @@ -0,0 +1,11 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +grim -g "$(slurp)" ~/media/pictures/screenshots/"$(date +%s)".png && + alacritty -e llp -command ":{{ set sortby atime; set reverse!; }}" ~/media/pictures/screenshots + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/backsnap b/home-manager/packages/scripts/wrappers/backsnap new file mode 100755 index 00000000..3487ba57 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/backsnap @@ -0,0 +1,3 @@ +#! /bin/sh +snap-sync --noconfirm -u d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0 +umount /run/dt/d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0 diff --git a/home-manager/packages/scripts/wrappers/deprecated/clippy b/home-manager/packages/scripts/wrappers/deprecated/clippy new file mode 100755 index 00000000..89f8554a --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/clippy @@ -0,0 +1,56 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +tmp=$(mktemp); +cat << EOF > $tmp; +-W clippy::allow_attributes_without_reason +-W clippy::clone_on_ref_ptr +-W clippy::create_dir +-W clippy::decimal_literal_representation +-W clippy::filetype_is_file +-W clippy::get_unwrap +-W clippy::if_then_some_else_none +-W clippy::large_include_file +-W clippy::let_underscore_must_use +-W clippy::missing_enforced_import_renames +-W clippy::mixed_read_write_in_expression +-W clippy::mod_module_files +-W clippy::multiple_inherent_impl +-W clippy::rc_mutex +-W clippy::rc_buffer +-W clippy::rest_pat_in_fully_bound_structs +-W clippy::same_name_method +-W clippy::single_char_lifetime_names +-W clippy::str_to_string +-W clippy::string_to_string +-W clippy::unneeded_field_pattern +-W clippy::unseparated_literal_suffix +-W clippy::verbose_file_reads +-W clippy::wildcard_enum_match_arm + +# debugging remnants +-W clippy::unwrap_used +#-W clippy::use_debug +#-W clippy::unreachable +#-W clippy::unimplemented +#-W clippy::todo +#-W clippy::panic +#-W clippy::panic_in_result_fn +#-W clippy::expect_used +#-W clippy::dbg_macro + +# Docs +-W clippy::missing_docs_in_private_items +-W clippy::undocumented_unsafe_blocks + + +EOF + + +cargo clippy -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used -W clippy::cargo $(clean "$tmp") + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/pacman/pacComp b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacComp new file mode 100755 index 00000000..9fdfd8e7 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacComp @@ -0,0 +1,28 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + + +for i in $(cat ~/pacsaves);do + + a=$(echo $i | sed 's|.pacsave||') + + printf "%s AND %s\n" "$a" "$i" + sudo diff -y "$a" "$i" + a= + readp "Delete .pacsave? [N/y]" ans + if [ "$ans" = y ];then + sudo rm $i + sed -i "s|$i||" ~/pacsaves + fi + + +done + + + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/pacman/pacF b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacF new file mode 100755 index 00000000..09d0329c --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacF @@ -0,0 +1,19 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +while true +do + tmp=$(mktmp) + readp "Input: " pac + pacman -F --color=always $pac > $tmp + cat "$tmp" + cat $tmp | awk -F "/" 'NR==1 {print $2}' + rm $tmp +done + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/pacman/pacS b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacS new file mode 100755 index 00000000..20947864 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/pacman/pacS @@ -0,0 +1,14 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +while true +do + readp "Package Name: " pac + pacman -Si --color=always "$pac" +done + + + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/pacman/packages_scan b/home-manager/packages/scripts/wrappers/deprecated/pacman/packages_scan new file mode 100755 index 00000000..2229ef23 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/pacman/packages_scan @@ -0,0 +1,20 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +tmp=$(tmp 'pacman -Qq'); +output=$(mktmp); + + +while read -r line; do + msg2 reading $line; + pacman_out=$(tmp "pacman -Qi $line"); + description=$(awk -F ":" '/Description/ {print $2}' $pacman_out); + printf "%s # " $line >> $output; + echo $description >> $output; +done < $tmp + +cat $output; + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/tidal-dl b/home-manager/packages/scripts/wrappers/deprecated/tidal-dl new file mode 100755 index 00000000..c709a63d --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/tidal-dl @@ -0,0 +1,11 @@ +#! /bin/bash +tmp=$(mktemp) + +scrap > $tmp + +for ((i=0; i < $( cat $tmp | wc -l); i++)) +do + out=$(awk -v n=$i 'NR == n {print $0}' $tmp) + spotdl --output /home/dt/media/playlist/down --output-format mp3 --lyrics-provider genius --dt 16 --st 16 "${out}" +done + diff --git a/home-manager/packages/scripts/wrappers/deprecated/xi b/home-manager/packages/scripts/wrappers/deprecated/xi new file mode 100755 index 00000000..c2f58528 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/xi @@ -0,0 +1,12 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +export XKB_DEFAULT_LAYOUT="mykeys" +exec river + + + + +# if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi diff --git a/home-manager/packages/scripts/wrappers/deprecated/xs b/home-manager/packages/scripts/wrappers/deprecated/xs new file mode 100755 index 00000000..50908071 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/deprecated/xs @@ -0,0 +1,233 @@ +#!/bin/sh + +# +# This is just a sample implementation of a slightly less primitive +# interface than xinit. It looks for user .xinitrc and .xserverrc +# files, then system xinitrc and xserverrc files, else lets xinit choose +# its default. The system xinitrc should probably do things like check +# for .Xresources files and merge them in, start up a window manager, +# and pop a clock and several xterms. +# +# Site administrators are STRONGLY urged to write nicer versions. +# + +unset SESSION_MANAGER +userclientrc=$XDG_CONFIG_HOME/X11/xinitrc +sysclientrc=/etc/X11/xinit/xinitrc + +userserverrc=$HOME/.xserverrc +sysserverrc=/etc/X11/xinit/xserverrc +defaultclient=xterm +defaultserver=/usr/bin/X +defaultclientargs="" +defaultserverargs="" +defaultdisplay="" +clientargs="" +serverargs="" +vtarg="" +enable_xauth=1 + + +# Automatically determine an unused $DISPLAY +d=0 +while true ; do + [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break + d=$(($d + 1)) +done +defaultdisplay=":$d" +unset d + +whoseargs="client" +while [ x"$1" != x ]; do + case "$1" in + # '' required to prevent cpp from treating "/*" as a C comment. + /''*|\./''*) + if [ "$whoseargs" = "client" ]; then + if [ x"$client" = x ] && [ x"$clientargs" = x ]; then + client="$1" + else + clientargs="$clientargs $1" + fi + else + if [ x"$server" = x ] && [ x"$serverargs" = x ]; then + server="$1" + else + serverargs="$serverargs $1" + fi + fi + ;; + --) + whoseargs="server" + ;; + *) + if [ "$whoseargs" = "client" ]; then + clientargs="$clientargs $1" + else + # display must be the FIRST server argument + if [ x"$serverargs" = x ] && \ + expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then + display="$1" + else + serverargs="$serverargs $1" + fi + fi + ;; + esac + shift +done + +# process client arguments +if [ x"$client" = x ]; then + client=$defaultclient + + # For compatibility reasons, only use startxrc if there were no client command line arguments + if [ x"$clientargs" = x ]; then + if [ -f "$userclientrc" ]; then + client=$userclientrc + elif [ -f "$sysclientrc" ]; then + client=$sysclientrc + fi + fi +fi + +# if no client arguments, use defaults +if [ x"$clientargs" = x ]; then + clientargs=$defaultclientargs +fi + +# process server arguments +if [ x"$server" = x ]; then + server=$defaultserver + + + # When starting the defaultserver start X on the current tty to avoid + # the startx session being seen as inactive: + # "https://bugzilla.redhat.com/show_bug.cgi?id=806491" + tty=$(tty) + if expr "$tty" : '/dev/tty[0-9][0-9]*$' > /dev/null; then + tty_num=$(echo "$tty" | grep -oE '[0-9]+$') + vtarg="vt$tty_num -keeptty" + fi + + + # For compatibility reasons, only use xserverrc if there were no server command line arguments + if [ x"$serverargs" = x -a x"$display" = x ]; then + if [ -f "$userserverrc" ]; then + server=$userserverrc + elif [ -f "$sysserverrc" ]; then + server=$sysserverrc + fi + fi +fi + +# if no server arguments, use defaults +if [ x"$serverargs" = x ]; then + serverargs=$defaultserverargs +fi + +# if no vt is specified add vtarg (which may be empty) +have_vtarg="no" +for i in $serverargs; do + if expr "$i" : 'vt[0-9][0-9]*$' > /dev/null; then + have_vtarg="yes" + fi +done +if [ "$have_vtarg" = "no" ]; then + serverargs="$serverargs $vtarg" +fi + +# if no display, use default +if [ x"$display" = x ]; then + display=$defaultdisplay +fi + +if [ x"$enable_xauth" = x1 ] ; then + if [ x"$XAUTHORITY" = x ]; then + XAUTHORITY=$HOME/.Xauthority + export XAUTHORITY + fi + + removelist= + + # set up default Xauth info for this machine + hostname=`uname -n` + + authdisplay=${display:-:0} + + mcookie=`/usr/bin/mcookie` + + + + + + + + if test x"$mcookie" = x; then + echo "Couldn't create cookie" + exit 1 + fi + dummy=0 + + # create a file with auth information for the server. ':0' is a dummy. + xserverauthfile=`mktemp -p /tmp serverauth.XXXXXXXXXX` + trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM + xauth -q -f "$xserverauthfile" << EOF +add :$dummy . $mcookie +EOF + + + + + serverargs=${serverargs}" -auth "${xserverauthfile} + + + # now add the same credentials to the client authority file + # if '$displayname' already exists do not overwrite it as another + # server may need it. Add them to the '$xserverauthfile' instead. + for displayname in $authdisplay $hostname/unix$authdisplay; do + authcookie=`xauth list "$displayname" \ + | sed -n "s/.*$hostname\/unix$authdisplay[[:space:]*].*[[:space:]*]//p"` 2>/dev/null; + if [ "z${authcookie}" = "z" ] ; then + xauth -q << EOF +add $displayname . $mcookie +EOF + removelist="$displayname $removelist" + else + dummy=$(($dummy+1)); + xauth -q -f "$xserverauthfile" << EOF +add :$dummy . $authcookie +EOF + fi + done +fi + + + + +xinit "$client" $clientargs -- "$server" $display $serverargs + +retval=$? + +if [ x"$enable_xauth" = x1 ] ; then + if [ x"$removelist" != x ]; then + xauth remove $removelist + fi + if [ x"$xserverauthfile" != x ]; then + rm -f "$xserverauthfile" + fi +fi + + + + + +if command -v deallocvt > /dev/null 2>&1; then + deallocvt +fi + + + + + + +exit $retval diff --git a/home-manager/packages/scripts/wrappers/ll b/home-manager/packages/scripts/wrappers/ll new file mode 100755 index 00000000..d177b341 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/ll @@ -0,0 +1,13 @@ +#! /bin/bash +export LLP=0 +tmp="$(mktemp)" +lf -last-dir-path="$tmp" "$@" +if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + if [ -d "$dir" ]; then + if [ "$dir" != "$(pwd)" ]; then + cd "$dir" + fi + fi +fi diff --git a/home-manager/packages/scripts/wrappers/llp b/home-manager/packages/scripts/wrappers/llp new file mode 100755 index 00000000..2a21450c --- /dev/null +++ b/home-manager/packages/scripts/wrappers/llp @@ -0,0 +1,19 @@ +#! /bin/bash + +export LLP=1 +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup EXIT + lf "$@" 3>&- +fi diff --git a/home-manager/packages/scripts/wrappers/spodi b/home-manager/packages/scripts/wrappers/spodi new file mode 100755 index 00000000..9c440340 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/spodi @@ -0,0 +1,39 @@ +#!/bin/sh + +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +DOWN_DIR=/home/dt/media/playlist/down/ + + +tmp=$(mktemp) +config=$(mktemp) + +for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done +cat << EO > "$config" +--log-level INFO +--cache-path /home/dt/.config/spotdl/.spotipy +--audio youtube-music youtube +--lyrics genius musixmatch azlyrics +--ffmpeg ffmpeg +--format mp3 +--output {artists}-{title}.{output-ext} +--overwrite skip +--client-id 5f573c9620494bae87890c0f08a60293 +--client-secret 212476d9b0f3472eaa762d90b19b0ba8 +--threads 16 +--print-errors +--preload +EO + +[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" + +rm ${DOWN_DIR}spotdl.log +cd $DOWN_DIR || die "BUG: no $DOWN_DIR" + +unbuffer spotdl $(cat "$config") download "$1" | tee $DOWN_DIR/spotdl.log + +[ -d ~/.spotdl ] && rm -r ~/.spotdl +rm "$tmp" +rm "$config" diff --git a/home-manager/packages/scripts/wrappers/virsh-del b/home-manager/packages/scripts/wrappers/virsh-del new file mode 100755 index 00000000..f2bd8e3d --- /dev/null +++ b/home-manager/packages/scripts/wrappers/virsh-del @@ -0,0 +1,14 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + +LIB_TEMP_DIR_FOR_SCRIPT=$(mktemp -d); + +virsh destroy "$1" +virsh undefine "$1" --nvram +virsh vol-delete --pool default "$1".qcow2 + + + +if [ -d "$LIB_TEMP_DIR_FOR_SCRIPT" ];then rm -r "$LIB_TEMP_DIR_FOR_SCRIPT"; fi diff --git a/home-manager/packages/scripts/wrappers/yti b/home-manager/packages/scripts/wrappers/yti new file mode 100755 index 00000000..97350b37 --- /dev/null +++ b/home-manager/packages/scripts/wrappers/yti @@ -0,0 +1,36 @@ +#!/bin/sh +# shellcheck disable=SC2086 +# shellcheck source=/dev/null +. ~/.local/lib/shell/lib + + +DOWN_DIR=/home/dt/media/playlist/down/ + + +tmp=$(mktmp) +config=$(mktmp) + +for e in "$DOWN_DIR"/*.mp3;do echo "$e" >> "$tmp";done +[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" + +cat << EO > "$config" +--paths home:"$DOWN_DIR" +#--output %(fulltitle) +--restrict-filenames +--no-overwrites +--no-write-info-json +--clean-info-json +--prefer-free-formats +#--format mp3 +--extract-audio +--audio-quality 0 +--audio-format best +EO + + +rm ${DOWN_DIR}yt-dlp.log +cd $DOWN_DIR || die "BUG: no $DOWN_DIR" + +unbuffer yt-dlp --config-location "$config" "$1" | tee $DOWN_DIR/yt-dlp.log + +if [ -d /tmp/LIB_FILE_TEMP_DIR/ ];then rm -r /tmp/LIB_FILE_TEMP_DIR/; fi -- cgit 1.4.1