Sometimes, I need to share a binary file, such as a screen shot, or a tarball.
For that, I wrote the pbput (and pbget) scripts!
The pbput script works on either standard in, or a file argument, lzma compresses the input, base64 encodes it, and then uses pastebinit to post to pastebin.com.
And the pbget script basically reverses that process, using wget to retrieve the remote data, base64 decoding it, lzma decompressing it, and writing it to standard out.
Try it for yourself!
pbput /tmp/Screenshot.png
http://pastebin.com/c9JtQ4WT
pbget http://pastebin.com/c9JtQ4WT > /tmp/out.png
md5sum /tmp/*png
f7e7ba26a2681c0666ebca022c504594 /tmp/out.png
f7e7ba26a2681c0666ebca022c504594 /tmp/Screenshot.png
If you find this useful, install the bikeshed package from Natty, or from the Bikeshed PPA for other versions of Ubuntu.
:-Dustin
I love pastebinit as well. My only gripe is that it uses pastebin.com by default. I prefer paste.ubuntu.com as it's much cleaner.
ReplyDeleteI've filed a bug for it, so hopefully Stephane will take it into consideration (https://bugs.edge.launchpad.net/ubuntu/+source/pastebinit/+bug/648298).
This is really cool! However, I was really hoping for an easter egg.
ReplyDeleteSweet!
ReplyDeleteHow are you dealing with size-limited pastebins ?
If I remember well, a lot of them don't let you post something longer than x hundreds of lines.
stgraber-
ReplyDeleteIt only supports pastebin.com right now, which has a ~1MB limit. I could make that configurable, I suppose.
BTW, would you be interested in taking this (or implementing this concept) in pastebinit? My scripts are shell, and pastebinit is python, which is the only reason I haven't sent it to you yet...
:-Dustin
Brian,
ReplyDeleteHere you go:
* http://pastebin.com/dkW2Z0xK
:-Dustin
Hey Mario,
ReplyDeleteYeah, I agree. I have had this in my .bashrc for the last few years:
alias pastebinit='pastebinit -b http://paste.ubuntu.com'
Unfortunately, I can't use paste.ubuntu.com for pbput/pbget because the raw download is behind an openid auth.
:-Dustin