Skip to content

Commit

Permalink
qplot
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdpunk committed Nov 5, 2016
1 parent 3cfa166 commit d309544
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 13 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions get_percentages.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bIN/BASh
#!/bin/bash

#get token
#printf "Enter your github token, if you have one. Otherwise hit enter: "
Expand All @@ -13,15 +13,15 @@
#get user
GTOKEN=$(cat ~/.gh)
CMD="?access_token=$GTOKEN"

alias sed='gsed'
echo ''
printf 'Enter which github user you would like to check percentages on: '
read -r GHUSER

#echo 'https://api.github.com/users/bsdpunk/repos'$CMD
http https://api.github.com/users/$GHUSER/repos$CMD |python -m json.tool | egrep '"name"|"fork"' > list
#sleep 1
cat list | sed '/true/,+1d' | grep '"name"' | awk -F: '{print $0}' | tr -d '{' | tr -d '}' | tr -d '"' |sort | grep -v '^$' | sed 's/^.*name://gi' | tr -d ',' >> repos
cat list | gsed '/true/,+1d' | grep '"name"' | awk -F: '{print $0}' | tr -d '{' | tr -d '}' | tr -d '"' |sort | grep -v '^$' | gsed 's/^.*name://gi' | tr -d ',' >> repos
for i in $(cat repos); do echo '' >> lang && http https://api.github.com/repos/$GHUSER/$i/languages$CMD >> lang; done;
awk -F, '{print $0}' lang | tr -d '{' | tr -d '}' | tr -d '"'| tr ' ' '\n' |sort | grep -v '^$' | tr -d ',' >> preclean
cat preclean |perl -pe "s/(\d+|\d)([A-Za-z])/\1\n\2/gi" | grep -v 'HTML'| grep -v 'CSS' | sort >> clean
Expand Down
37 changes: 37 additions & 0 deletions get_percentages_qplot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

#get token
#printf "Enter your github token, if you have one. Otherwise hit enter: "
#read -r CMD
# if [ -z $CMD ]
# then
# CMD=""
# else
# CMD="?access_token=$CMD"
# fi
#echo $CMD;
#get user
GTOKEN=$(cat ~/.gh)
CMD="?access_token=$GTOKEN"
alias sed='gsed'
echo ''
printf 'Enter which github user you would like to check percentages on: '
read -r GHUSER

#echo 'https://api.github.com/users/bsdpunk/repos'$CMD
http https://api.github.com/users/$GHUSER/repos$CMD |python -m json.tool | egrep '"name"|"fork"' > list
#sleep 1
cat list | gsed '/true/,+1d' | grep '"name"' | awk -F: '{print $0}' | tr -d '{' | tr -d '}' | tr -d '"' |sort | grep -v '^$' | gsed 's/^.*name://gi' | tr -d ',' >> repos
for i in $(cat repos); do echo '' >> lang && http https://api.github.com/repos/$GHUSER/$i/languages$CMD >> lang; done;
awk -F, '{print $0}' lang | tr -d '{' | tr -d '}' | tr -d '"'| tr ' ' '\n' |sort | grep -v '^$' | tr -d ',' >> preclean
cat preclean |perl -pe "s/(\d+|\d)([A-Za-z])/\1\n\2/gi" | grep -v 'HTML'| grep -v 'CSS' | sort >> clean

bash tottals.awk
bash output.awk > loc.csv
Rscript locgraphq.R $GHUSER 2>&1 >/dev/null
rm -rf list
rm -rf repos
rm -rf lang
rm -rf clean
rm -rf preclean
#rm -rf loc.csv
15 changes: 8 additions & 7 deletions loc.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language, LoC
AppleScript ,696
Awk ,539
Go ,15548
JavaScript ,9115
JavaScript ,9266
Julia ,501
PHP ,10034
Perl ,22547
PHP ,20528
Python ,207902
R ,1926
Shell ,10046
Python ,119622
R ,2642
Shell ,13439
VimL ,934
AppleScript ,696
Awk ,539
Binary file modified loc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions locgraphq.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library(ggplot2)
locs <- read.csv('loc.csv', header=TRUE, sep=",")
png("loc.png")
qplot(x =locs$language,y =locs$LoC, color=locs$language, xlab = "Language", ylab = "Lines Of Code", main = commandArgs(TRUE)[1], geom = "boxplot")
dev.off()
6 changes: 3 additions & 3 deletions make_large_csv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ export GHUSER=$GHUSER
#echo 'https://api.github.com/users/bsdpunk/repos'$CMD
http https://api.github.com/users/$GHUSER/repos$CMD |python -m json.tool | egrep '"name"|"fork"' > list
#sleep 1
cat list | sed '/true/,+1d' | grep '"name"' | awk -F: '{print $0}' | tr -d '{' | tr -d '}' | tr -d '"' |sort | grep -v '^$' | sed 's/^.*name://gi' | tr -d ',' >> repos
cat list | gsed '/true/,+1d' | grep '"name"' | awk -F: '{print $0}' | tr -d '{' | tr -d '}' | tr -d '"' |sort | grep -v '^$' | gsed 's/^.*name://gi' | tr -d ',' >> repos
for i in $(cat repos); do echo '' >> lang && http https://api.github.com/repos/$GHUSER/$i/languages$CMD >> lang; done;
awk -F, '{print $0}' lang | tr -d '{' | tr -d '}' | tr -d '"'| tr ' ' '\n' |sort | grep -v '^$' | tr -d ',' >> preclean
cat preclean |perl -pe "s/(\d+|\d)([A-Za-z])/\1\n\2/gi" | grep -v 'HTML'| grep -v 'CSS' | sort >> clean

bash tottals.awk

bash csv.awk
#sed 's/$/,$GHUSER' > locuser.csv
#sed -e "s/$/,${GHUSER}/" loc.csv >> locuser.csv
#gsed 's/$/,$GHUSER' > locuser.csv
#gsed -e "s/$/,${GHUSER}/" loc.csv >> locuser.csv
head -n1 loc.csv >> locuser.csv
tac locuser.csv > locusertwo.csv
Rscript loctwo.R $GHUSER 2>&1 >/dev/null
Expand Down

0 comments on commit d309544

Please sign in to comment.