Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Last active September 16, 2024 12:13
Show Gist options
  • Save SamuelDavis/90084592848b74f5beb9a0c3dd114807 to your computer and use it in GitHub Desktop.
Save SamuelDavis/90084592848b74f5beb9a0c3dd114807 to your computer and use it in GitHub Desktop.
useful scripts
eval $(ssh-agent -s) 1> /dev/null
export USER_ID=$(id --user)
export GROUP_ID=$(id --group)
export DENO_DIR="$HOME/.deno"
PATH="$PATH:$HOME/.npm/bin"
alias nixos-clean="sudo nix-collect-garbage --delete-old"
alias nixos-list="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"
alias dpa="dprune container volume network"
alias dc="docker-compose"
function nvidia-offload() {
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
}
function dprune() {
for CMD in "$@"
do
echo "Pruning ${CMD}s..."
IDS=$(docker $CMD ls --all --quiet 2> /dev/null || docker $CMD ls --quiet)
[ -z "$IDS" ] && echo "None found." && continue
echo "$IDS" | xargs -L1 docker $CMD rm --force
docker $CMD prune --force
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment