Blog Software Updates

Published: 2020-04-25
Tagged: legacy-code software news

A few weeks ago, I decided my blog needs a face lift.

I use a simple static site generator that I wrote a few years ago: wintersun. With a one-line change, I collapsed the separate blog and essay sections into one and updated each post to be a "Post" using grep, xargs, and sed. I tweaked the css file to add a bit of color by adding a few borders here and there. I also updated the about me page with more relevant information. I also removed some junk, like google analytics and a newsletter signup form, that weren't really doing anything for me at this moment, which cut down the size of javascript and styles to download by a lot.

The most exciting part is that I added comments to each post! I still wanted my blog to remain a collection of html files and I didn't want to use a "cloud" solution like disquis. I wrote a very simple comment server in Golang with 3 HTTP endpoints: get comments for a post, submit a comment, and report health status. The comments are kept in an in-memory map, which a goroutine periodically saves to disk. No database needed, weeee! I added two simple protections against spam. The first is a rotating key. Nothing fancy, just something unique that won't be worth the effort to dig into by script kiddies. The second is nginx rate limiting. Finally, I added a sprinkle of html and javascript to actually submit the comments. I used to like jquery a lot before I shifted away from web-dev and I found that umbrellajs, at only 3kb, was easy to work with and saved me re-learning the built-in js apis.

The emphasis on simplicity comes from the same reason why I wrote my own static site generator in 2015: minimizing maintenance. With no 3rd-party dependencies except umbrellajs, I don't have to upgrade anything and I don't have to learn new APIs, which means that making changes or moving servers is a breeze.

After cleaning off the cobwebs, I'm also really fired up about writing more :).

Comments

There aren't any comments here.

Add new comment

A code cave is a series of null bytes in a process's memory.

Programming, exploring, tinkering, philosophizing.

All views expressed are my own.