dotfiles/default/home/.sapphrc/default
2025-01-29 14:45:02 -08:00

108 lines
3.1 KiB
Bash
Executable file

#!/bin/bash
hyfetch 2>/dev/null || true
# Quality of Life
#enable using sudo with functions
function Sudo {
local firstArg=$1
if [ $(type -t $firstArg) = function ];then
shift && command sudo bash -c "$(declare -f $firstArg);$firstArg $*"
elif [ $(type -t $firstArg) = alias ];then
alias sudo='\sudo '
eval "sudo $@"
else
command sudo "$@"
fi
}
#find in history
alias h="history|grep "
#search files in current and sub dirs
#alias f="find . |grep "
find_file() {
find . -name *"${1}"*
}
#find running processes
alias p="ps aux |grep "
#open file
alias o="open "
#find large files
#alias find_largest_files="du -h -x -s -- * | sort -r -h | head -20"
sort_filesizes() {
[ -z ${1} ] && local dir="$(pwd)" || local dir="${1}"
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 '/dev/'"
#dev environment toolbox with proper term env var
devpod(){
podman container start debian-sid-dev
podman exec --env POD_PATH=$(pwd | sed "s|${HOME}|/root|") -it debian-sid-dev /bin/bash
}
simplewebserver(){
screen python3 -m http.server
}
#alias devbox-stable="TERM=xterm-256color toolbox enter debian-toolbox-12"
#alias devbox-testing="TERM=xterm-256color toolbox enter debian-toolbox-testing"
#git shortcut to quickly push all changes with comment
pushall() {
git add .
git commit -m "${1}"
git push origin
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}"
;;
esac
}
#deb_canvas(){
# dh_make -c custom --copyrightfile ~/Development/metapackages/pogmom_deb_template/licenses/oql -n -e "${GIT_AUTHOR_EMAIL}" -p pogmom-essentials_0.1 -C i
#}
alias quickdeb='dpkg-buildpackage -b -tc'
#apt update summary
alias pm-update="sudo apt update;apt list --upgradable"
alias pm-upgrade="sudo apt update;sudo apt upgrade"
#User Env Vars
export DEBEMAIL="support@pogmom.me"
export DEBFULLNAME="Penelope Gwen"
#SSH Personal Machines
alias pogmommy-omen-328p1aa="ssh pogmommy-omen-328p1aa"
alias pogmommy-apple-a2337="ssh pogmommy-apple-a2337"
alias pogmommy-apple-a2337-vpn="ssh pogmommy-apple-a2337-vpn"
alias pogmommy-dell-p135g="ssh pogmommy-dell-p135g"
#Git env vars
GIT_AUTHOR_NAME="Penelope Gwen"
GIT_AUTHOR_EMAIL="penelope@pogmom.me"
GIT_EDITOR="/usr/bin/nano"
#Bash Prompt Customization
prompt_prefix=""
if [ -n "${SSH_CLIENT}" ] || [ -n "${SSH_TTY}" ]; then
prompt_prefix="${prompt_prefix} [SSH] "
fi
if [[ "$HOSTNAME" == pod* ]];then
prompt_prefix="${prompt_prefix} [POD] "
cd ${POD_PATH}
fi
export prompt_prefix=`awk '{$1=$1};1' <<< "${prompt_prefix}"`
PS1='\[\e[1m\e[95m\]${prompt_prefix}\[\e[m\]${debian_chroot:+($debian_chroot)}\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\n\$ '
#Alacritty custom window title
if [ "$TERM" = alacritty ];then
PROMPT_COMMAND='ala_title=`pwd | sed "s|${HOME}|~|"`;echo -ne "\e]2;${ala_title} — Alacritty\007"'
fi
bind TAB:menu-complete