Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Created April 18, 2014 20:38
Show Gist options
  • Save aybabtme/11063367 to your computer and use it in GitHub Desktop.
Save aybabtme/11063367 to your computer and use it in GitHub Desktop.
> To apply, email us at jobs+n@getclever.com, where n is the number of students in the Clever sandbox API data set with a last name that begins with the letter 'V'. Send us one or more things from [resume, github profile, recent side projects, linkedin URL, Stack Overflow profile, etc], and let us know how you solved our 'puzzle.'
pagecount=$(curl -s -H 'Authorization: Bearer DEMO_TOKEN' -X GET https://api.clever.com/v1.1/students | jq '.paging.total')
echo "$pagecount pages"
now=$(date "+%Y-%m-%d-%H:%M.%S")
tmpfile=".$now-tmp_clever.json"
touch $tmpfile
echo "Saving pages to $tmpfile"
for i in $(seq 1 $pagecount); do
echo "Getting page $i"
curl -s -H 'Authorization: Bearer DEMO_TOKEN' -X GET https://api.clever.com/v1.1/students?page=$i >> $tmpfile
done
echo "Last names starting with W:"
cat $tmpfile | jq -s 'map(.data[]) | map(.data.name.last)' | grep '.*"W' | wc -l
rm $tmpfile
@aybabtme
Copy link
Author

Oups:

s/W/V/g

gives 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment