Turning off lamps and alarm clocks by your bed in the dark is never easy. If you’re skilled in electronics though, you could do it just by knocking on your nightstand.
You’ll need to be comfortable working off an electronics schematic to do this yourself. You’ll even be playing around with mains voltage here, so please be especially careful. If you’re comfortable trying this project though, the result is nothing short of awesome. The build uses an Arduino to detect knocks on any flat surface, and toggle power to the two outlets on the box. No more fumbling for a tiny light switch! If you want to try it yourself, check out the Instructable for a complete schematic and instructions.
The Knock Box: Build a Knock-Sensitive Power Strip | Instructables