Surprising ease of gaming on Linux in 2020
During the quarantine my hobbies (and I imagine many others’) shifted to more indoors ones - possibly sedentary. Among other things I also started gaming after a hiatus of many years. But as you can probably imagine gaming on a 13” laptop with integrated graphics is not the most gratifying of experiences. So I got myself a desktop with a proper graphics card. And now comes the interesting part: since all the games I originally planned on playing have Linux support I decided to skip buying a copy of Windows and copy my laptop NixOS config and extend it as needed.
Rename rebase with git
Want to perform a git rebase in which you rename a file without pesky conflicts? tl;dr git filter-branch -f --tree-filter "git mv ORIGINAL_FILE_NAME NEW_FILE_NAME || true" -- $(git merge-base origin/master HEAD)..HEAD git rebase origin/master Ever wanted to rename a file you created/modified in a pull request but also wanted to keep the pristine history you worked hard for? Well tough luck you can either push a new commit to rename it (and keep old commits with the old file name) or resolve a bunch of pointless conflicts.
Moving to Hugo
If you've been here before you might notice the site looks different. Indeed I moved my content to yet another platform (first it was blogspot -> hakyll). I wanted to publish something but I ran into issues: my toolchain did not work. See, I've been doing less Haskell on my machine lately and negligence led into my setup rotting (as I did upgrade my machine quite a bit). Truth be told the infrastructure was not designed to last the test of time.
Linear time sorting
Did you know that you can sort data in time linear with respect to the lenght of said data? Some people dismiss linear time sorts because they've learned that n log n is the bottom bound for sorting an arbitrary input. But n log n is optimal!? Let's even sketch out a proof. Any function that sorts an array of elements will in fact figure out a permutation of elements into a sorted order.
Integrating Jira into Google Sheets
So I got a (recurring) task to compile some stats from Jira. You now, some filtering and agregation. Possibly a pivot table and a chart. Sounds like a perfect task for spreadsheets. But Jira doesn't have spreadsheets - at least without addons, but that is not an options for me. So I decided to use Google Sheets. And figure out a way to automatically fetch data from Jira because there's no way in hell I'm doing that manually every time.
NixOS install & labor pains
The Back Story My first foray into world of Linux happened with Red Hat Linux 6 (original, not the enterprise one). It was magical but it didn't stick. See, I was a kid who liked video games. So it was back to Windows until I finally got serious about programming and discovered I the development environment on Linux. So I formatted my hard drive and installed Ubuntu. I quickly learned absorbed information and slowly got bored.
Implementing apply on tuples in Scala
One of the first things you learn as a newcomer to Scala is the difference between a list and a tuple: a list must be homogeneous but a tuple can be heterogeneous. That is all elements of a list must have the same types but a tuple can contain things of different types. A direct consequence of this is that a list can define a by-index accessor and a tuple cannot.
Dockerless Services (with Nix)
So you want an “isolated” MySQL “service” but don't want to (or are not able to) run Docker/rkt/LXC/whatever? Here are the tl;dr steps: cd /tmp mkdir mysql-1 cd mysql-1 nix-shell -p mysql mysql_install_db --datadir=$(pwd) mysqld --datadir=$(pwd) --socket=$(pwd)/socket & mysqladmin -uroot -h127.0.0.1 password <REDACTED> mysql -uroot -p<REDACTED> -h127.0.0.1 ... Why? My motivation for this was running a database on a machine with a specially tuned kernel that did not support containers.
TDD-ing a toy sized project
Just recently I was porting a toy sized parser combinator library (a proof of concept) from Haskell to Python. You know, for educational purposes. It turns out I'm not smart enough to keep the complicated types (and explicit laziness) in my head even for such a small project. So my solution was to do TDD. To clarify: I wanted to test happy paths through my functions to make sure at least types fit together.
Repairing a corrupt Git repo using a clone
Quite recently I managed to make myself a corrupt git repository due to a file system failure. See, git stores everything in content addressable blobs - the file name of something is it's hash. Which lends itself nicely to checking repository integrity - it keeps out malicious attackers as well as my file system problems. I already hear you saying: Why not just make a new clone, git is distributed anyway?