xi
is a little tool that can copy text to your clipboard from stdin or paste text to stdout.
Copy from stdin:
echo "copy this" | xi
cat todo.txt | xi
Paste to stdout:
xi | less
xi > pasted.txt
echo `xi`
I owe this thing to kennethreitz, who wrote both clint and xerox; this script is only twenty lines because of them.