https://github.com/stefnotch/url-catpressor
Makes your URLs 300 purr-cent better
https://github.com/stefnotch/url-catpressor
url-shortener
Last synced: 4 months ago
JSON representation
Makes your URLs 300 purr-cent better
- Host: GitHub
- URL: https://github.com/stefnotch/url-catpressor
- Owner: stefnotch
- License: cc0-1.0
- Created: 2022-04-20T15:25:57.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-24T19:29:11.000Z (over 3 years ago)
- Last Synced: 2025-04-06T15:17:13.053Z (about 1 year ago)
- Topics: url-shortener
- Language: TypeScript
- Homepage: https://stefnotch.github.io/url-catpressor/
- Size: 4.85 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# URL Catpressor
[**View it in action here**](https://stefnotch.github.io/url-catpressor/)
Getting this to work involved the code being like

until I bonked it hard enough.
## Wait how does this work?
It takes a URL and then
1. Strips off the HTTP/HTTPS (= 1 bit, though the current implementation wastes an entire byte)
2. Brotli-compresses your URL (= n bytes)
3. Encodes some bytes by picking cat-words
- 256 different words, so one word encodes one byte
4. Encodes the remaining bytes by picking different letters for the cat-words
- Like for the letter `l`, there are a few [look-alikes](https://en.wikipedia.org/wiki/Homoglyph) such as `1`, `I`, `|`
- This part is very fun, because I ended up picking a fun encoding scheme...remember how binary uses 0 and 1 as its symbols? And how hexadecimal has 16 different symbols? Well, the letter-look-alikes approach has the fun property that some letters have a lot of look-alikes and others have very few. Thus, a word ends up being a cursed mixture of base 2, base 16, base 23, base 11, base 5, and more depending on the letters...
*But hey, at least I don't have to pay for a server to host a sensible backend!*
## Licensing Information
CC0 applies to my code. Sadly there are a few dependencies that I couldn't elegantly include with a package manager, where instead I copied the relevant source code and license.
Thus, those parts of the code are governed under a different license, as specified in their respective files.