Things I want to remember \(\cap\) Things I don’t mind the internet knowing
A feed update over a year later, lots has changed in my life:
2024 has been a very fulfilling and eventful year.
I’ve been medidating a lot more lately, and a technique I really enjoy is box breathing. It’s a pattern of holding your breath between inhaling and exhaling. To make it easier to follow along, I made a simple website: boxbreathe.cc
I learnt and built this entirely in CSS.
The system we’ve built for wealth distribution is so absurb. I’m in Melbourne, an extremely wealthy city in an extremely wealthy country, and there’s a homeless woman sitting in the prime business district with huge empty buildings all around.
If using LLMs to generate code, prefer using sampling over beam search. This paper was the starting point of my discovery, which lead to two more papers.
The general gist is that when picking new candidates, beam search only compares against complete outputs of differing lengths or incomplete outputs of the same length as the current candidate being generated. It does not compare against incomplete outputs of differing lengths. For some reason, this is okay for generating language not for code, it results in degenerate outputs. Why?
It’s been a hot minute since I’ve updated this feed. Here’s what I’ve been up:
I recently read about games that one can play in their head. Here’s a game I’ve played when outside for as long as I can remember. This game has kept me occupied through several hours of traffic, both as a passenger and a driver.
The game is to recursively add up vehicle numbers till you’re left with a single digit.
If the vehicle number is KA 51 AA 5678
, recursively apply the sum reduce rule on 515678
till there’s a single digit:
So the anwser is 5
. I’ve found a faster way to compute this answer than the brute force sum:
To eliminate 9
s. Consider 0019
, I can either do 1 + 9 = 10
, then 1 + 0 = 1
, or just remove
the 9
leaving 001
and the answer is trivial. This also works if a subset of numbers adds
up to 9
, like 1245
(=3
) or 4333
(=4
). This also applies to multiples of 9
.
Another speed-up is memoization. Since I’ve played this so much, I remember the result for all pairs
and some trios/quartets of numbers which makes applying the 9
-elimination rule faster. For 4378
:
I recall that 78
reduces to 6
, 6 + 3 = 9
, so it can be eliminated, which leaves 4
.
I can compute the answers extremely quickly now. If I can had to guess, maybe half a second on average.
It is the end of 2021. It was a mediocre year, through both my external and internal lens. 7/10. At the start of 2021 I wrote that I had hoped for some Mediocre Swings, so I got what I asked for.
The positive highlights:
The negative highlists:
2021 did not annul us from the problems of 2020, thanks to d̷̨̗̟͎̝̏̒̇e̶̪̹̬̍l̶͎͓̪̗̹̾̽͑̏̑̚t̷̢̤̣̯̺͚̍́̊ă̷̧͍̒̾̉͛̉Δ̸̝͗͗̃. I have no hope for 2022. No swings.
Happy new year. Death to Covid.
Code blasphemy: If you can’t fix a CI test, disable it.
I hadn’t worked on Shadesmar for nearly a year. I was looking at the code as reference for a tricky race condition at work. Not to brag, but the code was pretty neat, so I decided revist the project and I’ve been working on it over the last couple of weeks.
I stumbled into a very tricky bug, and spent a good couple of hours debugging it. It was a wonderful experience. I once read somewhere that a nice bug is like intellectual comfort food, and this bug qualified handily. Here’s the fix along with a very nice commit message.
Milestone in SummaryDB: It works!
I took an off from work today with the hope of enjoying a nice birthday weekend. I spent the day listening to Neil Gaiman’s The Sandman on Audible, and hacking on SummaryDB and I just hit 100 commits. I thought it was worthy of a tweet.
Large software engineering systems are shockingly broken compared to systems from other engineering disciplines. Other disciplines have a strong constraint of having to adhere to physics, while infinite layers upon layers of abstraction allows software to be really divorced from a strong foundational tether. It usually ends up being the sprawlings of diseased minds.
Instead of using reference counts to keep track of liveness of a pointer, instead use a dynamic graph to track all reference pointing.
Referce counting wouldn’t work too well when there’s cycles in the pointer:
A --> B --> C --> A
This usually requires a workaround using weak pointers that don’t increase the reference count.
Using a reference graph instead would fix this problem, by
denoting liveness as an edge to an eternal sentinel
node. Every time a node is deleted (pointer is deallocated),
we delete it’s edge to sentinel
and retrieve the list
of nodes no longer connected to sentinel
.
Implementing the underlying dynamic graph to make it fast while being thread-safe would be a challenge. Some looking around leads to this paper which would be perfect.
It is the end of 2020. It was a catastrophic year for the global community. On a personal front, it was a year of massive changes; a solid 6.5/10.
Some of the positive highlights of my year:
Some of the negative highlights:
I’ve never been one for resolutions, but I was looking forward to 2020. To quote Pirate Wires,
Big swings only.
With that hope ending in a fiery pile of pandemic shit, I tried to make the best of the hand that was dealt. I like to think that all the negative highlights from above were exogenous, but in highsight I could’ve handled them better, with a bit less haze.
The zeitgeist is that the end of 2020 will also annul us from the problems of 2020, while concurrently recognizing that 2021 will be a bleak, unchanging continuation. This juxtaposition reflects my personal outlook, but I side more with the former. I’m not hoping for big swings, but some Mediocre Swings would be scenic.
Covid didn’t just leave it’s mark on humanity, it french kissed it. I’m a witness to its gross, sloppy pervasiveness. I have spent my New Year’s Eve quarantined in a room waiting for my RT-PCR test, with the gregarious company of the dull hum of my PC’s fan, some bright lit screens, a bottle of red wine, and an uncomfortable sense of dreadly anticipation.
Update: I have tested negative. One more to the list of positive highlights.
Happy new year. Death to Covid. Long live enlightenment.
The best advice I can give anyone is to never buy a snow-white keyboard. If you do, you’ll spend two hours each month cleaning each key-cap only for it to be grimy within the week.
I was coding something in C++ and required sum types, and reached for the
evergreen std::variant
and life was great. Until I realized C++ doesn’t
have type-based pattern matching (à la Go’s Type Switch),
but after a little digging I discovered std::visit
.
What should’ve been a simple piece of code ending up being monstrous
boilerplate, so I figured I was doing something wrong. A quick google
search for std::visit usage
landed me in this
blog aptly titled:
std::visit is everything wrong with modern C++
I strongly agree with the author. It is ridicously complex, and the
addition of make_visitor
as part of the standard would’ve been great.
To be perfectly fair, I really don’t understand their implementation
that uses recursive overload. For now, I’m going with the constexpr if
solution.
I have half a mind to just roll my own union
and enum
based sum type.
But experience has taught me that rolling my own alternative to a thing
that exists in the C++ standard is good way to burn coding time.
This aversion to writing code from scratch, and reusing clunky existing solutions is a sign that I’m on the road to become a Software Developer™.
I have such a tough time wrapping my head around the whole Kubernetes, Docker, Docker-compose jargon. It requires prerequisite knowledge that is unfamiliar to me. It makes me wish I spent a bit more time doing backend web-dev during my undergrad.
It’s a Monday, and I’m already mentally and physically drained. This week is going to be rough.
Previously, my resume was a built using Latex, and I had a PDF in the GitHub repo. This had three problems:
tex
source, generate
the PDF and update the file in the repo.Since this website is built using Jekyll, I can generate the resume while the site is being deployed. The data is stored in a YAML file along with some code to generate the appropriate HTML webpage.
You can check it out here. One issue is that it uses more pages (2 vs. 1), but that’s a trade off I’m willing to make.
Fall Guys is fun. I think the last time I found a game this enjoyable with friends was RuneScape in 2010.
RIP AzzuTheBoss.
I’ve recently started working with Java during my day job, and I was reminded of a quote from a blog I read long ago:
“Dependency Injection” is a 25-dollar term for a 5-cent concept. – James Shore
I think Java programmers made up a bunch of jargon to make their jobs feel cooler than it really is. Java seems to favour verbosity over cleverness; perhaps, an averse reaction to the preceeding era of C++’s cleverness (read: pain).
Update, 1st September: Honestly shocking that Java didn’t get
an equivalent of C++’s auto
till Java 10. This is especially
annoying when using for-each loops.
I’ve really fucked up my sleep cycle. I’m currently alternating between 10AM - 5PM or 3PM - 10PM depending on the day. The past week has been a random sequence of working, coding, watching YouTube, and trying to live my life in-between. The lack of a proper schedule is a clean 3/10. Would not recommend.
Picturing slice/concat/reshape operations on high-dim arrays gives me the same feelings as ASMR for some weird reason.
Here’s one I was just thinking about:
[4, 5, 3] -> SLICE@0, 4 * [1, 5, 3] -> concat@2 -> [1, 5, 12]
is not the same as
[4, 5, 3] -> RESHAPE(1, 5, 12)
To put it into words: Slicing + concat along different dimensions can’t be replaced by a single reshape, unless the slicing + concat operate on subsequent dimensions. So that means:
[4, 5, 3] -> SLICE@0, 4 * [1, 5, 3] -> concat@1 -> [1, 20, 3]
is the same as
[4, 5, 3] -> RESHAPE(1, 20, 3)
Update, 17th August: If the dimension of slicing is after the concat dimension, the output of the fused slice will need to be tranposed along the concat/slice dimensions and then concatenated.
Although C++ is a powerful language, it’s quite easy to write ugly code. An example of the contrary is Glow. The graph optimizer code is a joy to read. Going to use this as an example of steller C++ code.
Graphs are amazingly useful structures. Wanted something that could generate
a single C++ header file given my project’s include
and src
folders.
Went around looking at pre-existing tools, but they either were not compatible
with my build system (good ol’ CMake
) or too complex to set up.
quom
looks promising as a general
purpose tool.
Wrote my own shadesmar
-specific single header generator. It’s called
simul
.
The core logic is embarrassing simple:
But as usual, the string handling (which is most of the code) was annoying. There’s a little bit more code to deal with file-specific include guard removal.
I recently got a new PC. To play games I installed Windows. I hate Windows. Read a blog post that encapsulates why I hate it. This is similar to another video by Jonathon Blow. That’s not to say Windows is the only thing guilty of this, there’s plenty of inefficient, janky softwares I use of a regular basis.
After playing games like Red Dead Redemption 2 over the last couple of days, I’m gobsmacked by people who write game engines. They are far less guilty of the above.
I’m going to try Proton now, and try to get started with some basic game engine work.
I accidentally deleted 6 hours of uncommitted work:
~/W/shadesmar> rm -rf *
zsh: sure you want to delete all 21 files in /home/squadrick/Workspace/shadesmar [yn]? y
I thought I was in build
deleting compiled targets. Time to retype from memory.