Script from the 2012 blog post How to Disable Mouse Middle Click to Paste Feature in Linux, which links to a now dead Dropbox url. Fortunately, Archive.org's Wayback Machine managed to capture one(!) snapshot of the script before it went down. So here it is, for posterity:
#!/bin/bash
while(true)
do
echo -n | xsel -n -i
sleep 0.5
done
Attention: this script will continually clear the X selection area, which means you won't be able to select text on a terminal to copy it elsewhere.