92 lines
2.6 KiB
Bash
92 lines
2.6 KiB
Bash
# Обновление конфигурации zsh, менджера zcomet и плагинов
|
|
zu() {
|
|
git -C ~/.config/zsh pull && zcomet self-update && zcomet update
|
|
if [[ -f "${ZCOMET_DIR}/prompt/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
|
|
command git -C "${ZCOMET_DIR}/prompt/powerlevel10k" pull
|
|
fi
|
|
exec zsh
|
|
}
|
|
|
|
ch() {
|
|
curl -s "https://cheat.sh/$1" | less -R
|
|
}
|
|
|
|
exf() {
|
|
case "$1" in
|
|
*.tar.bz2) tar xjf "$1" ;;
|
|
*.tar.gz) tar xzf "$1" ;;
|
|
*.tar.xz) tar xJf "$1" ;;
|
|
*.tbz2) tar xjf "$1" ;;
|
|
*.tgz) tar xzf "$1" ;;
|
|
*.tar) tar xf "$1" ;;
|
|
*.zip) unzip "$1" ;;
|
|
*.7z) 7z x "$1" ;;
|
|
*.iso) 7z x "$1" ;;
|
|
*.rar) unrar x "$1" ;;
|
|
*) echo "'$1' cannot be extracted" ;;
|
|
esac
|
|
}
|
|
|
|
exfl() {
|
|
for F in "$@"
|
|
do
|
|
if [ -f "$F" ]; then
|
|
exf "$F"
|
|
else
|
|
echo "'$F' is not a valid file"
|
|
fi
|
|
done
|
|
}
|
|
|
|
exd() {
|
|
case "$1" in
|
|
*.tar.bz2) b=${1%.tar.bz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
|
*.tar.gz) b=${1%.tar.gz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
|
*.tar.xz) b=${1%.tar.xz}; mkdir -p "$b">/dev/null; tar xJf "$1" -C "$b" ;;
|
|
*.tbz2) b=${1%.tbz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
|
*.tgz) b=${1%.tgz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
|
*.tar) b=${1%.tar}; mkdir -p "$b">/dev/null; tar xf "$1" -C "$b" ;;
|
|
*.zip) b=${1%.zip}; unzip "$1" -d "$b" ;;
|
|
*.7z) b=${1%.7z}; 7z x -o"$b" "$1" ;;
|
|
*.iso) b=${1%.iso}; 7z x -o"$b" "$1" ;;
|
|
*.rar) b=${1%.rar}; rar x "$1" "$b" ;;
|
|
*) echo "'$1' cannot be extracted" ;;
|
|
esac
|
|
}
|
|
|
|
exdl() {
|
|
for F in "$@"
|
|
do
|
|
if [ -f "$F" ]; then
|
|
exd "$F"
|
|
else
|
|
echo "'$F' is not a valid file"
|
|
fi
|
|
done
|
|
}
|
|
|
|
psgrep() {
|
|
ps aux | grep "${1:-.}" | grep -v grep
|
|
}
|
|
|
|
# Kills any process that matches a regexp passed to it
|
|
killit() {
|
|
ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill
|
|
}
|
|
|
|
# gather external ip address
|
|
geteip() {
|
|
curl -s -S -4 https://icanhazip.com
|
|
curl -s -S -6 https://icanhazip.com
|
|
}
|
|
|
|
# determine local IP address(es)
|
|
getip() {
|
|
if (( ${+commands[ip]} )); then
|
|
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
|
else
|
|
ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
|
fi
|
|
}
|
|
|