Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: elegant open-source pastebin server (node.js & redis) (hastebin.com)
131 points by seejohnrun on Nov 29, 2011 | hide | past | favorite | 68 comments



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.


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!


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!


Also, clicking on the .c link breaks the back button, because it redirects to the .tex link before I can click back again.


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


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


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.


vvv wahnfrieden

will be fixed tonight


this syntax changing by changing the extension is really clever, is it in the haste-server codebase?



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.


I think it would be a really interesting project to get together a way to gather statistics like this. I'm particularly interested in seeing things like average reads per doc, interval between reads, etc (like you mention).

Thanks for the research, and look forward to more coming out in the way of statistics soon!


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


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.


What about a Redis feature where you could mark a key as swappable? Hot keys could stay in memory, cold keys could stay on disk. This would work great with append-only mode, in essence like BitCask.


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.)


Fixed now - sorry for the inconvenience :)


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.



Nice idea on the CLI client.


thanks :)


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.


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


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!


Wouldn't you just make the browser window smaller?


Not if it's a tab with my other pages


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


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


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?


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! :)


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.


Fixed - sorry


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.


Fixed, sorry


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


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.


Can you please add support for CoffeeScript highlighting?

https://github.com/jashkenas/coffee-script/wiki/Text-editor-...

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


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


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"


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


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


Awesome - added and deployed. Thanks!


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?


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


Got it, thanks. Great project!


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


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


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


The use of the solarized colorscheme is wonderful.


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. :)


Favicon is super important if this is to sit pride of place on my bookmarks bar and be my go to pastebin (which I would love it to be!)


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


Could also start tracking when edits get created as history - i'll look into this


favicon is out now. thanks again for the suggestion


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?


Fixed sorry, temporary bug


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.


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


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


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


ha! wrong thread. please disregard this comment, can't seem to delete it.


Very clean and elegant. I like this a lot!


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


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?


I love it, maybe I should contribute...


Line numbers missing.


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


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: