Add remote and local CGMiner and major refactor

Split thermostat support code out into modules, including subprocess utils.