As a systems administrator, I occasionally need to run a script on a number of machines, be it to diagnose an intermittent issue, gather some ad-hoc statistics, etc. As such I have a small library of scripts, each with an aptly-named Fabric task defined in a
fabfile. Of course, each of these tasks is almost identical: copy script to remote server, run (either as a regular user, or as root). I finally tired of repeating myself, and decided to solve this once and for all (obligatory xkcd).
To wit: here is a Python snippet for turning a directory of scripts into remote-running Fabric tasks. Like magic.