Skip to content

Instantly share code, notes, and snippets.

@Un1Gfn
Last active April 7, 2020 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Un1Gfn/b0b16bc265c170756802d8be135c0827 to your computer and use it in GitHub Desktop.
Save Un1Gfn/b0b16bc265c170756802d8be135c0827 to your computer and use it in GitHub Desktop.

GitHub curl toturial

  • curl w/ SOCKS5
source ~/extra.bash_aliases
GitHub repo
  • Create repository
function f {
  if [ "$#" -eq 1 ]; then
    curl -v -H "Authorization: token $T" https://api.github.com
    curl -v -H "Authorization: token $T" -X POST --data '{
      "name":"$1",
      "has_issues":false,
      "has_projects":false,
      "has_wiki":false
    }' https://api.github.com/user/repos
  fi
}
f <REPO_NAME>
unset -f f
curl -sI https://api.github.com/users/$USER/starred?per_page=1
curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-

USER=Un1Gfn
alias curl='proxychains curl'
curl "https://api.github.com/users/$USER/starred?sort=created&direction=asc" >/tmp/star

cat /tmp/star \
  | jq ' .[] | "\(.full_name) # \(.description)" ' \
  | tr -d '"' \
  | column -s"#" -t \
  | sed '0~2 a\\' \
  | less -S
Gist
git remote add origin https://Un1Gfn:"$PASSWORD"@gist.github.com/"$ID".git
git remote set-url origin https://Un1Gfn:"$PASSWORD"@gist.github.com/"$ID".git
git clone https://Un1Gfn:"$PASSWORD"@gist.github.com/"$ID".git 
  • Gist SSH working now
git remote add origin git@gist.github.com:"$ID".git
git remote set-url origin git@gist.github.com:"$ID".git
git clone git@gist.github.com:"$ID".git 
  • List gists
curl https://api.github.com/users/Un1Gfn/gists | jq ' .[] | "\(.html_url) \(.files[].filename)" '
  • Delete a gist
curl -v -H "Authorization: token $T" https://api.github.com
curl -X DELETE -H "Authorization: token $T" https://api.github.com/repos/Un1Gfn/del
curl -X DELETE -H "Authorization: token $T" https://api.github.com/gists/<ID>
  • List commits of a repo
curl -v https://api.github.com/repos/stedolan/jq/commits?per_page=5
curl -v https://api.github.com/repos/stedolan/jq/commits?per_page=5 >json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment