pb is a lightweight pastebin (and url shortener) built using flask.
Create a new paste from the output of cmd:
cmd | curl -F c=@- http://mpy.app/
A HTML form is also provided for convenience paste and file-uploads from web browsers.
The pb_cli is also available for maximum convenience pastes from your terminal.
No really, how in the name of Gandalf's beard does this actually work? Show me!
Create a paste from the output of 'dmesg':
$ dmesg | curl -F c=@- http://mpy.app/ long: AGhkV6JANmmQRVssSUzFWa_0VNyq sha1: 686457a240366990455b2c494cc559aff454dcaa short: VNyq url: http://mpy.app/VNyq uuid: 17c5829d-81a0-4eb6-8681-ba72f83ffbf3
Or, if you only care about getting the url back:
$ dmesg | curl -F c=@- http://mpy.app/?u=1 http://mpy.app/VNyq
Take that paste, and replace it with a picture of a baby skunk:
$ curl -X PUT -F c=@- http://mpy.app/17c5829d-81a0-4eb6-8681-ba72f83ffbf3 < baby-skunk.jpg http://mpy.app/ullp updated.
Append '.jpg' to hint at browsers that they should probably display a jpeg image:
http://mpy.app/ullp.jpg
Actually, that picture is already on imgur; let's delete that paste and make a shorturl instead:
$ curl -X DELETE http://mpy.app/17c5829d-81a0-4eb6-8681-ba72f83ffbf3 http://mpy.app/ullp deleted.
$ curl -F c=@- http://mpy.app/u <<< https://i.imgur.com/CT7DWCA.jpg http://mpy.app/qYTr
Well, it is shorter..
Put my latest 'hax.py' script on pb:
$ curl -F c=@- http://mpy.app/ < hax.py long: AEnOPO7bF9Qyyt_WUltBlYWHs_-G sha1: 49ce3ceedb17d432cadfd6525b41958587b3ff86 short: s_-G url: http://mpy.app/2AcJ uuid: bfd41875-dcac-4b6b-92e9-97a55d4f8d89
Now I want to syntax highlight and draw attention to one particular line:
http://mpy.app/2AcJ/py#L-7
Perhaps we have some super sekrit thing that we don't want be be guessable by base66 id:
$ curl -F c=@- -F p=1 http://mpy.app/ < SEKRIT_hax.py long: ACCzjDcun9TqySwSUjy_yRpGxWIK sha1: 20b38c372e9fd4eac92c12523cbfc91a46c5620a short: xWIK url: http://mpy.app/ACCzjDcun9TqySwSUjy_yRpGxWIK uuid: 876e09b5-09d4-454c-8570-b627af54abd1
Witness the gloriousness:
$ curl -F c=@- http://mpy.app/~polyzen <<< "boats and hoes" long: AEz1_jLk-awIvq73RxQq_n1aQ46a sha1: 4cf5fe32e4f9ac08beaef747142afe7d5a438e9a short: Q46a url: http://mpy.app/~polyzen uuid: ab505051-0766-41dd-85d9-e739e62de58d $ curl http://mpy.app/~polyzen boats and hoes
Create a paste that self destructs in 2 minutes:
$ echo "This message will self-destruct in two minutes" | curl -F sunset=120 -F c=@- http://mpy.app/ date: 2016-03-22T17:15:50.396279+00:00 digest: 3a9c705adf9a941b175631a5e6f11eb575f067e6 long: ADqccFrfmpQbF1YxpebxHrV18Gfm short: 8Gfm size: 46 status: created sunset: 2016-03-22T17:17:50.395045+00:00 url: http://mpy.app/8Gfm uuid: 751f7e0b-7ce1-4b81-852b-57c5844e8d3a $ curl http://mpy.app/8Gfm This message will self-destruct in two minutes $ sleep 2m $ curl http://mpy.app/8Gfm date: 2016-03-22T17:15:50.396000+00:00 digest: 3a9c705adf9a941b175631a5e6f11eb575f067e6 long: ADqccFrfmpQbF1YxpebxHrV18Gfm short: 8Gfm size: 46 status: expired sunset: 2016-03-22T17:17:50.395000+00:00 url: http://mpy.app/8Gfm
Create and upload a recording using asciinema:
$ asciinema rec term.json ~ Asciicast recording started. ~ Hit Ctrl-D or type "exit" to finish. $ echo tralalalala tralalalala $ exit ~ Asciicast recording finished. $ curl -F c=@term.json http://mpy.app/ digest: f9704e9ae63bb5f5aad145a871f260557673d185 long: APlwTprmO7X1qtFFqHHyYFV2c9GF short: c9GF status: created url: http://mpy.app/c9GF uuid: 9dffb318-04f5-437c-9899-6e7c7eed04af
Then watch the playback with the t handler (http://mpy.app/t/c9GF in this case).
Like it? Try the pb_cli for maximum convenience:
command | pb pb < /path/to/file
You could further extend this by creating more shell functions around it; here's one for asciinema:
pb_rec () { asciinema rec /tmp/$$.json pb < /tmp/$$.json }
There are some native clients for interacting with pb, below are the ones we know of: