Skip to content

Instantly share code, notes, and snippets.

@drconopoima
Last active February 17, 2024 12:19
Show Gist options
  • Save drconopoima/28cccce738e3c09113ebf3e3e7bdba72 to your computer and use it in GitHub Desktop.
Save drconopoima/28cccce738e3c09113ebf3e3e7bdba72 to your computer and use it in GitHub Desktop.
Personal aliases (fedora dnf)
# 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 --skip-broken --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