Tonight I had a flash of inspiration: iptables lets you do all sorts of packet-mangling trickery, including capturing TCP connections destined for a particular host. So I give you unplug: when you run it, it hijacks all connections to a list of hosts, making any attempt to load their pages instead serve you a page that says "FOCUS". When you kill it, it puts things back to normal.
In any case, the code is shorter than its description, so if you wanted to do something similar yourself, the only part that takes a bit of time to figure out is:
iptables -t nat -A OUTPUT --destination hostname --protocol tcp --jump REDIRECT --to-ports portnum
To list the rules,
s/-A.*/-L/. To remove it,
The REDIRECT target only works on the nat table. For more complicated redirecting there's also a DNAT target that'll let you redirect to a different host.