Bash version. Requires `devmem2`. Run this script at boot time to restore the gpio pins on the 40 pin connector to the correct state.
Python3 version. Run this script at boot time to correct the pin settings on the 40 pin connector. All the 'special function' pins are set to special-function, and the gpio pins are set to GPIO.