

Show HN: elegant open-source pastebin server (node.js & redis) - seejohnrun
http://hastebin.com

======
andrewvc
Very cool! You've easily written the best UI for this kind of thing I've yet
seen (though a language syntax picker would be nice).

Quick question though, why redis vs something disk based? Are you worried that
if this sees a lot of usage you'll hit memory limits? Seems like a great
application for a disk based KV, or just plain SQL.

~~~
seejohnrun
Hey - Thanks for the comment.

You can set the language by just changing the extension in the URL, if it
guesses wrong.

the open source project also has an optional disk store you can use in place
of redis (<http://github.com/seejohnrun/haste-server>), but my hosted version
uses the redis store.

Thanks again!

~~~
cabacon
For what it's worth, changing the extension doesn't seem to work for me. A
simple C program (<http://hastebin.com/36QWBlYlML>) gets detected as TeX.
Trying to change the <http://hastebin.com/36QWBlYlML.tex> to
<http://hastebin.com/36QWBlYlML.c> just redirects me back to the .tex URL.

Also, while I am entering a file, the edit box is only two lines long, and I
can't see the handle to resize it. This is Safari 5.1.1 on Snow Leopard.

Looks nice!

~~~
seejohnrun
Heya - just didn't have the .c extension in the mapping. Will add it in
tonight and get it out. Thanks!

~~~
jurre
While you're at it, changing the extension seems to break the back button in
Chrome and Safari on OSX.

~~~
wahnfrieden
I haven't tried reproducing this, but it sounds like he's setting redirects
based on GETs. A bad idea all-around, and not only for breaking the back
button in this case.

------
antirez
Since the author is using Redis for a system like that, I wanted to do some
math about how many documents it can store for gigabyte.

Assuming a 64 bit instance (that is more memory hungry) and that the average
paste size is 512 bytes, every 2 million documents require 1GB (just tested
with redis-benchmark).

This means that if you have a paste every minute, in order to use 1 GB of
memory you need to wait 4 years.

Many problems that at a first look appear to be hard to treat with an in-
memory DB at a closer look appear quite addressable.

That said this is the kind of problem where the working set is very small
compared to the whole set of documents stored, and where documents are rarely
written and often accessed in a read only fashion, so a *SQL DB would work
super well for that use case.

I Redis server could form a very good addition in order to perform real time
stats about the accesses to the document: number of times the document was
read, a sorted set for latest created documents, top documents for this month
by page views, and so forth.

~~~
seejohnrun
More related to the central topic of redis as a store for this, I think it
really depends on the read per write ratio. Gathering stats like this would be
very useful, and its very easy to write a SQL adapter for haste-server, since
its just a set/get and optional expire

~~~
antirez
In theory in a pastebin-alike site you can have a lot of writes for the
analytics. think about a pastebin page appearing on HN or other very busy
site, if you want to do real time stats Redis will handle the load without
issues.

------
alttag
Something isn't working right for me.

There's no affordance suggesting what to do. If I start typing, I only get two
lines of visible text. If I enter more than two lines, the top line(s) scrolls
out of view. this doesn't seem to be intended behavior given all the "white"
space on the page. When saved, a multi-line bin seems to work normally.

In a quick check, it seems all resources are loading. Safari 5.1.1; OS X
10.7.2. (Tried with extensions, e.g., AdBlock, off too.)

~~~
seejohnrun
Fixed now - sorry for the inconvenience :)

~~~
alttag
The two lines visible part is fixed, but there's still no affordance
suggesting how to use the site.

The current design targets users who're familiar with other bin sites, and is
less friendly to new users.

------
seejohnrun
server: <http://github.com/seejohnrun/haste-server> client:
<http://github.com/seejohnrun/haste-client>

more info: <http://hastebin.com/about.md>

~~~
VikingCoder
Nice idea on the CLI client.

~~~
seejohnrun
thanks :)

------
malone
Nice work. I've been looking for a pastebin server to run on our internal
network for a while now and this certainly seems like a winner.

Would be useful if there was an option to enable line numbering. Not sure if
this would go against the minimalist style you're going for though.

~~~
seejohnrun
definitely a good idea, i'll try to think of a way to add it but keep the
minimalist approach. I'll file a ticket on github for this and get to it very
soon

------
TomGullen
Very nice! It seems about as simple as it could be. One suggestion though, my
resolution is quite high and I hate looking to the extremities of my monitor.
I don't know how you could solve it nicely but just some feedback!

~~~
seejohnrun
Wouldn't you just make the browser window smaller?

~~~
TomGullen
Not if it's a tab with my other pages

------
joe-mccann
Nice one. This is actually what I'm adding to Dillinger next - a Redis store
for pastebin style links to markdown files.

dillinger.io

Dillinger is also 100% open source:

github.com/joemccann/dillinger

~~~
seejohnrun
Awesome - I ended up writing a markdown extension for highlight.js (also OSS)
to support the about page

i'm definitely gonna check out dillinger

------
rossmasters
For some reason on Chrome 15 (stable) the body is about 32 pixels high,
meaning you can type two lines. Other than that it works nicely.

~~~
seejohnrun
Fixed - sorry

------
mjdwitt
In chromium on linux, I can only ever see two lines of text at a time. If I
type more than two lines, they scroll off the top of the screen. When I move
back up with the arrow keys, I can see those lines again, but I still only see
two lines; those further below just disappear until I move back down.

~~~
seejohnrun
Fixed, sorry

------
_neil
As complex as it needs to be. Great project. Now I just wish I had an
immediate need for an internal pastebin.

------
swah
For some reason, node.js programmers are better than average designers, so
their websites look slick - but that has nothing to do with running the
website on node.js...

Okay, they know javascript, that helps...

But it makes node.js __feel __slick... a great marketing trick.

------
drewda
Can you please add support for CoffeeScript highlighting?

[https://github.com/jashkenas/coffee-script/wiki/Text-
editor-...](https://github.com/jashkenas/coffee-script/wiki/Text-editor-
plugins)

EDIT: Sorry, I should post this as a Github issue instead...

~~~
seejohnrun
Definitely - thanks for putting in the issue, and we'll get it in as soon as
possible

------
sheldor
Nice, clean and minimal. Kudos!

There's just one little glitch : In IE9, icons are not shown correctly and a
javascript error is raised whenever you try to perform an action , or visit a
url you just "generated"

~~~
seejohnrun
Heya - I didn't really test in IE, but tonight I'll get it updated and fixed
for IE9. Thanks for the feedback

~~~
emp_
You just need to provide a doctype (the html5 one is fine), IE9 is currently
rendering your site as Quirks Mode.

~~~
seejohnrun
Awesome - added and deployed. Thanks!

------
cel
I'm not able to save documents right now. The POST to /documents returns a 502
Proxy Error (Error reading from remote server) after 2 minutes. Backend is
down?

~~~
seejohnrun
should be fixed - sorry for the inconvenience, was upgrading a few things

~~~
cel
Got it, thanks. Great project!

------
false
Awesome!

However, when I type/paste i can see only the last line of text, it's somehow
confusing. Why not to make textarea take whole height?

~~~
seejohnrun
Fixed sorry, temporary bug

------
jvc26
Lovely work - really elegant and simple pastebin server! Wondered whether you
could add syntax highlighting for Puppet config files (.pp)?

~~~
seejohnrun
Thanks - glad you like it :) If you can submit a ticket on github for .pp
highlighting I can get it in, by writing a highlight.js adapter for puppet
config files

------
jurre
That is really awesome! It detects my erlang and syntax highlights it
beautifully! Very nice, will be using this for all my pastebinning!

------
zmanji
The use of the solarized colorscheme is wonderful.

------
shocks
I really like this. Would it be possible to have show a short summary of the
history of a paste? Also, a favicon would be great. :)

~~~
seejohnrun
When you edit a paste, you create a new one - so the history thing is rough.

The favicon is a great point and I'll get one together ASAP

------
nuttendorfer
Request: Don't override Ctrl + L, I don't want to have to use the mouse to
copy the link. Ctrl + L, Ctrl + C is faster.

~~~
seejohnrun
Will remove that tonight and redeploy. Used to be before I switched over to ^S

------
plq
Unless I'm missing something, you've made your tracker practically
unsearchable. How do you plan to cope with that?

~~~
seejohnrun
Probably no plans to - this is really meant to address the primary use of a
pastebin in a more elegant way. I think search is just bloat here

------
jwmollman
Very clean and elegant. I like this a lot!

------
LuxuryMode
Pretty cool and great name. Only thing is that (when I tried Java) the syntax
highlighting wasn't all that great.

~~~
seejohnrun
The syntax highlighting will be constantly improving given changes to
highlight.js (another OSS project), and a possible move to pylons. Thanks for
the feedback, and I'll take a look at the Java highlighter and see what I can
do to make it better. Any obvious things you'd like to see in the
highlighting?

------
potomak
I love it, maybe I should contribute...

------
kqueue
Line numbers missing.

------
g3orge
the best implementation of the idea... very useful.

------
danso
Love this feature:

\---

You can even take this a step further (on OSX) and cut out the last step of
copying the URL with:

`cat something | haste | pbcopy`

After running that, the STDOUT output of `cat something` will show up at a URL
which has been conveniently copied to your clipboard.

That's all there is to that, and you can install it with `gem install haste`
right now.

\-----

Out of curiosity, why is that only possible on a Mac OS X setup with the Ruby
gem? Is it only because Ruby is pre-installed?

~~~
seejohnrun
You can do it on linux too:

gem install haste cat something | haste | xsel

I'll add that to the /about.md page tonight

Thanks - glad you like it! :)

------
MostAwesomeDude
Requires JavaScript just to show the front page or about page. This instantly
makes it worse than other pastebins. Cool design, poor execution.

