alias lock='gnome-screensaver-command --lock' alias view-mounted="mount | awk -F' ' '{ printf \"%s\t%s\n\",\$1,\$3; }' | column -t | egrep ^/dev/ | sort" mounted() { if [ -z $1 ]; then mount | column -t else sudo mount | column -t | grep "$@" fi } # sudo apt install bat alias bat='batcat' alias bc='clear;batcat' alias bs='clear;batcat -l bash' alias html='clear;batcat -l html' alias o='less' alias print='lpr' # line "*" 50 # will ouput a line with: ************************************************** line() { printf -v _L %$2s; printf -- "${_L// /$1}"; } alias stars='line "*" 50' long-password() { if [ -z "$1" ]; then local random_string=$(openssl rand -base64 24) else local random_string=$(openssl rand -base64 "$1") fi local possible_symbols='@#,%.&*()^?' local num_symbols=$((RANDOM % ${#possible_symbols} + 1)) extra_symbols=$(echo "$possible_symbols" | fold -w1 | shuf | head -n "$num_symbols" | tr -d '\n') local combined_string="${random_string}${extra_symbols}" local shuffled_string=$(echo "$combined_string" | fold -w1 | shuf | tr -d '\n') echo "$shuffled_string" } good-pass() { local password=$(long-password) # Get the length of the password local password_length=${#password} # Calculate half the length of the password local half_length=$((password_length / 2)) # Generate a random starting position between 0 and half_length local start_position=$((RANDOM % (password_length - half_length + 1))) # Calculate a random length for the substring between half_length and password_length local substring_length=$((RANDOM % (password_length - half_length + 1) + half_length)) # Extract the substring local substring=${password:start_position:substring_length} echo "$substring" } gpg-make-pwd() { local edt=$(date +%Y%m%d-%H%M%S) long-password > ~/Desktop/.gpg_pwd_${edt}.txt echo "Made long password at: ~/Desktop/.gpg_pwd_${edt}.txt" if [ "$1" == "show" ]; then echo -e "\033[0;31m" cat ~/Desktop/.gpg_pwd_${edt}.txt echo -e "\033[0m" else echo -e "\033[0;31m cat ~/Desktop/.gpg_pwd_${edt}.txt \033[0m \n" fi echo "This is a hidden file, so to list it: ls -la ~/Desktop/.gpg*" echo "Becareful not to leave it where it is!!!" } function looooooooong { START=$(date +%s.%N) $* EXIT_CODE=$? END=$(date +%s.%N) DIFF=$(echo "$END - $START" | bc) RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") result="$1 completed in $RES, exit code $EXIT_CODE." echo -e "\n⏰ $result" } # apt install wofi newnote() { local folder="$HOME/notes/" mkdir -p "$folder" local name if [ -z "$1" ]; then name="$(wofi --show dmenu -p "Enter a name: ")" || return 1 # Fallback to Timestamp if user just hit enter : "${name:=$(date +%F_%T | tr ':' '-')}" $editor $folder$name".md" 2>&1 else $editor "$folder$1.md" fi } notes() { \ local folder="$HOME/notes/" if [ -z "$1" ]; then choice=$(echo -e "New\n$(command ls -t1 $folder)" | wofi --show dmenu -L 25 -i -p "Choose note or create new: ") case $choice in New) newnote ;; *.md) $editor "$folder$choice" 2>&1 ;; *) return 1 ;; esac else $editor "$folder$1.md" fi } alias cht='/opt/profiles/scripts/cht.sh' alias create-archive='/opt/profiles/scripts/create_archive.sh' alias bible-quote='/opt/profiles/scripts/bible_quotes.sh'