Skip to content

Instantly share code, notes, and snippets.

@VioletVivirand
Created March 8, 2024 05:46
Show Gist options
  • Save VioletVivirand/1d55e500bcf7cc80e9759bcb160b1a1c to your computer and use it in GitHub Desktop.
Save VioletVivirand/1d55e500bcf7cc80e9759bcb160b1a1c to your computer and use it in GitHub Desktop.
A Bash script to download files of a Gist answered by Gemini model
gist_id="YOUR_GIST_ID" # Replace with the actual Gist ID
download_path="." # Specify the download directory (optional)
# Get Gist information as JSON
gist_info=$(curl -s "https://api.github.com/gists/$gist_id")
# Extract file URLs using jq
file_urls=$(echo "$gist_info" | jq -r '.files[].raw_url')
# Loop through URLs and download files
for url in $file_urls; do
filename=$(basename "$url") # Extract filename from URL
curl -o "$download_path/$filename" "$url"
echo "Downloaded: $filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment