Skip to content

Instantly share code, notes, and snippets.

@aprescott
Created October 25, 2013 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aprescott/7163358 to your computer and use it in GitHub Desktop.
Save aprescott/7163358 to your computer and use it in GitHub Desktop.
* is a GitHubber!
#!/bin/bash
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$SCRIPT_DIR"
last_employee_count=$(cat last-employee-count)
last_employee_list="$(cat last-employee-list)"
employee_count=$(curl -s 'https://github.com/about/team' | grep -o '[0-9]* employees' | grep -o '[0-9]*')
employee_list="$(curl -s https://github.com/about/team | grep -e '<div class="employee">' -A 1 | grep -Po '(?<=<a href="/)[^"]+(?=">)')"
if [ $(wc -l <<<"$employee_list") -ne $employee_count ]; then
echo "Page states $employee_count employees, but list contains $(wc -l <<<"$employee_list")"
fi
if [ "$last_employee_list" != "$employee_list" ]; then
echo "Found different employees."
echo
echo "Employees no longer listed:"
comm -23 <(sort <<<"$last_employee_list") <(sort <<<"$employee_list")
echo
echo "Employees newly listed:"
comm -13 <(sort <<<"$last_employee_list") <(sort <<<"$employee_list")
fi
echo "$employee_list" > last-employee-list
echo "$employee_count" > last-employee-count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment