Pastebin
Here's a quick script I wrote to submit data to my pastebin from the terminal. I'm afraid the code isn't very well commented (or in fact commented at all), but its all fairly straightfoward. I've also written a C# application for folk in windows (might be able to run it under mono but probably not as its using windows forms).
#!/usr/bin/python import urllib import sys import getopt optstring = "f:c:t:e:h" longopts = ['file=','title=',"command-line=",'expire-time=',"help"] try: opts, args = getopt.getopt(sys.argv[1:],optstring,longopts); except: print str(err) usage() sys.exit(1); def usage(): print """Usage: Using no command line arguments will accept content from STDIN. -f <file> Pastes the contents of a file. -c <string> Pastes the string from the command line.""" def postString(string,title): stripped = string.strip(); if(len(stripped) > 0): sys.stderr.write("Submitting...\n"); data = urllib.urlencode({"paste" : string,"title":title,"expireTimeHour":expireTime}) con = urllib.urlopen("http://paste.harryrose.org/pastes/",data) print con.geturl() else: sys.stderr.write("The pasted data didn't contain any text.\n"); def postFromStdin(title): output = "" for line in sys.stdin: output += line postString(output,title); def postFromFile(filename,title): output = "" for line in open(filename, "r"): output += line postString(output,title); def postFromCommandLine(title): output = "" for arg in sys.argv[2:]: if(len(output) != 0): output += " " output += arg; postString(output,title); def determineSource(): if(len(sys.argv) == 1): return 1 elif(sys.argv[1] == "-f" and len(sys.argv) == 3): return 2 elif(sys.argv[1] == "-c" and len(sys.argv) >= 3): return 3 else: return -1 title = ""; expireTime = 3; source = "stdin"; for o, a in opts: if(o in ("-h","--help")): usage(); sys.exit(0); elif(o in ("-f","--file")): postFromFile(a,title); source = file; elif(o in ("-t","--title")): title = a; elif(o in ("-e","--expire-time")): try: expireTime = int(a); except: print "Error: expire time is not a valid number. using default."; if source == "stdin": postFromStdin(title)