Re:Shortly: a Serverless Pastebin Service - All Data is Stor...
by roryokane on Sunday May 12, 2013 @08:16PM
(#5696495)
I’m sure it would be possible. You’d have to embed the CSS and JavaScript in https://github.com/lucaspiller/shortly into an HTML page, then represent that page as a data: URI. You could leave out the text-compression code and include only the decompression code, because the page only needs to decompress its embedded message. You would minify the code so there is less of it to store in the URL. You might even be able to shorten the URL by having the page bootstrap itself – DEFLATE all code except the code for INFLATEing, then INFLATE on the rest of the code for displaying the text, then run that code to INFLATE the text itself and display it.
Alternatively, you could just give someone a Shortly link and write a note next to it saying “If that link doesn’t work, just run that URL’s hash fragment through Base64-decode followed by INFLATE”, relying on the user to search for suitable software in that case. That would not help a user who is offline, unless their OS comes with utilities for those algorithms, but it would help if you’re just worried about Shortly going down.
Re:Shortly: a Serverless Pastebin Service - All Data is Stor...
by habosa on Sunday May 12, 2013 @08:12PM
(#5696485)
Absolutely. See https://news.ycombinator.com/item?id=5696462. Basically just add some HTML and JavaScript to the link with the encoded content and you're good to go. But as I said in another comment, at that point you're just sending the text itself over the wire in a convoluted way without much space savings. At that point I'd just use some public key encryption and post the content directly (PGP?)
Re:Shortly: a Serverless Pastebin Service - All Data is Stor...
by shawnz on Tuesday May 14, 2013 @11:48PM
(#5710057)
> at that point you're just sending the text itself over the wire in a convoluted way without much space savings
Yes, in fact, with the solution linked, it's an increase in space requirements! In my experience, even with a traditional pastebin, the problem isn't being able to get the data over the wire -- it's formatting it. Also, this service opens up the possibility of (ab)using link shorteners for storage.
Re:Shortly: a Serverless Pastebin Service - All Data is Stor...
by sciencerobot on Sunday May 12, 2013 @08:01PM
(#5696463)
Hmmm.. Something like
cat data.txt | ruby -ne 'require "uri"; print URI.escape($_)' > encoded.txt
EDIT: Looks like another commenter has already developed a solution :)