Last active
October 22, 2024 08:58
-
-
Save dewomser/01e5c8e044536ae0bed912d4529e0a3b to your computer and use it in GitHub Desktop.
Macht eine HTML-Liste aus allen GIST einträgen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## with a little help from copilot | |
# Ersetze 'deinBenutzername' mit deinem GitHub-Benutzernamen | |
USER='dewomser' | |
# Hole die Gist-Daten von GitHub API und speichere sie in einer JSON-Datei | |
#curl -L "https://api.github.com/users/$USER/gists" -o gists.json | |
#max 100 | |
#curl --header "Authorization:'token' 'GIST_TOKEN'" -L "https://api.github.com/users/dewomser/gists?per_page=100" -o gists.json | |
#max 200 | |
curl --header "Authorization: 'token' '$GIST_TOKEN'" -L "https://api.github.com/users/dewomser/gists?per_page=100&page=1" -o gists.json | |
curl --header "Authorization: 'token' '$GIST_TOKEN'" -L "https://api.github.com/users/dewomser/gists?per_page=100&page=2" -o gists2.json | |
# Beginne die HTML-Liste | |
echo "<ol>" > gists.html | |
# Lese jeden Gist aus der JSON-Datei und füge ihn zur HTML-Liste hinzu | |
# die ersten 100 und die zweiten 100 | |
{ | |
jq -r '.[] | "<li>update:\(.updated_at|split("T")[0]) <a href=\"\(.html_url)\">\(.description)</a></li>"' gists.json | |
jq -r '.[] | "<li>opdate:\(.updated_at|split("T")[0]) <a href=\"\(.html_url)\">\(.description)</a></li>"' gists2.json | |
echo "</ol>" | |
} >> gists.html | |
# Beende die HTML-Liste | |
# Lösche die temporären JSON-Datei | |
rm gists.json gists2.json | |
# Öffne die erstellte HTML-Datei im Browser (optional) | |
xdg-open gists.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Die letzten 200 Gists als Nummerierte HTML- Liste
Nummeriert, Mit Update Datum, Description und Link
Shellchecked