An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
November 20, 2021 09:54 am GMT
Original Link: https://dev.to/tgotwig/executing-github-gist-files-from-linux-shell-via-curl-10fe
Executing Github Gist files from Linux Shell via cURL
We have two different URL options to fetch a Github Gist file via cURL:
- gist.githubusercontent.com
- api.github.com
The second one is a bit more work, but always instant up-to-date!
1 gist.githubusercontent.com
curl -s https://gist.githubusercontent.com/[user]/[gist_id]/raw/[gist_file]?_=$(uuidgen) \| bash
Hello World!
But this can run a older version of the file
2 api.github.com
Fix limitations of api.github.com
Using api.github.com
comes with rate-limiting per hour:
curl -I -s https://api.github.com/users/[user] | grep x-ratelimit
x-ratelimit-limit: 60x-ratelimit-remaining: 59x-ratelimit-reset: 1636928776x-ratelimit-resource: corex-ratelimit-used: 1
However, we can get around this strong limitation by using a PAT:
curl -I -s -u <user>:<pat> \ https://api.github.com/users/[user] | grep x-ratelimit
x-ratelimit-limit: 5000x-ratelimit-remaining: 4999x-ratelimit-reset: 1636928894x-ratelimit-used: 1x-ratelimit-resource: core
Executing the Gist file!
curl -s -u <user>:<pat> \ "https://api.github.com/gists/[gist_id]?_=$(uuidgen)" \ | jq --raw-output '.files."<GIST_FILE>".content' | bash
Hello World!
Until now it was always up-to-date!
Original Link: https://dev.to/tgotwig/executing-github-gist-files-from-linux-shell-via-curl-10fe
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To