A script which throttles your CPU frequency at high temperatures, use
sudo ./temp_throttle.sh 80 [Download Link]
Note that the files used for checking CPU temperatures may differ from system to system. For example, I use
/sys/class/hwmon/hwmon2/device/hwmon/hwmon2/temp2_input
or
/sys/bus/platform/devices/coretemp.0/hwmon/hwmon2/temp2_input