An offshoot of https://github.com/ntoff/raspi-shutdown the raspberry pi hardware shutdown button, instead of shutting down the raspberry pi it will cancel the active print. Wiring it up remains the same, so see the readme in the link.

Obviously since this is a hardware button attached to your raspberry pi IT WILL NOT ASK FOR CONFIRMATION BEFORE SENDING ANYTHING, although this should be obvious I feel there will be someone who complains they accidentally hit the button and cancel a print. The solution is to just not accidentally hit the button.

No responsibility will be taken for lost prints, broken raspberry pi's, fires, brimstone, the world ending, or your wife leaving you. Use this at your own risk, the information here is for educational purposes only, etc, etc.