Live data from Hacker News

Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

github.com

131–140 of 182 posts

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#132
post #128

Earlier quoted context omitted.

Any particular reason why you wrote 1 rather than 0?

Not really. Copied it from somewhere else where the placeholder value was 7. 1 came to my mind before 0. Zero seems like it could be UB.

Nah, zero just means “redirect after zero seconds”, meaning immediately. You definitely want zero.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#133
post #131

If you're using github pages you should just structure jekyll such that you can edit data/_links.yml instead of having thousands of users wasting compute power for github api when its not necessary

I would suppose doing a push every time a new URL is added would be quite expensive for GitHub too. Plus, GitHUb pages is not updated immediately upon push and it takes some time for new links to work. That being said, this is definitely not the most realistic implementation of a URL shortener. It is meant to be cool and hacky and definitely not used for production!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#134
post #129

I was always fixated with URL shorteners and always wanted to write one myself. While it would be easy to write one that works with a server, I loved the idea of hosting and running one for free. Thus, I wrote this URL shortener which does not need a backend to work at all. It uses GitHub issues as a "database", and unlike most other URL shorteners that do not need backends, this one doesn't need a # prefixed to the…

"I was always fixated with URL shorteners and always wanted to write one myself. While it would be easy to write one that works with a server, I loved the idea of hosting and running one for free." I felt exactly the same way and did, in fact, build one.[1] It was pretty simple. There's an interesting twist to the particular one I built - it's not specifically a URL shortener, it's a "Universal Shortener".[2] Also no…

Oh that is cool! It does remind me of https://telegra.ph/ by Telegram! (Even though they weren't really advertising it as a universal shortener). Just a quick question, how did you promote your platform!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#135

I was expecting it to be a way of taking a URL and converting it to a base64 type of format that is stored on the "url" itself and decoded by a simple web page. I have wanted to try to do this for a while, but never saw down to look for an appropriate encoding that somehow also compresses. I helped someone design a regular URL shortener in PHP before, they're not complicated to implement with a simple MySQL (or even…

Why would you need a database for that?

I realize I misspoke and update my message about why we used a database. I helped someone do a regular URL shortener, but have always been curious about doing a databaseless / no I/O on any server whatsoever based shortener.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#136

I was expecting it to be a way of taking a URL and converting it to a base64 type of format that is stored on the "url" itself and decoded by a simple web page. I have wanted to try to do this for a while, but never saw down to look for an appropriate encoding that somehow also compresses. I helped someone design a regular URL shortener in PHP before, they're not complicated to implement with a simple MySQL (or even…

Base64 would probably be longer than the original URL. I can't really see how short pieces of text (like URLs) could be compressed to become smaller. That being said it's definitely a cool concept! I once worked on a code playground kinda thing for my school and there was a function to share the code written in a URL. How we did it was just to include the whole piece of code as a URL param in base64!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#137
post #118

Earlier quoted context omitted.

Just like serverless still has servers, this can be reasonably called dbless :)

Essentially this is the promise of the blockchain. Imagine one massive global database where anyone can store anything in encrypted form. Free, forever.

I was under the impression that you paid for a transaction. That wouldn't be free, would it?

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#138

> Unlike many URL shorteners, this one does not need a database and can be entirely hosted on GitHub pages. it does need a database though. it just uses someone else's database

A URL shortener can be done with no database - I did it using only Lambda functions once, but I wouldn't recommend it. :) https://kevinkuchta.com/2018/03/lambda-only-url-shortener/

I've seen people suggest using pi as a "database." In this instance you could map ranges of pi to characters. Then you search pi until you find the right range. The URL would contain the range(s) needed.

This is terrible and so computationally wasteful. But it's interesting to think about.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#139
post #137
post #118

Earlier quoted context omitted.

Essentially this is the promise of the blockchain. Imagine one massive global database where anyone can store anything in encrypted form. Free, forever.

I was under the impression that you paid for a transaction. That wouldn't be free, would it?

Paying puts your transaction near the head of the queue. This matters more when there's a backlog. If you're willing to wait for things to clear up, you don't need to pay. https://bitcoinfees.net/

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#140

Earlier quoted context omitted.

A URL shortener can be done with no database - I did it using only Lambda functions once, but I wouldn't recommend it. :) https://kevinkuchta.com/2018/03/lambda-only-url-shortener/

I've seen people suggest using pi as a "database." In this instance you could map ranges of pi to characters. Then you search pi until you find the right range. The URL would contain the range(s) needed. This is terrible and so computationally wasteful. But it's interesting to think about.

In a similar vein, almost every algorithm can be converted into a O(1) space version simply by converting it into the dumbest possible search algorithm over the solution space: just sample from the solution space randomly (with a seeded PRNG or something) until you get the right answer.

A well-known example of this is bogosort: https://en.wikipedia.org/wiki/Bogosort

Post reply on HN