Skip to content

Instantly share code, notes, and snippets.

@MachinesAreUs
Created July 21, 2015 21:44
Show Gist options
  • Save MachinesAreUs/44080637594a84b3ec27 to your computer and use it in GitHub Desktop.
Save MachinesAreUs/44080637594a84b3ec27 to your computer and use it in GitHub Desktop.
Crawl Elixir doc to get some stats
base_url="http://elixir-lang.org/docs/stable/elixir/"
curl "${base_url}/modules_list.html" > modules.html
grep '<a href' modules.html | grep -v '#' | \
awk '{print $2}' | sed -e 's/href=\"//g' -e 's/\.html\".*//g' | \
tail +3 > modules.txt
for m in `cat modules.txt`; do
curl "${base_url}/${m}.html" > "${m}.html";
done
for m in `cat modules.txt`; do
functions=`grep '\(function\)' "${m}.html" | grep 'detail_type' | wc -l`;
macros=`grep '\(macro\)' "${m}.html" | grep 'detail_type' | wc -l`;
callbacks=`grep '\(callback\)' "${m}.html" | grep 'detail_type' | wc -l`;
echo "${m},${functions},${macros},${callbacks}";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment