I'm quite fond of hastebin.com. It's fast. It's reliable. And it's got nice keyboard shortcuts that work for my taste.
So, I created a little program to quickly throw things into hastebin. You can have one too:
~/bin/hastebinit and paste in:
#!/usr/bin/python import urllib2 import os import json URL = 'http://hastebin.com/documents' def run(*args): if args: content = [open(x).read() for x in args] extensions = [os.path.splitext(x) for x in args] else: content = [sys.stdin.read()] extensions = [None] for i, each in enumerate(content): req = urllib2.Request(URL, each) response = urllib2.urlopen(req) the_page = response.read() key = json.loads(the_page)['key'] url = "http://hastebin.com/%s" % key if extensions[i]: url += extensions[i] print url if __name__ == '__main__': import sys sys.exit(run(*sys.argv[1:]))
chmod +x ~/bin/hastebinit
Now you can do things like:
$ cat ~/myfile | hastebinit $ hastebinit < ~/myfile $ hastebinit ~/myfile myotherfile
Hopefully it'll one day help at least one more soul out there!Follow @peterbe on Twitter