Skip to content

Instantly share code, notes, and snippets.

View rverst's full-sized avatar

Robert Verst rverst

View GitHub Profile
@rverst
rverst / docker_cleanup.sh
Last active August 27, 2021 09:50
Clean up unused docker volumes, images and containers
#!/usr/bin/env sh
is_root () { [ "$(id -u)" -eq 0 ]; }
is_docker_grp() { [ -n "$(id -Gn | grep docker)" ]; }
if ! is_root && ! is_docker_grp; then
echo "You need to be 'root' or in the 'docker'-group!"
echo "Try 'sudo docker_cleanup.sh'"
exit 1
fi
@rverst
rverst / recipes_rv-0
Created November 30, 2020 09:21
uMatrix Ruleset
! uMatrix: rverst custom ruleset recipes 1.0
! Title: Custom ruleset
! Maintainer: rverst
chayns
chayns.net *
_ 1st-party script
_ chayns-static.space *
_ tobit.com *
_ tsimg.cloud *
@rverst
rverst / check_semver.sh
Last active April 14, 2024 04:41
Bash script for checking a semantic version
#!/usr/bin/env bash
# https://gist.github.com/rverst/1f0b97da3cbeb7d93f4986df6e8e5695
function chsv_check_version() {
if [[ $1 =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "$1"
else
echo ""
fi
}