61 lines
1.3 KiB
Bash
61 lines
1.3 KiB
Bash
. ~/.prompt
|
|
|
|
# History stuff
|
|
export HISTCONTROL=ignoredups:erasedups
|
|
export HISTFILESIZE=1000
|
|
export HISTSIZE=1000
|
|
|
|
# We hate sudo here
|
|
alias sudo='sh -c "exit 1"'
|
|
# Other aliases
|
|
alias c='clear'
|
|
alias ls='ls --color=auto -FAh'
|
|
#alias ls='exa --color=auto -Fah'
|
|
alias ll='ls -l'
|
|
alias rebash='. ~/.bashrc'
|
|
alias bashrc="$EDITOR ~/.bashrc && rebash"
|
|
alias nf='neofetch'
|
|
alias sshd='boas /usr/sbin/sshd'
|
|
|
|
# Completions for elevation program (https://codeberg.org/Bowuigi/Unit21 in management/boas)
|
|
complete -cf boas
|
|
|
|
# Random string (passwords)
|
|
randstr() { tr -cd [:graph:] </dev/urandom | head -c${1:-256}; }
|
|
|
|
# Get CPU usage
|
|
cpusage() {
|
|
bc<<<"scale=3;$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}') / $(nproc --all)"
|
|
}
|
|
|
|
# Update and upgrade system
|
|
update() { boas sh -c 'apk update && apk upgrade -aiv'; }
|
|
|
|
# Im too lazy to type
|
|
copy() {
|
|
tee >(wl-copy)
|
|
}
|
|
|
|
# Source colors for tty
|
|
. ~/.config/sxmo/isotope.dark
|
|
|
|
# Get local IP
|
|
lip() { ip a | grep ${1:-wlan0} | sed 1d | cut -d' ' -f6 | cut -d/ -f1; }
|
|
|
|
# URL-encode stdin
|
|
urlencode() {
|
|
LC_COLLATE_OLD=$LC_COLLATE
|
|
LC_COLLATE=C
|
|
|
|
local TEXT="$(</dev/stdin)"
|
|
local LENGTH="${#TEXT}"
|
|
for (( i = 0; i < LENGTH; i++ )); do
|
|
local c="${TEXT:$i:1}"
|
|
case $c in
|
|
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
|
|
*) printf '%%%02X' "'$c" ;;
|
|
esac
|
|
done
|
|
LC_COLLATE=$LC_COLLATE_OLD
|
|
}
|