Skip to content

Instantly share code, notes, and snippets.

@jgke
Created March 16, 2018 11:09
Show Gist options
  • Save jgke/087fe488542b284eee938ef3bf703f1f to your computer and use it in GitHub Desktop.
Save jgke/087fe488542b284eee938ef3bf703f1f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Scrape license statistics from GitHub
OAUTH=youroauthkeyhere
LICENSES="afl-3.0 apache-2.0 artistic-2.0 bs1-1.0 bsd-2-clause bsd-3-clause bsd-3-clause-clear cc cc0-1.0 cc-by-4.0 cc-by-sa-4.0 wtfpl ecl-2.0 epl-1.0 eupl-1.1 agpl-3.0 gpl gpl-2.0 gpl-3.0 lgpl lgpl-2.1 lgpl-3.0 isc lppl-1.3c ms-pl mit mpl-2.0 osl-3.0 postgresql ofl-1.1 ncsa unlicense zlib"
LANGUAGES="Ada C C%2B%2B D Go Java JavaScript Rust TypeScript"
for lang in $LANGUAGES; do
echo -n ", " "$lang"
done
echo ""
for lic in $LICENSES; do
echo -n "$lic"
for lang in $LANGUAGES; do
count=$(curl -sH "Authorization: token $OAUTH" "https://api.github.com/search/repositories?q=license:$lic+language:$lang" |jq -r ".total_count")
echo -n ", " "$count"
done
echo ""
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment