<h1 id="haste">Haste</h1>
<p>A walk through of installing haste as an open source federated pastebin.com alternative.</p>
<p>See the project at <a href="https://hastebin.com/">hastebin.com</a></p>
<p>I ran into project this while following John Kulp’s notes on his <a href="https://www.youtube.com/watch?v=gr1FZ2F7KYA">blather intro</a>.</p>
<h2 id="installing-node.js">Installing node.js</h2>
<p>Installing via a package manager. See <a href="https://nodejs.org/en/download/package-manager/">nodejs website</a> for most up-to-date information. Commands given below are just for reference.</p>
<p>RedHat based systems</p>
<pre><code>curl --silent --location https://rpm.nodesource.com/setup | sudo bash -
sudo yum install -y nodejs</code></pre>
<p>Debian based systems</p>
<pre><code>curl --silent --location https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs</code></pre>
<h3 id="upgrade-npm">Upgrade npm</h3>
<pre><code>npm install npm -g</code></pre>
<h2 id="haste-server">haste-server</h2>
<p>Take a look at the haste-server project on <a href="https://github.com/seejohnrun/haste-server">github</a></p>
<h3 id="clone-haste-server-git-repository">Clone haste-server git repository</h3>
<pre><code>git clone https://github.com/seejohnrun/haste-server.git
cd haste-server</code></pre>
<h3 id="choose-storage-method">Choose storage method</h3>
<p>Choices</p>
<ul>
<li>file system</li>
<li>redis</li>
<li>memcached</li>
</ul>
<p>If you will be using the file system storage method, delete storage section in config.js using your favorite text editor.</p>
<h3 id="install">Install</h3>
<pre><code>npm install
npm start &amp;</code></pre>
<h3 id="use-server">Use server</h3>
<p>You can now browse to your new haste-server at the server name or ip at port <code>7777</code>. Follow the icon links on the page for usage.</p>
<pre><code>https://&lt;servername&gt;:7777</code></pre>
<h2 id="using-shell-to-add-content">Using shell to add content</h2>
<p>Create a bash alias to pipe files to the haste file server.</p>
<p>Add the following to your <code>.bashrc</code> file:</p>
<pre><code>HASTE_SERVER=&#39;https://myserver:7777&#39;
haste() { a=$(cat); curl -X POST -s -d &quot;$a&quot; $HASTE_SERVER/documents | awk -v server=&quot;$HASTE_SERVER&quot; -F &#39;&quot;&#39; &#39;{print server&quot;/&quot;$4}&#39;; }</code></pre>
<h2 id="references">References</h2>
<ul>
<li><a href="https://hastebin.com/">hastebin.com</a></li>
<li><a href="https://nodejs.org/">nodejs</a></li>
<li><a href="https://github.com/seejohnrun/haste-server">haste-server</a></li>
<li><a href="https://github.com/seejohnrun/haste-client">haste-client</a></li>
<li><a href="https://github.com/seejohnrun/haste-client#lightweight-alternative">haste-client-bash</a></li>
</ul>
