Stack

Link

I just wrote a small and very simple service that lets you remotely push and pop items from a file.

This is a relatively useless small project, but I had fun doing it, and I keep doing small projects in Golang to get better at the language. This is a typical case where I had a very small problem and a very silly idea, and decided to write a web service. Not a great way to solve a problem, but it was fun!

I was going through my ebook collection to find something fun to read, when I found a book that I really wanted to get back to: C++ Software Design by Klaus Iglberger (not affiliated).}

How could I possibly remember this without a simple, remote and most importantly self hosted little service that I could use as my personal stack of messy papers on a virtual desk? Enter Stack, which is a service that can serve as just that, and perhaps other things?

I wanted to keep Stack as simple as possible so that I could write it in a single night (I spent two). It stores data in a file that it reads from and truncates back whenever there is a read. This means that whenever you get an item, it is deleted: This of course prompts you to actually read / do the thing, since it is now only in your hands, and no longer stored remotely. Of course, you can put it back on the stack if you want to procrastinate further.

The project uses no third-party dependencies, and tries to be as idiomatic as possible. The one weird thing about Stack that I decided to leave in is that it uses fixed-size memory pages when writing to and reading from the database file. This is done to make it easy to read and truncate the file, without having to page through the whole thing. This optimization would only matter if the stack became absurdly large, so it is definitely unwarranted, but I thought it was fun to implement so I left it in.

Have fun with Stack, if you decide to use it. Do NOT use it for anything bad.