Created
July 5, 2012 11:06
-
-
Save yuryu/3053028 to your computer and use it in GitHub Desktop.
Mac pbcopy helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bufferfile "$HOME/screen-exchange" | |
bind ^] eval 'writebuf -e utf8' 'exec sh -c "cat ~/screen-exchange | ~/invoke-pbcopy.sh"' 'echo pasted.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function concat_passphrase() | |
{ | |
echo 'SECRET-PASSPHRASE' | |
cat - | |
} | |
concat_passphrase | nc -w1 localhost 12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>localhost.pbcopy</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/yuryu/safe-pbcopy.rb</string> | |
</array> | |
<key>inetdCompatibility</key> | |
<dict> | |
<key>Wait</key> | |
<false/> | |
</dict> | |
<key>Sockets</key> | |
<dict> | |
<key>Listeners</key> | |
<dict> | |
<key>SockServiceName</key> | |
<string>12345</string> | |
<key>SockNodeName</key> | |
<string>127.0.0.1</string> | |
</dict> | |
</dict> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
SHARED_KEY = 'SECRET-PASSPHRASE'; | |
key = gets | |
exit if key.chomp != SHARED_KEY | |
IO.popen('sh -c "LANG=en_us.UTF-8 pbcopy"', 'w') do |pb| | |
while line = gets | |
pb.puts line | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host * | |
RemoteForward 12345 localhost:12345 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment