Skip to content

Instantly share code, notes, and snippets.

@PeterRincker
Last active December 24, 2020 15:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PeterRincker/8fab6296b6905793e284e84aba7041bc to your computer and use it in GitHub Desktop.
Save PeterRincker/8fab6296b6905793e284e84aba7041bc to your computer and use it in GitHub Desktop.
Exposing your clipboard over SSH
#!/bin/bash
# Run this on your local machine
# gist: https://gist.github.com/dergachev/8259104
echo "When connected via ssh:"
echo " type ~C"
echo " -R 5556:localhost:5556"
echo ""
echo " Send data via `nc localhost 5556`."
echo " e.g. `cat foo.txt | nc localhost 5556`"
echo ""
# display number of characters recieved
while (true); do nc -l 5556 | pbcopy; pbpaste | wc -c; done
" Add line to remote vimrc file
" :[range]Y - send [range] lines to remote-pbcopy via netcat.
command! -range Y silent <line1>,<line2>w !nc localhost 5556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment