- Set up and start redis server
- Enter following command in clone
git clone https://github.com/seejohnrun/haste-server.git && cd haste-server/
cat config.js #setup configuration of hastebin server port and redis server port
npm install
npm start &> /dev/null/ &
User this server IP and Port in following steps to setup command line code paste to haste-server
- Open url IP:PORT
- Do whatever you want to do
- install gem haste
gem install haste
- add alias to ~/.bash_profile
alias work_haste "HASTE_SERVER=http://<IP:PORT> haste"
- use following commands in command line
source ~/.bash_profile
cat something | work_haste
- another way without installing gem is
haste() { a=$(cat); curl -X POST -s -d "$a" http://<IP:PORT>/documents | awk -F '"' '{print "http:/<IP:PORT>/"$4}'; }
cat something | haste