depends what you mean, the hardware itself i cant give away for free, obviously. the code i i use is this
[{"id":"e5419e01.5db54","type":"rpi-gpio in","z":"fbb116ff.1b5528","name":"power-38","pin":"38","intype":"up","debounce":"25","read":true,"x":534.0173263549805,"y":499.01042461395264,"wires":[["20925837.2f7fb8"]]},{"id":"20925837.2f7fb8","type":"trigger","z":"fbb116ff.1b5528","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"2","extend":true,"units":"s","reset":"","bytopic":"all","name":"filter","x":710.017261505127,"y":496.0104112625122,"wires":[["30c8dc34.1493d4"]]},{"id":"30c8dc34.1493d4","type":"function","z":"fbb116ff.1b5528","name":"bits send","func":"var arr = msg.payload;\nif (arr == '0') {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}\n//return msg;\n","outputs":"2","noerr":0,"x":858.5173225402832,"y":497.5103635787964,"wires":[[],["d6f2f6f2.d01738","a5c144b5.cdd468"]]},{"id":"d6f2f6f2.d01738","type":"function","z":"fbb116ff.1b5528","name":"powerfailure","func":"msg.topic = \"INSERT INTO `rebooted`(`Timestamp`, `reboot`) VALUES (CURRENT_TIMESTAMP,'powerfailure')\";\nreturn msg;","outputs":1,"noerr":0,"x":1081.0173568725586,"y":511.01048278808594,"wires":[["2ae39408.dea06c"]]},{"id":"a5c144b5.cdd468","type":"delay","z":"fbb116ff.1b5528","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":863.6284484863281,"y":544.9133024215698,"wires":[["ae3aa462.861a58"]]},{"id":"ae3aa462.861a58","type":"exec","z":"fbb116ff.1b5528","command":"sudo shutdown now","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"shutdown","x":863.0173492431641,"y":595.0105800628662,"wires":[[],[],[]]}]
Best regards
Karl