random thoughts

Writing Chip-8 Emulator (interpreter) in Crystal

It was the middle of a week, around noon I think.

I thought to myself “I should write a yet-another NES emulator, that would be awesome!”.

A few minutes later I am reading blog posts, articles, browsing repositories.

And I am like “Damn it looks complicated”.

Writing Chip-8 Emulator (interpreter) in Crystal

(Kind-of) Gotcha In Postgres Upsert Query

I noticed a funny thing happening in my most recent pet project. All of the sudden (auto-incremented) primary key was out of range for my smallint column. But how come? I had like 15 records in that particular table. It turns out it was all by design and completely makes sense when you think about it, but I managed to miss that anyway. The problem is when you do an upsert sequence on your primary key will be incremented anyway - it had to be obtained before actual insert so when you take a step back it’s like pretty obvious ;).
(Kind-of) Gotcha In Postgres Upsert Query

Back To The Crystal - Thoughts on my first app

So I wrote my first smallish web app in Crystal and it’s been running for over two months now without much of supervision (thanks to monit and systemd). It basically, um, collects some metadata from IMDB every week or so. Based on that data I’m trying to find underrated movies worth watching. Some general thoughts for future-me:

Back To The Crystal - Thoughts on my first app

Cleanup MacOS disk and get that space back

I looked at my free disk space and I was like What the f*ck?!

Quickly I decided to Erase them all and reclaim my space. 🤟

Here is how.

Cleanup MacOS disk and get that space back

How to install BasicTeX on MacOS via homebrew

If you want to install latex on your Mac you have two most common options - install Full MacTeX or smaller distro - Basic TeX. See package listing here. The first option is easy, but package weights few gigabytes of data you probably won’t use anyway. The second one might be problematic for latex newbies like me, so here are some scribbles that hopefully might help someone.

How to install BasicTeX on MacOS via homebrew

Back To The Crystal - Decorators and presenter ideas for Kemal

Note: Checkout part one about web frameworks options in Crystal. Once your Kemal app grows a little bit it seems obnoxious to declare tons of variables that are automatically passed down to the view. Personally what I like to do when I’m feeling that the amount of variables is too damn high and the logic used inside the Kemal router is getting hard to reuse - is to introduce a presenter (simple class, no magic there) that basically wraps whole logic responsible for initializing variables I will need.
Back To The Crystal - Decorators and presenter ideas for Kemal

Back To The Crystal - Background workers and deployment

In previous post I briefly discussed web frameworks options for Crystal. Once you have your main web application up and running usually pretty soon you need some sort of background worker - to do some heavy lifting, fetch some data and whatnot. In Ruby world you would probably choose between two most popular and straightforward redis-based solutions - resque and sidekiq (obviously there is much more to choose from). Thanks to Mike Perham there is a sweet Ruby-compatible Crystal port of Sidekiq - called, Sidekiq.
Back To The Crystal - Background workers and deployment

Back To The Crystal - Choosing web framework

After over two years (dang that was quick 😳) I have decided to give Crystal another go. During those two years some nice libraries appeared and language seems quite promising - I hope it will gain some traction in the future. I will try to make a series of short posts regarding Crystal within this month as I think it lacks documentation/references and attention it deserves - and as I’m taking some longer time off from IT in general very next month I have to hurry :P.

Back To The Crystal - Choosing web framework

5 Short Reflections From 5 Years

Last month I decided to quit, to stop being a manager/developer. 5 years ago I was looking for a place where I can improve my rails skills and suddenly I stayed at that place for 5 full years :).

Below are the scribbles, I hope to read them again in few years (dang) and see how far I /hopefully!/ grew from there.

5 Short Reflections From 5 Years

Setup and Tooling for small project as a single developer

As I’m still fooling around with my old pet project I decided to sum up current setup I’m on - from the basic things like where I host my stuff to what kind of tools/products I use, and how much does it cost me in the end (spoiler: I’m cheap as hell :P) So let’s see it. 1. Hosting Bare-metal, I’m an old folk and I change vendors whenever I feel I need to ;-).
Setup and Tooling for small project as a single developer