An easy Pastebin-like service with a command line client

Let me introduce you to Hastebin.

It is a simple pastebin service that you can self-host.

Server

The server bits are available at https://github.com/seejohnrun/haste-server.

I personally use this Docker container: https://hub.docker.com/r/mkodockx/docker-pastebin

Client

The awesome part is that you can paste from the command line!

You have two choices: using gem or a simple bash alias that doesn’t require you to install anything (besides curl).

Using Gem

gem install haste

Create an alias in your .bashrc or .zshrc config:

alias pastebin="HASTE_SERVER=https://your-haste-server.com haste"

Restarting your session or source your config file.

Client sources

Using a bash alias

pastebin() { a=$(cat); curl -X POST -s -d "$a" https://your-haste-server.com/documents | awk -F '"' '{print "https://your-haste-server.com/"$4}'; }

Demo

echo blah | pastebin
https://your-haste-server.com/ecikubicuk



Thanks for reading this post!


Did you find an issue in this article?

- click on the following Github link
- log into Github with your account
- click on the line number containing the error
- click on the "..." button
- choose "Reference in new issue"
- add a title and your comment
- click "Submit new issue"

Your feedback is much appreciated! πŸ€œπŸΌπŸ€›πŸΌ

You can also drop me a line below!