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).

Categories
Programming

100 Days to Offload WordPress Plugin

In the course of pushing myself to write more on this blog, I’ve come across the #100DaysToOffload project. It’s super simple: write a 100 blogposts in a year in your personal blog to unlock the achievement. It seems like gamification done to the right level, as it’s not to strenuous (“write every day” would likely fail before lift-off), and not too lax (100 blogpost are still quite a stretch to go!). Thus it looked like the right too to trick myself into doing the thing I already wanted.

On the other hand, I’m one for meta-games, especially when I have doubts whether I stand a chance in the game itself, thus came the idea of do something around 100DaysToOffload that might also result in a blogpost. Hence came the “Hundred Days to Offload” WordPress Plugin idea: get a bit of coding in, make something useful to see if the game has been “won”, an also get one (or more) write-ups out of it.

Spoiler alert: it’s working now, very barebones, but to the point… that there’s a long way to go.

Screenshot of the Hundred Days to Offload plugin in the WordPress admin interface.
How the Hundred Days to Offload plugin looks in practice (as of now).

In the process, that took a couple of days over the weekend, I’ve revisited PHP, that I used to “play” with for projects before, though haven’t done anything serious, nor made it part of my Language of the Month series, so far. It was still quite interesting to revisit with more mature eyes of e.g. how good projects look like in the Python ecosystem (where I spend most of my time), and whether lessons learned there are applicable here.