toyotacorolla

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 7f98aa8dbedb78543a14a119ca806de5a755e28f
Author: David Voznyarskiy <31452046-davidvoz@users.noreply.gitlab.com>
Date:   Sat,  8 Nov 2025 11:10:58 -0800

added my custom .local/bin files

Diffstat:
Achangemacaddress | 7+++++++
Affr | 22++++++++++++++++++++++
Agivefilesextensions | 25+++++++++++++++++++++++++
Ainertiadrift | 29+++++++++++++++++++++++++++++
Akeyboardlayouts | 17+++++++++++++++++
Amounter | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anote | 27+++++++++++++++++++++++++++
Arand | 116+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aunmounter | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aweather | 9+++++++++
Awipe | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Axel | 5+++++
12 files changed, 462 insertions(+), 0 deletions(-)

diff --git a/changemacaddress b/changemacaddress @@ -0,0 +1,7 @@ +#!/bin/sh +# changes a mac address +# simply call the script + +sudo ip link set dev wlp1s0 down +sudo macchanger -r wlp1s0 +sudo ip link set dev wlp1s0 up diff --git a/ffr b/ffr @@ -0,0 +1,22 @@ +#!/bin/sh +CONFIG_FILE="$HOME/.config/ffr" + +if [ $# -eq 0 ]; then + sed '/^#>/Q' "$CONFIG_FILE" +else + section="$1" + awk -v section="$section" ' + /^#>/ && + section_notes { section_notes = 0 } /^#>/ && + (" " $0 " " ~ " #>" section " ") { section_notes = 1; next } + section_notes { print } + ' "$CONFIG_FILE" +fi + +# example below of an ~/.config/ffr file, pound signs followed by a space need to be removed + +# tar -czvf archive.tar.gz thing/ file +# : this command will print out when 'ffr' is ran without arguments +# #>ffmpeg #>ffm #>peg +# this line is printed when 'ffr ffmpeg', 'ffr ffm', or 'ffr peg' is ran +# : additional notes diff --git a/givefilesextensions b/givefilesextensions @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 /path/to/directory" + exit 1 +fi + +target_dir="$1" + +if [ ! -d "$target_dir" ]; then + echo "Error: '$target_dir' is not a valid directory." + exit 1 +fi + +for file in "$target_dir"/*; do + [ -d "$file" ] && continue + mime_type=$(file --mime-type -b "$file") + extension=$(echo "$mime_type" | awk -F'/' '{print $2}') + + if [[ ! "$file" == *".$extension" && -n "$extension" ]]; then + new_file="$file.$extension" + echo "$file -> $new_file" + mv "$file" "$new_file" + fi +done diff --git a/inertiadrift b/inertiadrift @@ -0,0 +1,29 @@ +#!/bin/sh + +echo " ,,:::;;;+++++;;;;;;;;;;;;;;;;;;;;;;;;;;;;::," +echo " ,:;+*????++????***+;:::;;+++****?????%%%%%%SSSS#S?;," +echo " ,:;+*?%SSS##%+%#S#####SS?:S@#####SSSSSSSSSSSSSSSSSSSS##S%+," +echo " ,;+*?%SSSSSSS#*+S#SSSSSSSSS#*:S#SSSSSSSSSSSSSSSSSSSSSSSSSSS###?;," +echo " ,:;+?%SSSSSSSSSSS++S#SSSSSSSSSSS#+:##SSSSSSSSSSSSSSSSSSSSSSSSSSSSS##S?:..," +echo " ,*++*S#####SSSSSSS+;%#SSSSSSSSSSSSS#;;##SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS##SSS+" +echo " ,?+,.,:;++*?%%SSSS+;?#SSSSSSSSS##SSS##;;##SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS####:,,," +echo " *;,,..........,,::;,+??%SSS#####SSSS%SS:+#####SSSSSSSSSSSSS#SS#######SSSSSSSSSS%%%?*+::," +echo " ,?,,,,,...........++++,..,,::;+*???%%SSS%,*?**?SS###SSSSSSSSSSSSSSSS%%%%%%%%%%%%SSSSSSSS%?*+;:,," +echo " :%++;::+**+;,,,,,;;+*?:;:::,.......,,,:::;:.,,,::;+*?%%SSSS%%%SSSSSSS%%%%%%%%%%%%%%%%%SSSSSSSS%%?*+:,," +echo ",*%?%%?%S##SS?;:::*:,,,;**?++:+;;,:;,.....+,......,,,::;+*?%%SSSS%%%SSSSSSS%%%%%%%%%%%%%%%%%SSSSSSSSS%%?++*???????;" +echo ",S?****#@#SS#SS?*?%**+++;;+;+:;;*;**::::,:+,.,,.........,,,:;+*?%%SSS%%%SSSSSSSSSSSSSSSS%%%%%%%%SSSSS%%S##SSSS%%%@+" +echo " +SSS%%@#%%SS##%++?+***???****+++;++;;;+::+,,,,,,...,,........,,:;+*?%SSSS%S##SSSSSSSS#S%%%%%%%%%%%%%%%SSSS%S+;:;S:" +echo " :*SSS@S?%%#S#SS%S??***++++***?????**++++*::::,:+*?%%??*;,........,,:;+?%##S%SS*;;;;%#S%%%%%%%%%%%%%%%%%SS#%;::;#;" +echo " :%#@%?%%#SS#S%#SSSSSS%%%??**+++++***?%%??*+*%S####SSSS%+,,,,,,,,,.,,,.:+?SS%++:;:*#S%%SSSSSSSSSSSSS####@S?%%%@S;," +echo " ,***%@%?%SSSSS#SS#SSSSSSSSSSSSS%%%??**+**++*SS###SSSSSSS#S?+;;::,,,:%***+;+%#%:;;++%################SSSSSSSSSSSSSSS:" +echo " ,:;+*#S*?%SSS%##SSSSSSSSSSSSSSSSSSSSSSSSS%%%S##SSS%%SSSSS#S%%%%%%%?%#%%????S#SSSSSSSS#SSSSSSSSSSSSSSSSSSSSS##%%%%*%:" +echo " ,+#S?SSSS%%S#S%SSSSSSSSSSSSSSSSSSSSS#SSS#@#S???%S%SSSSS;,:;;++**??%%SSSSSSSSSSSSSSSSSSSSSS#S%%%%?S######SS%SSSS," +echo " ;%SSSSSSSSS?***???%%SSSSSSSSSSSSSS#SSS##S?*%%?S?SSSSSS%???**+;;;;:;;;;;;++%?%%?%####S##S#SSSSSSSSSSSSSSSS%?*;" +echo " :;;;;::;;+**********???%%SSSSSSSSSSS@#S??%S%%%%SSSSS#SSSSSSSS%%%%????**?S%SSSSSSSSSSSSS%%%%%?%SSSSSS%%%," +echo " ,,::;++**********???%%%SSS##S??%SSSS%%#SS%S#%%%SSSSSSSSSSSSSSSSSSSSSSSSSSS%;;+;;;:,?S%SS#****" +echo " ,,:;;++***********??##?*%%%%%%%SSS%%S#%%%%%%%%SSSSSSSSSSSS%???SS%%S*,::;;+;+SSSSSS%%+," +echo " ,,:;;+*******?#S?*?S%?SSSSS%%%##SSSSSSSSSSSSSSSSS#%+++*SSSS#*+*???%%%%%????*+;" +echo " ,,:;;++?##%???%SSSS%%%S#%%%%SSSSSSSSSSSSSSSSSSSSS%%%%??????*********++:" +echo " ,,:%#SSSSSSSSSSSS?**********???????????**************++;;::,,," +echo " ;*%%%%%%??++;++++********************+++;;;::,,,," +echo " ,,,,, ,,,,,::::::::,,,,,," diff --git a/keyboardlayouts b/keyboardlayouts @@ -0,0 +1,17 @@ +#!/bin/sh + +# Get the current keyboard layout +layout=$(setxkbmap -query | grep layout | awk '{print $2}') + +if [ $layout == "ru" ]; then + setxkbmap -layout us -variant colemak + herbe "current layout: colemak" + exit 0 +elif [ $layout == "us" ]; then + setxkbmap -layout ru + herbe "current layout: russian" + exit 0 +else + setxkbmap -layout us -variant colemak + exit 1 +fi diff --git a/mounter b/mounter @@ -0,0 +1,55 @@ +#!/bin/sh + +set -e + +sudo -v || exit 1 + +i=1 +devices="" +echo "Devices Found" +while read -r dev; do + if sudo cryptsetup isLuks "/dev/$dev" 2>/dev/null; then + echo "[$i] /dev/$dev" + devices="$devices /dev/$dev" + i=$((i + 1)) + fi +done <<EOF +$(lsblk -do NAME) +EOF + +[ "$i" -eq 1 ] && exit 1 + +set -- $devices + +if [ "$i" -eq 2 ]; then + chosen_index=1 +else + printf "select a device to unlock [1-%d]: " $((i - 1)) + read chosen_index +fi + +n=1 +for dev in "$@"; do + if [ "$n" -eq "$chosen_index" ]; then + chosen="$dev" + break + fi + n=$((n + 1)) +done + +[ -z "$chosen" ] && exit 1 + +default_name="usb$chosen_index" +printf "name to assign to unlocked device [%s]: " "$default_name" +read name +[ -z "$name" ] && name="$default_name" + +echo "cryptsetup opening $chosen as $name" +sudo cryptsetup open "$chosen" "$name" || exit 1 + +mount_point="/mnt/$name" +sudo mkdir -p "$mount_point" +echo "mounting $name" +sudo mount "/dev/mapper/$name" "$mount_point" || exit 1 + +echo "$chosen mounted successfully at $mount_point" diff --git a/note b/note @@ -0,0 +1,27 @@ +#!/bin/sh +# This is a modified version of swindlesmccoop's note program + +NOTES_FILE=$HOME/misc/notes + +# print option +if [ "$*" = "-p" ]; then + cat "$NOTES_FILE" + exit 0 +fi + +# enter note without editor +if [ "$#" -ge 1 ]; then + echo "[$(date)]" >> "$NOTES_FILE" + echo "$*" >> "$NOTES_FILE" + echo "" >> "$NOTES_FILE" + exit 0 +fi + +nvim +startinsert /tmp/note_temp + +if [ -s /tmp/note_temp ]; then + echo "[$(date)]" >> "$NOTES_FILE" + cat /tmp/note_temp >> "$NOTES_FILE" + echo "" >> "$NOTES_FILE" + rm /tmp/note_temp +fi diff --git a/rand b/rand @@ -0,0 +1,116 @@ +#!/bin/sh + +generate_string_azAZ09Symb() { + local length=$1 + < /dev/urandom tr -dc 'A-Za-z0-9`~!@# $%^&*()-_=+[]{}|;:,.<>?/ ' | head -c "$length" +} + +generate_string_azAZ09() { + local length=$1 + < /dev/urandom tr -dc 'A-Za-z0-9' | head -c "$length" +} + +print_help() { + echo "Usage: rand [OPTION]... [LENGTH]... [FILE]..." + echo "-n, --name [INT LENGTH] [FILE] renames a file with a random name" + echo "-c, --clip [INT LENGTH] copies a random string of specified length to clipboard" + echo "-h, --help display this help message" +} + +clip() { + echo "$(generate_string_azAZ09Symb)" +} + +name(){ + local length=$1 + local file=$2 + + if [[ -z "$file" || ! -f "$file" ]]; then + echo "File not found or not provided." + exit 1 + fi + + random_name=$(generate_string_azAZ09 "$length") + mv "$file" "$random_name" + echo "Renamed '$file' to '$random_name'" +} + +naming_option=0 +clip_option=0 +num_chars=0 +target_file="" + +while [[ "$1" =~ ^- ]]; do + case "$1" in + -n|--name) + naming_option=1 + shift + if [[ -n "$1" && "$1" =~ ^[0-9]+$ ]]; then + num_chars=$1 + shift + if [[ -n "$1" ]]; then + target_file=$1 + shift + else + echo "No file specified for renaming." + exit 1 + fi + else + echo "Invalid or missing length for -n option." + print_help + exit 1 + fi + ;; + -c|--clip) + clip_option=1 + shift + if [[ -n "$1" && "$1" =~ ^[0-9]+$ ]]; then + num_chars=$1 + shift + else + echo "Invalid or missing argument for -c option." + print_help + exit 1 + fi + ;; + -h|--help) + print_help + exit 0 + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac +done + +if [ $naming_option -eq 1 ]; then + if [[ -n "$num_chars" && -n "$target_file" ]]; then + name "$num_chars" "$target_file" + exit 0 + else + echo "Missing length or file for renaming." + print_help + exit 1 + fi +elif [ $clip_option -eq 1 ]; then + if [[ -n "$num_chars" ]]; then + random_string=$(generate_string_azAZ09Symb "$num_chars") + echo "$random_string" | xclip -selection clipboard + echo "copied to clipboard" + exit 0 + else + print_help + exit 1 + fi +fi + +if [[ $# -gt 0 && "$1" =~ ^[0-9]+$ ]]; then + num_chars=$1 + random_string=$(generate_string_azAZ09Symb "$num_chars") + echo "$random_string" + exit 0 +fi + +print_help +exit 1 diff --git a/unmounter b/unmounter @@ -0,0 +1,57 @@ +#!/bin/sh + +set -e + +sudo -v || exit 1 + +mapped_devices="" +for path in /dev/mapper/usb*; do + [ -e "$path" ] || continue + mapped_devices="$mapped_devices $(basename "$path")" +done + +set -- $mapped_devices + +[ "$#" -eq 0 ] && exit 1 + +echo "Devices Found" +i=1 +for dev in "$@"; do + echo "[$i] /dev/mapper/$dev" + i=$((i + 1)) +done + +if [ $i -eq 2 ]; then + index=1 +else + printf "select a device to unmount [1-%d]: " $(( $# )) + read index + + case "$index" in + ''|*[!1-9]*) + exit 1 + ;; + esac + + if [ "$index" -lt 1 ] || [ "$index" -ge "$#" ]; then + exit 1 + fi +fi + +i=1 +for dev in "$@"; do + [ "$i" -eq "$index" ] && name="$dev" && break + i=$((i + 1)) +done + +mount_point="/mnt/$name" + +if mountpoint -q "$mount_point" 2>/dev/null; then + echo "umounting $mount_point" + sudo umount "$mount_point" +fi + +echo "cryptsetup closing $name" +sudo cryptsetup close "$name" + +echo "/dev/mapper/$name unmounted successfully" diff --git a/weather b/weather @@ -0,0 +1,9 @@ +#!/bin/sh + +curl -s 'https://forecast.weather.gov/meteograms/Plotter.php?' > /tmp/weather_chart # fill in the rest with your address + +nsxiv -z 156 -b /tmp/weather_chart & sleep 0.1 +xdotool search --onlyvisible --class nsxiv windowactivate --sync key f +wait +rm /tmp/weather_chart +exit 0 diff --git a/wipe b/wipe @@ -0,0 +1,93 @@ +#!/bin/sh + +display_entropy() { + echo "Entropy available: $(cat /proc/sys/kernel/random/entropy_avail)" + echo "Entropy pool size: $(cat /proc/sys/kernel/random/poolsize)" + echo "Wakeup threshold: $(cat /proc/sys/kernel/random/write_wakeup_threshold)" + echo "Minimum reseeding in seconds: $(cat /proc/sys/kernel/random/urandom_min_reseed_secs)" +} + +random_string() { + tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$1" | head -n 1 +} + +secure_wipe() { + local target="$1" + + if [ -z "$target" ]; then + echo "No target specified for secure wipe." + exit 1 + fi + + if [ ! -e "$target" ]; then + echo "The specified file or directory does not exist." + exit 1 + fi + + folder_size=$(du -s "$target" | awk '{print $1}') + count_size=$((folder_size + 100)) # just a bit extra for remnants + + sudo find "$target" -type f -exec shred -vn4 -u {} + + sudo find "$target" -type d -exec rm -rf {} + + sudo dd if=/dev/urandom of=file bs=1024 count=$count_size + new_file_name=$(random_string 4) + sudo mv file "$new_file_name" + sudo rm -f "$new_file_name" +} + +# Check if no arguments are provided +if [ $# -eq 0 ]; then + echo "wipe: missing file operand" + exit 1 +fi + +# Initialize variables for options +secure_wipe_option=0 + +# Parse options +while [[ "$1" =~ ^- ]]; do + case "$1" in + -s) + secure_wipe_option=1 + shift + ;; + # add more later if need be + *) + echo "Invalid option: $1" + exit 1 + ;; + esac +done + +target="$1" + +if [ ! -e "$target" ]; then + echo "The specified file or directory does not exist." + exit 1 +fi + +display_entropy + +if [ $secure_wipe_option -eq 1 ]; then + secure_wipe "$target" + exit 0 +fi + +full_path=$(readlink -f "$target") +read -p "Delete $full_path/*? (y/n): " answer + +answer=$(echo "$answer" | tr '[:upper:]' '[:lower:]') + +if [ "$answer" != "y" ]; then + echo "Wiping deletion aborted." + exit 1 +fi + +if [ -d "$target" ]; then + find "$target" -type f -exec shred -vn3 -u {} + && find "$target" -type d -exec rm -rf {} + +fi + +rm -rf "$target" + +echo "Deletion completed." + diff --git a/xel b/xel @@ -0,0 +1,5 @@ +#!/bin/sh +filename="${1%.tex}" + +xelatex "${filename}.tex" +rm -f "${filename}".log "${filename}".aux "${filename}".out "${filename}".toc