Skip to content

Instantly share code, notes, and snippets.

@colobas
Created October 10, 2017 14:24
Show Gist options
  • Save colobas/6da25986991309fea1a7759e00f36784 to your computer and use it in GitHub Desktop.
Save colobas/6da25986991309fea1a7759e00f36784 to your computer and use it in GitHub Desktop.
words="$(echo | k2pdfopt nickel2016.pdf -h 20000 -w 1200 -pl 100 -pr 100 | grep -Eo "[0-9]* words" | grep -Eo "[0-9]*")"
let "reading_time = $words * 1.1 / 275"
reading_mins="$(printf "%.0f" $reading_time)"
if [[ $reading_mins -le 60 ]]; then
echo "approx reading time: $reading_mins mins"
else
let "hours = $reading_mins / 60"
let "mins = $reading_mins % 60"
echo "approx reading time: $hours h $mins mins"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment