Sunday, July 10, 2016

Hastebin - Easy way to share your codes, snippets.


A web-based service for storing and sharing text and code snippets can come in handy in many situations. And if you prefer to use an open source solution for that, Hastebin got you covered. Hastebin's web interface is simplicity itself, and it gives you commands to create a new text snippet, save the current snippet, and open existing snippets for editing. By default, Hastebin treats snippets as Markdown-formatted text, but you can use the Just Text command to edit the snippet as plain text. When you save the snippet you can share it by giving other users its URL, and you can post the URL via Twitter.
The Hastebin server software is based on Node.js, and you can easily deploy a self-hosted Hastebin instance on your own server. While you can use the web interface to add and manage snippets, the dedicated Hastebin command-line utility makes it possible to push snippets to the server from the terminal. The utility is written in Ruby, and if you don't feel like fiddling with RubyGem, you can opt for a simple Bash shell one-liner:
haste() { a=$(cat); curl -X POST -s -d "$a" http://hastebin.com/documents | awk -F '"' '{print "http://hastebin.com/"$4}'; }
To use it, run the following command which pushes the contents of the foo.txt file to the Hastebin server:
cat foo.txt | haste

Source: http://www.linux-magazine.com/Online/Blogs/Productivity-Sauce/Hastebin-An-Open-Source-Alternative-to-Pastebin

No comments:

Post a Comment