Skip to content

Instantly share code, notes, and snippets.

@kmatt
Created January 10, 2025 05:30
Show Gist options
  • Save kmatt/941ec8595cd6a4f65c4f42cbc2181451 to your computer and use it in GitHub Desktop.
Save kmatt/941ec8595cd6a4f65c4f42cbc2181451 to your computer and use it in GitHub Desktop.
Download all Gists using Github CLI
# Download all Gists
for i in $(gh gist list -L 1000 | cut -f1); do echo "ID: $i"; gh gist view $i > $i; done
# Rename each file with a slug of the first line / description
for f in *; do mv -v $f $(gawk 'NR==1{gsub(/[^[:alnum:]]/, "-"); gsub(/-+/, "-"); print $0 "_" FILENAME}' $f); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment