Categories
Admin

When WordPress caching is not what it seems

When parts of a system are strongly interconnected, one can discover latent issues while debugging something completely different. This is what happened with this blog’s caching and integrating with the Fediverse.

Fediverse adventures

I was part of The Great Twitter Exodus of 2022, and like many I’ve landed on Mastodon (hey, hello, https://fosstodon.org/@imrehg). Mastodon and the whole Fediverse and its build around the ActivityPub protocol is technically very interesting and brings back a bit of retro-joy to me (which needs some reflections on why and how is retro joyful, but another time). This current blog is running WordPress, and soon found that there’s a plugin to turn a WordPress blog into a my own ActivityPub node. That seemed some excellent way to connect up tools and make a more inter-connected Internet (besides nerding out, if I’m fully honest).

Categories
Life

A year in review: 2023

It feels stranger than usual to review things at the moment, as I’m starting to feel more “continuous” about the flow of time rather than discrete with jumps (as the new years and holidays and so on are happening). Thus it doesn’t feel like there’s a particular closure as the calendar year comes to the end. So it’s more of a work-in-progress, rather than anything else. Let’s see what stands out in this, and where are we going, in this year in review

Categories
Programming

Programming challenge: Protohackers 3

Protohackers is a server programming challenge, where various network protocols are set as a problem. It has started not so long ago, and the No 3. challenge was just released yesterday, aiming at creating a simple (“Budget”) multi-user chat server. I thought I sacrifice a decent part of my weekend give it a honest try. This is the short story of trying, failing, then getting more knowledge out than I’ve expected.

Definitely wanted to tackle it using Python as that’s my current utility language that I want to know most about. Since the aim of Protohackers, I think, is to go from scratch, I set to use only the standard library. With some poking around documentation I ended up choosing SocketServer as the basis of the work. It seemed suitable, but there was a severe dearth of non-dummy code and deeper explanation. In a couple of hours I did make some progress, though, that already felt exciting:

  • Figured out (to some extent) the purpose of the server / handler parts in practice
  • Made things multi-user with data shared across connections
  • Grokked a bit the lifecycle of the requests, but definitely not fully, especially not how disconnections happen.

Still it was working to some extent, I could make a server that functioned for a certain definition of “functioned”, as the logs attest:

Console log of server messages while trying my Budget Chat Server implementation.
Server logs from trying my Budget Chat Server
Categories
Programming Taiwan

A personal finance data pipeline project

I had received a (family) project brief recently. In Taiwan many credit/debit cards have various promotions and deal, and many of them depend on one’s monthly spending, for example “below X NTD spending each month, get Y% cashback”. People also have a lot of different cards, so playing these off each other can be nice pocket change, but have to keep an eye on whether where one is compared to the max limit (X). So the project comes from here: easy/easier tracking of where one specific card’s spending is within the monthly period. That doesn’t sound too difficult, right? Except the options for these are:

  1. A banking website with CAPTCHAs and no programmatic access
  2. An email received each day with an password-protected PDF containing the last day’s transactions in a table

Neither of these are fully appetizing to tackle, but both are similar to bits that I do at #dayjob, but 2. was a bit closer to what I’ve been doing recently, so that’s where I landed. That is:

  • Forward the received email (the email provider does it)
  • Receive it in some compute environment
  • Decrypt the PDF
  • Extract the transaction data table
  • Clean and process the tabular data
  • Put raw in some data warehouse
  • Transform data to get the right aggregation
  • Literally profit?

I was surprised how quick this actually worked out in the end (if “half a weekend” is quick), and indeed this can be a first piece of a “personal finance data warehouse”.

Categories
Computers

An Open-Heart Motherboard Surgery

My personal laptop, this very day, is a Lenovo (Thinkpad) X201 from 2011. That’s more than 11 years of service, and still pretty well holding up (in no small part thanks to Archlinux and Xfce). Nonetheless a few weeks ago, it just decided after a very “helpful” spark when plugged in, that it won’t turn on nor charge 🙀… After reading a bit and experimenting with the charger, the battery, &c, the probable verdict that “it needs a motherboard replacement”. I did start to consider, whether to give it piece and just wholesale replace it with a new machine, but since I’ve already taken it apart a few times, I thought that self-service might just give it a bit longer lease on life.

First time ordering from AliExpress, I actually found a bunch of people still selling the board, and at ~80USD it doesn’t even break the bank (even if it wouldn’t work, or wouldn’t work for long). Thus ordered one with the right CPU that I vaguely remembered (it’s soldered on, so couldn’t be replaced), and waited. The predicted shipping time was something like 40-70 days, but actually it turns out things can arrive in less than 14, if the delivery company sets its mind to it…

A new-old motherboard for the Lenovo X201

Now just had to get my trusty little precision screw set and start working on it (like a few times before, but hopefully with better success).