Mark Rober engineered a device to surprise people who steal packages from his front porch. His video explaining the device, and showing what happened, is satisfying to watch:
UPDATE (December 20, 2018): Not all was as it seemed. Some of the robbers were not genuine robbers, says Rober.
BONUS: The special Miscreant Trapping issue of the Annals of Improbable Research presents many other clever devices, by many clever people, to trap miscreants.