-
-
Save k0s/1111831 to your computer and use it in GitHub Desktop.
stdin-to-pastebin script by @catlee
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/env python | |
import urllib, sys | |
if len(sys.argv) == 2: | |
url = "http://%s.pastebin.mozilla.org" % sys.argv[1] | |
fmt = sys.argv[1] | |
else: | |
url = "http://pastebin.mozilla.org" | |
fmt = "None" | |
body = sys.stdin.read() | |
params = [ | |
('parent_pid', ''), | |
('code2', body), | |
('poster', ''), | |
('expiry', 'd'), | |
('paste', 'Send'), | |
('format', fmt), | |
] | |
data = urllib.urlencode(params) | |
req = urllib.urlopen(url, data) | |
print req.geturl() |
Actuallly, it should be #!/usr/bin/env python2 :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shebang should be #!/usr/bin/env python