Last active
November 10, 2024 23:51
-
-
Save drconopoima/28cccce738e3c09113ebf3e3e7bdba72 to your computer and use it in GitHub Desktop.
Personal aliases (fedora dnf)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
function alert { | |
notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e 's/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//')" | |
} | |
function update_all { | |
echo "Updating all system packages, Flatpak packages, Snap packages, pyenv, npm, and nvm" | |
sudo -p "Please enter your password: " whoami 1>/dev/null | |
( sudo snap refresh & sudo flatpak update -y & pyenv update 2>/dev/null & dotnet tool update powershell --global & wait ) && \ | |
NVM_GIT_VERSION="$(curl -s https://api.github.com/repos/nvm-sh/nvm/tags | jq '.[0].name' | tr -d '"' | cut -c2-)" && \ | |
[[ "${NVM_GIT_VERSION}" == "$(jq .version ${NVM_DIR}/package.json | tr -d '"' || echo "")" ]] || ( \ | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_GIT_VERSION}/install.sh | bash ) && \ | |
nvm install-latest-npm && | |
sudo dnf upgrade -y --best --allowerasing --setopt=install_weak_deps=True && \ | |
unset NVM_GIT_VERSION; | |
alert | |
} | |
function ip { | |
command ip -color=auto "$@" | |
} | |
function diff { | |
command diff --color=auto "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment