This commit is contained in:
2026-01-04 17:10:27 -07:00
parent 07ca207fd1
commit 14d8a61f49

165
bashrc.sh
View File

@@ -44,6 +44,34 @@ alias dcim="cd $DCIM"
export CODE="$SS/Code" export CODE="$SS/Code"
alias code="cd $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 { function code-projects {
cat <<- EOF cat <<- EOF
env-termux dev env-termux dev
@@ -77,6 +105,31 @@ function check-code {
} }
alias code-check="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. # Pulled from /me/env-ansible, need to make a shared library between it and Termux.
# Change a branch to point at another. # Change a branch to point at another.
function load-branch { function load-branch {
@@ -140,30 +193,8 @@ alias reset-prod="load-branch prod main"
alias reset-stage="load-branch stage main" alias reset-stage="load-branch stage main"
alias reset-dev="load-branch dev 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' ## Termux Related ##
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 ##
function update { function update {
params="$1" params="$1"
@@ -186,6 +217,9 @@ function update {
alias upgrade="update" alias upgrade="update"
alias goodbye="update -y && bye" alias goodbye="update -y && bye"
## Videk Related ##
# Optimize the bitrate and audio levels for an edited video. # Optimize the bitrate and audio levels for an edited video.
function process-video-usage { function process-video-usage {
echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating] [numPasses] [forceBitrate]" echo "USAGE: process-video oldFile newFile [videoBitrate] [audioBitrate] [sizeRating] [numPasses] [forceBitrate]"
@@ -305,44 +339,6 @@ function process-video {
} }
alias pv="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 # Allow converting video to audio ad other smaller
# tasks than what process-video is intended to do. # tasks than what process-video is intended to do.
function basic-process-usage { function basic-process-usage {
@@ -447,22 +443,38 @@ alias pa="v2a"
#cd ~/storage/shared/ #cd ~/storage/shared/
# Shortcuts for starting a video project. # Shortcuts for starting a video project.
function init-video { #function init-video {
dir="$1" # dir="$1"
if [[ ! -z $"dir" && ! -e "$dir" ]]; then # if [[ ! -z $"dir" && ! -e "$dir" ]]; then
mkdir -p "$dir" # mkdir -p "$dir"
cd $dir # cd $dir
fi # fi
touch readme.md # touch readme.md
mv -v "$SS/Movies/youcut/*" ./ # mv -v "$SS/Movies/youcut/*" ./
mv -v "$SS/Pictures/Screenshots/*" ./ # mv -v "$SS/Pictures/Screenshots/*" ./
} #}
alias pull-video="init-video" #alias pull-video="init-video"
alias pull-screenshot="init-video" #alias pull-screenshot="init-video"
alias pull-sc="pull-screenshot" #alias pull-sc="pull-screenshot"
alias video-readme="init-video" #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 { function now {
date "+%Y%m%d-%H%M%S" date "+%Y%m%d-%H%M%S"
} }
@@ -526,3 +538,4 @@ alias prod-pull="pull_prod_backups"
# Complete! # Complete!
PROG="$(basename -- "${BASH_SOURCE[0]}")" PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "'$PROG' completed!" echo "'$PROG' completed!"
leted!"