#!/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 -v 'tmpfs'" #dev environment toolbox with proper term env var alias devbox="TERM=xterm-256color toolbox enter debian-sid-dev" 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 } #apt update summary alias pm-apt-update="sudo apt update;apt list --upgradable" alias pm-apt-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" #alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" #. /usr/share/bash-completion/completions/quilt #complete -F _quilt_completion -o filenames dquilt export ssh_prefix="" if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then export ssh_prefix="[SSH] " else export ssh_prefix="" fi #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' PS1='\[\e[1m\e[95m\]$ssh_prefix\[\e[m\]${debian_chroot:+($debian_chroot)}\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ ' 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