Created
July 24, 2010 17:54
-
-
Save bretthoerner/488852 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# credit: http://news.ycombinator.com/item?id=1543915 | |
# in ipythonrc: | |
# execfile copy_and_paste.py | |
def copy(data): | |
from subprocess import Popen, PIPE | |
Popen(["xclip", "-selection", "clipboard"], stdin=PIPE).communicate(str(data)) | |
def paste(): | |
from subprocess import Popen, PIPE | |
return Popen(["xclip", "-selection", "clipboard", "-o"], stdout=PIPE).communicate()[0] | |
def ep(): | |
return eval(paste()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment