Permanently allow apps downloaded from "anywhere"

It took me some time to figure this out but you can disable it through a global preference using the terminal:

sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO

This will disable the auto rearming of the Gatekeeper in OS X. Tested on both Yosemite and Mavericks