Lev's Hacking Notes

Posts tagged: python

Integrating Openring into This Blog

2021-03-25 03:08:43 ][ Tags: python blogging

I just did the jenkiest thing ever.

Openring is a cool little library written by Drew DeVault which allows you to add articles from feeds that you follow to your own blog. It's kind of like a dynamic blog roll.

It was designed for static site generators, but since (for some reason) this blog is not statically generated, I was thinking of the best way to include it and came up with something that is either a horrible RCE waiting to happen, or a clever hack.

I set up a cron job to run openring every eight hours and pop the output to a file. Then in flask, I made a simple utility function to go find and read this file and insert it into a Jinja variable which is then rendered on every post page (look down at the bottom).

This allows readers to check out other interesting content and also has the added benefit of being fresh several times per day.

Bringing Back levlaz/blog

2021-03-25 00:46:17 ][ Tags: python blogging

I was so motivated by Tom's fresh start, that I decided to have a fresh start of my own here. This blog is running on some horrible software that I wrote in 2017. Sadly, I don't have any of the posts that were previously here, but that is probably a good thing.

Yesterday I "unarchived" the repo in GitHub, deleted half of the code that was my poor attempt at allowing people to add comments, updated all of the dependencies, and then shipped this off to my NUC box.

Surprisingly, everything more or less works that way I remember.

Every time I look at this code base I think to myself "why aren't you using a static site generator?". It is a good question and I don't have the best answer. I am married to the idea of taking advantage of the full text search feature of SQLite (which powers the search bar above) and I have not found an equivalently simple solution for any static site generators that don't require loading random JS or using a third party service.

There is probably a healthy middle ground here somewhere and I hope to find it.

Regarding comments, after blogging in obscurity for over a decade nothing that I have written has ever generated enough interest to foster a good discussion on my own site. I am actually OK with that and not trying to reinvent Akismet is a good thing for everyone. The simplest approach to solving comments on this site is to just not have them at all.

If something you read here motivates you and you want to tell me about it, there are many other ways to contact me.