Skip to content

Instantly share code, notes, and snippets.

View bmiselis's full-sized avatar

Bartosz Miselis bmiselis

  • Gdańsk, Poland
  • 07:18 (UTC +02:00)
  • LinkedIn in/bmiselis
View GitHub Profile
@bmiselis
bmiselis / git_pr_clean.bash
Created August 6, 2019 20:00
Clean repository after Pull Request has been successfully merged.
#!/bin/bash
# Go to user-specified branch.
git checkout $1
# Get newest changes after PR merge.
git pull
# Update tracked remote branches.
git fetch --prune
@bmiselis
bmiselis / docker_cleanup.bash
Last active August 6, 2019 20:01
Bash script that does a nice cleanup of Docker in your system.
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(