├── README.md └── GitHubRating.sh /README.md: -------------------------------------------------------------------------------- 1 | GitHubRating 2 | ============ 3 | 4 | Whether you're hiring an actual developer or just someone who needs to know how to code to solve problems, it's useful to get a feel for how much coding they actually do. 5 | 6 | This tool runs from the command line and takes a single parameter: the github username of the person you're looking into. The result is a composite score for their programming quality on GitHub. It's not their number of repos, or their followers, or their number of code pushes—it's all of those things combined and weighted. 7 | 8 | ## Usage 9 | 10 | Example: 11 | 12 | ./GitHubRating.sh danielmiessler 13 | 14 | Example Output: 15 | 16 | > danielmiessler has:
17 | 18 | > 131 followers.
19 | > 352 public pushes this year.
20 | > 32 public repositories.
21 |
22 | > Github score is (based on public contributions only): 1287 23 | -------------------------------------------------------------------------------- /GitHubRating.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### GitHubRating, by Daniel Miessler 3 | ### Rank one's programming activity. 4 | 5 | # Variables 6 | 7 | USERNAME=$1 8 | SITENAME=$1 9 | URL='' 10 | RESPONSECODE='' 11 | 12 | # Get page 13 | 14 | curl -sLA "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.1.25 (KHTML, like Gecko) Version/8.0 Safari/600.1.25" https://github.com/$USERNAME | sed -e 's/\ $SITENAME-page.htm 15 | 16 | # Get followers 17 | 18 | grep -i "vcard-stat-count" $SITENAME-page.htm | head -n 1 > $SITENAME-followers.txt 19 | FOLLOWERS=`sed -e 's/.*\>\(.*\)*/\1/' $SITENAME-followers.txt | awk '{ print $1 }'` 20 | 21 | # Get contributions 22 | 23 | grep -i "contrib-number" $SITENAME-page.htm | head -n 1 > $SITENAME-yearcontrib.txt 24 | CONTRIBS=`sed -e 's/.*\>\(.*\)total.*/\1/' $SITENAME-yearcontrib.txt` 25 | 26 | # Get repositories 27 | 28 | grep -i "repositories written" $SITENAME-page.htm | head -n 1 > $SITENAME-repositories.txt 29 | REPOS=`sed -e 's/.*has\(.*\)repositories.*/\1/' $SITENAME-repositories.txt | awk '{ print $1 }'` 30 | 31 | # Calculate score 32 | 33 | NEWFOLLOWERS=`echo "$FOLLOWERS * 5" | bc` 34 | NEWCONTRIBS=`echo "$CONTRIBS * 1" | bc` 35 | NEWREPOS=`echo "$REPOS * 3" | bc` 36 | SCORE=`echo "$NEWFOLLOWERS + $NEWCONTRIBS + $NEWREPOS" | bc` 37 | 38 | # Reporting 39 | echo "" 40 | echo ""$SITENAME" has:" 41 | echo "" 42 | echo ""$FOLLOWERS" followers." 43 | echo ""$CONTRIBS" public pushes this year." 44 | echo ""$REPOS" public repositories." 45 | echo "" 46 | echo "Developer rating (based on public contributions only): "$SCORE"" 47 | 48 | # Help if no arguments 49 | 50 | if [[ $# -ne 1 ]] ; then 51 | echo '' 52 | echo 'Usage:' 53 | echo './GitHubRating.sh githubusername, e.g.: ./GitHubRating.sh danielmiessler' 54 | echo '' 55 | exit 0 56 | else 57 | USERNAME="$1" 58 | fi 59 | --------------------------------------------------------------------------------