From 14d8a61f49b859b90ff555171a4a8e462501e075 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 4 Jan 2026 17:10:27 -0700 Subject: [PATCH] -m --- bashrc.sh | 165 +++++++++++++++++++++++++++++------------------------- 1 file changed, 89 insertions(+), 76 deletions(-) diff --git a/bashrc.sh b/bashrc.sh index cf81345..cca4f6c 100644 --- a/bashrc.sh +++ b/bashrc.sh @@ -44,6 +44,34 @@ alias dcim="cd $DCIM" export CODE="$SS/Code" alias code="cd $CODE" +# Shortcuts for TRASH. +export TRASH="$SS/TRASH" +alias trash="cd $TRASH" +alias clean-trash="bash -c 'rm -rfv $TRASH/*'; clean-trashed" +alias trash-clean="clean-trash" +alias check-trash="du -h $TRASH" +alias trash-check="check-trash" + +alias clean-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -delete | sort -h' +alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h' + +# Help prevent mistakes. +alias cp="cp -v" +alias mv="mv -v" +alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'" + +# Quickies +alias bye="exit" +alias install="pkg install" +alias uninstall="pkg uninstall" +alias remove="uninstall" +alias scan="nmap -A -p- --script=vuln" + + +### Functions ### + +## Code Related ## + function code-projects { cat <<- EOF env-termux dev @@ -77,6 +105,31 @@ function check-code { } alias code-check="check-code" +# Quickly commit code to a repo. +function commit { + message="$1" + if [[ -z $message ]]; then + echo "ERROR: A message is required." >&2 + echo 'USAGE: commit "My commit message."' >&2 + return 1 + fi + git add . && git commit -m "$message" && git push +} + +# Easily test this project after committing changes. +# Otherwise can just source this file unless testing setup.sh. +function test-termux { + sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null + git clone https://git.hyperling.com/me/env-termux \ + --branch=dev ~/termux-deleteme + chmod 755 ~/termux-deleteme/*.sh + ~/termux-deleteme/setup.sh +} +alias reload-termux="test-termux" +alias termux-test="test-termux" +alias termux-reload="reload-termux" + + # Pulled from /me/env-ansible, need to make a shared library between it and Termux. # Change a branch to point at another. function load-branch { @@ -140,30 +193,8 @@ alias reset-prod="load-branch prod main" alias reset-stage="load-branch stage main" alias reset-dev="load-branch dev main" -# Shortcuts for TRASH. -export TRASH="$SS/TRASH" -alias trash="cd $TRASH" -alias clean-trash="bash -c 'rm -rfv $TRASH/*'; clean-trashed" -alias trash-clean="clean-trash" -alias check-trash="du -h $TRASH" -alias trash-check="check-trash" -alias clean-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -delete | sort -h' -alias check-trashed='find "$SS" -name ".trashed*" -exec du -h {} \; -exec mv -v {} ~/TRASH/ \; | sort -h' - -# Help prevent mistakes. -alias cp="cp -v" -alias mv="mv -v" -alias rm="echo 'Move to ~/storage/shared/TRASH/ instead!'" - -# Quickies -alias bye="exit" -alias install="pkg install" -alias uninstall="pkg uninstall" -alias remove="uninstall" -alias scan="nmap -A -p- --script=vuln" - -## Functions ## +## Termux Related ## function update { params="$1" @@ -186,6 +217,9 @@ function update { alias upgrade="update" alias goodbye="update -y && bye" + +## Videk Related ## + # Optimize the bitrate and audio levels for an edited video. function process-video-usage { echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating] [numPasses] [forceBitrate]" @@ -305,44 +339,6 @@ function process-video { } alias pv="process-video" -function mkvid { - if [[ -n "$1" ]]; then - mkdir "$1" - cd "$1" - fi - touch title.md - touch desc.md - touch tags.md - mkdir raw -} -alias init-video="mkvid" -alias init-vid="init-video" -alias mk-vid="mkvid" - -# Quickly commit code to a repo. -function commit { - message="$1" - if [[ -z $message ]]; then - echo "ERROR: A message is required." >&2 - echo 'USAGE: commit "My commit message."' >&2 - return 1 - fi - git add . && git commit -m "$message" && git push -} - -# Easily test this project after committing changes. -# Otherwise can just source this file unless testing setup.sh. -function test-termux { - sh -c "rm -rf ~/termux-deleteme ~/TRASH/termux-deleteme" 2>/dev/null - git clone https://git.hyperling.com/me/env-termux \ - --branch=dev ~/termux-deleteme - chmod 755 ~/termux-deleteme/*.sh - ~/termux-deleteme/setup.sh -} -alias reload-termux="test-termux" -alias termux-test="test-termux" -alias termux-reload="reload-termux" - # Allow converting video to audio ad other smaller # tasks than what process-video is intended to do. function basic-process-usage { @@ -447,22 +443,38 @@ alias pa="v2a" #cd ~/storage/shared/ # Shortcuts for starting a video project. -function init-video { - dir="$1" - if [[ ! -z $"dir" && ! -e "$dir" ]]; then - mkdir -p "$dir" - cd $dir - fi - touch readme.md - mv -v "$SS/Movies/youcut/*" ./ - mv -v "$SS/Pictures/Screenshots/*" ./ -} -alias pull-video="init-video" -alias pull-screenshot="init-video" -alias pull-sc="pull-screenshot" -alias video-readme="init-video" +#function init-video { +# dir="$1" +# if [[ ! -z $"dir" && ! -e "$dir" ]]; then +# mkdir -p "$dir" +# cd $dir +# fi +# touch readme.md +# mv -v "$SS/Movies/youcut/*" ./ +# mv -v "$SS/Pictures/Screenshots/*" ./ +#} +#alias pull-video="init-video" +#alias pull-screenshot="init-video" +#alias pull-sc="pull-screenshot" +#alias video-readme="init-video" + +function mkvid { + if [[ -n "$1" ]]; then + mkdir "$1" + cd "$1" + fi + touch title.md + touch desc.md + touch tags.md + mkdir raw +} +alias init-video="mkvid" +alias init-vid="init-video" +alias mk-vid="mkvid" + + +## Backup Related ## -# Backup Related Activities # function now { date "+%Y%m%d-%H%M%S" } @@ -526,3 +538,4 @@ alias prod-pull="pull_prod_backups" # Complete! PROG="$(basename -- "${BASH_SOURCE[0]}")" echo "'$PROG' completed!" +leted!"