This code was originally forked from https://github.com/cwalk/Pi-Temp, but the ultimate source is https://github.com/futureshocked/RaspberryPi-FullStack (Raspberry Pi: Full Stack). I plan to modify it heavily for my own needs.
This image is from page 41 of Raspberry Pi: Full Stack.