changeset 158:c1390e43b437

point pastebin at pastebin.mozilla
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 28 Jul 2011 09:18:15 -0700
parents f145d7b1fbf7
children 9b81f964c524
files .fluxbox/keys python/pbmoz.py
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.fluxbox/keys	Wed Jul 27 09:58:57 2011 -0700
+++ b/.fluxbox/keys	Thu Jul 28 09:18:15 2011 -0700
@@ -65,7 +65,7 @@
 Control Mod1 l :ExecCommand echo http://letmegooglethatforyou.com/?q=$(xclip -o) | xclip -i
 Control Mod1 m :ExecCommand  xterm -e alsamixer # mixer
 Control Mod1 o :ExecCommand xclip -o | /home/jhammel/python/onelineit.py | xclip -i # put the clipboard contents on one line
-Control Mod1 p :ExecCommand xclip -o | /home/jhammel/python/pastebin.py | xclip -i 
+Control Mod1 p :ExecCommand xclip -o | /home/jhammel/python/pbmoz.py | xclip -i 
 Control Mod1 q :ExecCommand xclip -o | sed 's/^/> /' | xclip -i # quote using >'s
 Control Mod1 s :ExecCommand /home/jhammel/bin/smartopen "$(xclip -o)" # smartopen
 Control Mod1 t :ExecCommand gnome-terminal # terminal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/pbmoz.py	Thu Jul 28 09:18:15 2011 -0700
@@ -0,0 +1,26 @@
+#!/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()
\ No newline at end of file