Skip to content

Instantly share code, notes, and snippets.

@bketelsen
Created July 4, 2021 12:43
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bketelsen/8b7c3bd9d770a866b389e3934e6b2dee to your computer and use it in GitHub Desktop.
Save bketelsen/8b7c3bd9d770a866b389e3934e6b2dee to your computer and use it in GitHub Desktop.
cleanup detritus from dev work
│ File: .zsh/includes/cleanup.sh
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ cleanup () {
2 │ find ~/src -name 'node_modules' -type d -prune -exec rm -rf '{}' +
3 │ find ~/src -name '.next' -type d -prune -exec rm -rf '{}' +
4 │ cargo sweep -r -t 30 ~/src
5 │ brew cleanup
6 │ is_bin_in_path docker && docker system prune -a -f --volumes || echo "skipping docker"
7 │ }
8 │ # https://stackoverflow.com/questions/6569478/detect-if-executable-file-is-on-users-path
9 │ function is_bin_in_path {
10 │ if [[ -n $ZSH_VERSION ]]; then
11 │ builtin whence -p "$1" &> /dev/null
12 │ else # bash:
13 │ builtin type -P "$1" &> /dev/null
14 │ fi
15 │ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment