Dropping Into Djikstra (P1)

My skateboard routine is fairly standard. I’ll pack my gear into my Adidas backpack, throw in a bottle and my keys, and head out the door grabbing my skateboard and the helmet. I don’t bother bringing my phone. I’ll get to my bike parked beneath my block, mount the skateboard onto the backseat, and cycle towards the direction of Bukit Batok MRT - passing by the station, passing by Princess Elizabeth Primary, over the green fields before reaching Yuhua, followed by Chinese Garden MRT, and then finally reaching the skatepark at Lakeside. The entire journey takes around 20mins or so, and I treat it as warm up. ...

January 27, 2024 · 7 min · Lei

Recap on Same Origin Policy CORS and CSRF

I had a fascinating lecture earlier this week with Prateek Saxena as part of my Web Security course, where we learned about a core pillar of web security, the same origin policy. Briefly speaking, the same origin policy disallows different web apps from accessing each other’s content and resources through the browser. It’s a framework for access control. Just like how User A cannot access User B’s files on a Mac OS, website A cannot access website B’s HTML, Javascript, CSS, by default. ...

January 27, 2024 · 8 min · Lei

Excel and VBA

In my first lesson of the current course I am taking, BMD5302 - Financial Modelling for Fintech professionals, I was introduced to first to VBA, and then to a couple of popular functions in Excel. I mean, I was mindblown a little bit by VBA. I’ve heard of it before, but I’ve never known what it does. Now I know: it is a way for you to control excel programmatically. The syntax seems easy enough, and very quickly I can see how it can be really powerful. It’ll allow you to automate almost everything that you need in excel. ...

January 19, 2024 · 3 min · Lei

Inside the Expansive Mind of Liu Cixin

Warning: massive spoiler alert for Death’s End. Reader’s discretion advised. A brain gets shipped to outerspace, embeds itself into Trisolaris civilization, finds success as a fairy tale writer, and rendevous with his crush deep in space to send a cryptic warning back to human civilization in the form of a fairy tale. Four dimensions collapsing into three, and three dimension ultimately collapsing into two. A tale that spans billions of years, dimensions, and universes, yet tied together by a singular thread of human (the writer’s?) warmth. ...

November 19, 2023 · 5 min · Lei

Server Location Matters in Vercel

My NextJs application had a problem: whenever it did CRUD operations, the server takes around 8 seconds to respond on first attempt, and then 2/3 seconds on subsequent attempts. This is the so called cold start problem that Vercel is known for. The source of the latency does not come from the DB as I’ve tested it in development mode against the same DB and there was no latency there. ...

September 1, 2023 · 2 min · Lei

Radians

Wow today I learned that 1 radian is actually the angle created by the length of the radius on a circle. And that 180degrees is simply 3.14 radians. Can’t believe I’ve never known this relationship.

August 21, 2023 · 1 min · Lei

OpenBB Blows My Mind

So I was researching for ways to get a company’s historical financials data because I hate clicking through pages of shitty UI and downloading files and all that when all I need is a couple of numbers - when I stumbled upon this open source project called OpenBB. To be fair, this wasn’t the first thing that came up in my endeavour. Basically, I want to be able to very quickly get the historical ratios, balance sheet, and income statement of a company, ideally through a light weight interface like the command line. Initially I thought I was going to use a couple of APIs and then cleaning the data through jq or something similar (which is still possible), and that led me to APIs like FinancialModelingPrep and EODHD. EODHD’s response design is more like a ‘bulk export’ approach, where with one call you get every single historical data of a company, whereas FMP’s responses are more streamlined and tailored to a specific need. The only thing is, with the free version, I could only get 5 years of historical data, whereas I need the data of way more years, so I was considering upgrading. Before commiting to it, I decided to look around to see if there are any alternatives to this, either in terms of workflow or in terms of data. ...

August 8, 2023 · 3 min · Lei

A Really Great Podcast on value investing

July 21, 2023 · 0 min · Lei

Setting Up Next Auth With Mongodb

So, recently I was exploring options for quickly spinning up an authentication system for a NextJs environment, where I stumbled upon next-auth. Spinning it up ‘quickly’ is important, because I intend to use this framework mostly for the MVP stages of a project, and I don’t want to spend too much time configuring it. I have to admit, understanding it at first was not so easy, because authentication necessarily brings along with it a lot of different parts. Luckily, resources like these and these helped. ...

January 22, 2023 · 7 min · Lei

Recently Discovered Zustand

So whilst wiring up my the frontend CRUD buttons to the backend routes in this project that I am currently working on, I realized I needed to implement a simple flux architecture to manage global state. However, I haven’t used Redux in a while, and based on my experience, setting up reducers, and their various dispatch statements, was rather tedious, especially for a small project, so I decided to google what alternatives to Redux was there. ...

January 8, 2023 · 4 min · Lei