New backup 2026-02-18 08:07:45

This commit is contained in:
Penelope Gwen 2026-02-18 08:07:45 -08:00
parent a0ddd01aa6
commit 6d11f1d651

View file

@ -6,9 +6,9 @@ hyfetch 2>/dev/null || true
#enable using sudo with functions
function Sudo {
local firstArg=$1
if [ $(type -t $firstArg) = function ];then
if [ $(type -t $firstArg) = function ]; then
shift && command sudo bash -c "$(declare -f $firstArg);$firstArg $*"
elif [ $(type -t $firstArg) = alias ];then
elif [ $(type -t $firstArg) = alias ]; then
alias sudo='\sudo '
eval "sudo $@"
else
@ -31,54 +31,87 @@ alias o="open "
alias nano="nvim "
sort_filesizes() {
[ -z ${1} ] && local dir="$(pwd)" || local dir="${1}"
du -ah --max-depth=1 "$( realpath ${dir} )" | sort --human-numeric-sort
du -ah --max-depth=1 "$(realpath ${dir})" | sort --human-numeric-sort
}
sort_filesizes-monitor() {
[ -z ${1} ] && local dir="$(pwd)" || local dir="${1}"
watch "du -ah --max-depth=1 $( realpath ${dir} ) | sort --human-numeric-sort"
watch "du -ah --max-depth=1 $(realpath ${dir}) | sort --human-numeric-sort"
}
#connect to android via adb as root
alias adb_root="adb shell -t exec run-as com.termux files/usr/bin/bash -c 'su -'"
#df -h without tmpfs
alias dfh="df -h | grep 'Use%\|/dev/'"
#dev environment toolbox with proper term env var
devpod(){
devpod() {
podman container start debian-sid-dev
podman exec --env POD_PATH=$(pwd | sed "s|${HOME}|/root|") -it debian-sid-dev /bin/bash
}
devpod-arm(){
devpod-arm() {
podman container start debian-sid-arm-dev
podman exec --env POD_PATH=$(pwd | sed "s|${HOME}|/root|") -it debian-sid-arm-dev /bin/bash
}
simplewebserver(){
if [ "${1}" = "-n" ];then
#db-create(){
# if [ -z ${1} ] {
# distro_array=()
# while read distro;do
# distro_array+=("${distro}" "${distro}")
# done
# if [[ ${#distro_array[@]} -eq 0 ]];then
# "no matching distros found"
# fi
# dialog --no-tags --menu 'select an image' 0 0 0
# }
# if distrobox create --image
#}
#db-enter(){
# if [ -z ${1} ] {
# printf "no container name provided\nUSAGE:\n db-enter [container_name]\nAvailable containers:\n"
# distrobox ls | awk '{print $3}' | tail -n +2 | sed 's/^/- /'
# return 1
# }
# distrobox enter --additional-flags "--env DB_PATH=${PWD}" ${1}
#}
simplewebserver() {
if [ "${1}" = "-n" ]; then
screen bash -c "printf 'running [ /usr/bin/python3 -m http.server ] in screen...\nTo run with server-side includes, remove -n\n';/usr/bin/python3 -m http.server"
else
screen bash -c "printf 'running [ %s ] in screen...\nTo run barebones webserver, add -n\n' """$(which ssi-server)""";ssi-server"
fi
}
filecount(){
filecount() {
[[ -z ${1} ]] && fc_targetdir=$(pwd) || fc_targetdir="${1}"
find "${fc_targetdir}" -type f | wc -l
}
filecount-monitor(){
filecount-monitor() {
[[ -z ${1} ]] && fc_targetdir=$(pwd) || fc_targetdir="${1}"
watch "find ${fc_targetdir} -type f | wc -l"
}
pwatch(){
pwatch() {
local firstArg=$1
if [ $(type -t $firstArg) = function ];then
shift && while true;do clear -x;command bash -c "$(declare -f $firstArg);$firstArg $*";sleep 2;done
elif [ $(type -t $firstArg) = alias ];then
# alias sudo='\sudo '
while true;do clear -x;eval "$@";sleep 2;done
if [ $(type -t $firstArg) = function ]; then
shift && while true; do
clear -x
command bash -c "$(declare -f $firstArg);$firstArg $*"
sleep 2
done
elif [ $(type -t $firstArg) = alias ]; then
# alias sudo='\sudo '
while true; do
clear -x
eval "$@"
sleep 2
done
else
while true;do clear -x;command "$@";sleep 2;done
while true; do
clear -x
command "$@"
sleep 2
done
fi
}
process_search(){
if [[ -z ${1} ]];then
process_search() {
if [[ -z ${1} ]]; then
printf 'no search arg provided\n'
return 1
fi
@ -95,11 +128,11 @@ pushall() {
read -p "tag as well? (Y/n)" bool_tag
[ -z ${bool_tag} ] && bool_tag="y"
case "${bool_tag}" in
[yY]|[yY][eE][sS])
read -p "Tag version: " ver_tag
git tag -a "${ver_tag}" -m "${ver_tag}"
git push origin "${ver_tag}"
;;
[yY] | [yY][eE][sS])
read -p "Tag version: " ver_tag
git tag -a "${ver_tag}" -m "${ver_tag}"
git push origin "${ver_tag}"
;;
esac
}
#deb_canvas(){
@ -110,8 +143,8 @@ network-status() {
sudo journalctl -u NetworkManager.service -u openvpn.service --lines="${loglength}" --follow
}
tb-encrypt(){
if ! [[ -f "${1}" || -d "${1}" ]];then
tb-encrypt() {
if ! [[ -f "${1}" || -d "${1}" ]]; then
printf 'no path provided\n'
return 1
fi
@ -119,8 +152,8 @@ tb-encrypt(){
bn=$(basename "${path}")
tar -czf - "${1}" | openssl enc -e -aes256 -out "${bn}-$(date +%Y-%m-%d_%H%M%S).tar.gz.enc"
}
tb-decrypt(){
if ! [[ -f "${1}" ]];then
tb-decrypt() {
if ! [[ -f "${1}" ]]; then
printf 'no path provided\n'
return 1
fi
@ -135,16 +168,16 @@ tb-decrypt(){
alias quickdeb='dpkg-buildpackage -b -tc'
alias gituntracked='git ls-files . --exclude-standard --others'
alias gitdiff='git diff --name-only'
gitchanges(){
gitchanges() {
printf '%b\n' "\033[1m"'Modified Files:'"\033[0m"
while read l;do printf ' - %s\n' "${l}";done < <(git diff --name-only)
# git diff --name-only
while read l; do printf ' - %s\n' "${l}"; done < <(git diff --name-only)
# git diff --name-only
printf '%b\n' "\033[1m"'Untracked Files:'"\033[0m"
# git ls-files . --exclude-standard --others
while read l;do printf ' - %s\n' "${l}";done < <(git ls-files . --exclude-standard --others)
# git ls-files . --exclude-standard --others
while read l; do printf ' - %s\n' "${l}"; done < <(git ls-files . --exclude-standard --others)
}
dpkg-log-search(){
dpkg-log-search() {
zgrep "${1}" /var/log/dpkg.log*
}
#apt update summary
@ -171,7 +204,7 @@ prompt_prefix=""
if [ -n "${SSH_CLIENT}" ] || [ -n "${SSH_TTY}" ]; then
prompt_prefix="${prompt_prefix} [SSH] "
fi
if [[ "$HOSTNAME" == pod* ]];then
if [[ "$HOSTNAME" == pod* ]]; then
prompt_prefix="${prompt_prefix} [POD] "
mkdir -p "${HOME}/.devpod/$(uname -m)"
export CARGO_HOME="${HOME}/.devpod/$(uname -m)/.cargo"
@ -203,9 +236,8 @@ eval "$(pyenv init - bash 2>/dev/null)"
#PS1='\[\e[1m\e[95m\]${prompt_prefix}\[\e[m\]${debian_chroot:+($debian_chroot)}\[\e[01;32m\]󰊟 \u ${TPUT_RED}󰣚\[\e[00m\] \[\e[01;34m\]$(pwd|sed "s|${HOME}|~|"|perl -pe "s/(?<!(^~))(\\/.*)(?=\\/.*\\/)/\\/…/s")\[\e[00m\]\n\$ '
#PS1='\[\e[1m\e[95m\]${prompt_prefix}\[\e[m\]${debian_chroot:+($debian_chroot)}\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]$(pwd|sed "s|${HOME}|~|"|perl -pe "s/(?<!(^~))(\\/.*)(?=\\/.*\\/)/\\/…/s"|xargs printf "\\e]2;%s — Alacritty\007")\[\e[00m\]\n\$ '
#Alacritty custom window title
if [ "$TERM" = alacritty ];then
if [ "$TERM" = alacritty ]; then
PROMPT_COMMAND='pwd|sed "s|${HOME}|~|"|perl -pe "s/(?<!(^~))(\/.*)(?=\/.*\/)/\/…/s"|xargs printf "\e]2;%s — Alacritty\007"'
fi
@ -215,4 +247,3 @@ eval "$(starship init bash)"
#set show-all-if-ambiguous on
bind 'set show-all-if-ambiguous on'
bind 'set completion-ignore-case on'