Skip to content

Instantly share code, notes, and snippets.

@vadz
Created April 18, 2020 23:04
Show Gist options
  • Save vadz/5225822dd3deb5a436d20d6997841f77 to your computer and use it in GitHub Desktop.
Save vadz/5225822dd3deb5a436d20d6997841f77 to your computer and use it in GitHub Desktop.
Get CSV stats for wx release downloads
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 <x.y.z>" >&2
exit 1
fi
ver=$1
stats_file=download_stats-`date +%Y%m%d`.csv
if [ ! -f $stats_file ]; then
curl https://api.github.com/repos/wxWidgets/wxWidgets/releases | \
jq -r '.[] | .assets[] | [.name,.download_count] | @csv' > $stats_file
fi
sed -ne "s/-$ver//p" < $stats_file | perl -lpe 'BEGIN { print "File,Count,Kind,Compiler,Version,Bits" }; if ($_ =~ /docs/) { $k="docs" } elsif ($_ =~ /^"wxMSW_/) { $k="bin"; $b=($_ =~ /x64/ ? "64" : "32") } else { $k="source" }; if ($_ =~ /wxMSW_([a-z]+)([0-9]+)/) { $c=$1; $v=$2 }; $_ .= ",$k,$c,$v,$b"' > stats-$ver.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment