TIL: tempfile in ruby, use it for easy garbage collection afterwards

Today, I was working on a script at work where I ultimately needed to export a 2MB file and although this isn’t a large file, I know I will forget about getting rid of it so while searching around, I came across tempfile.

Tempfile simply will be garbage collected at some time because the file is stored in /tmp and you can make your own copy if you need it. Here’s an example from the ruby docs:

require 'tempfile'

file = Tempfile.new('foo')
file.path      # => A unique filename in the OS's temp directory,
               #    e.g.: "/tmp/foo.24722.0"
               #    This filename contains 'foo' in its basename.
file.write("hello world")
file.read      # => "hello world"
file.unlink    # deletes the temp file

Make sure to run file.unlink if you want it to be deleted right away.

Using Numi app for calculations

I’ve used the Calculator app on the iPhone for as long as I’ve had a smartphone and I think on the computer, it’s a weird thing that’s been missing for a long time. Recently, Apple brought the Calculator app to Mac but I don’t think it’s as useful as I want it to be so I recently discovered an app called Numi.


It’s a super simple app that just works and the best part about it is that it supports setting variables and making conversions between many units extremely easy.

Here’s an example of a time difference comparsion:

Using the correct divisors is amazing in this app. So on mac you can use / or alt + / to type out ÷, Numi handles both of these the same way.

Some more examples:

Realforce R2 vs Epomaker’s Niz Plum x87

About two weeks ago, I made a reservation for the [GMMK Pro] keyboard from Glorious. At first glance, I liked the keyboard and then watching reviews of it online, I really started to like the way it was put together. My favorite keyboard layout is the simple 80% or TKL, which is a normal layout keyboard with the numpad removed. The GMMK Pro is a 75% board since it lacks the full navigation cluster and the arrow keys are shifted to the left a bit. It also doesn’t have F13-15 (or Print screen, num lock, and Pause). Instead, it has a knob located in that spot, which was sort of a bonus for me.

GMMK Pro from Glorious in white

Well, while I’ve been impatiently waiting for the board, I’ve been tempted by other boards, including a lot of switch options. I ordered a set of Gateron Red switches with the GMMK Pro, the switches are made by Glorious as well (I think). And they feel a bit too linear and straight forward for me but I might try them out when the board gets to me (whenever that maybe).

Loud switches annoy me

The loud clicky switches like Cherry MX’s blue and green switches annoy me since a lot of the time, I’m typing with music playing in the background and the clicking and clacking isn’t very satisfying to listen to and some times it even distracts me. This is at home so it’s not like I’m bothering anyone else, just myself but I still consider that to be too much.
I’ve recently put away my WASD board which I was using as my only board for 2020 while WFH and I’ve been using my Ergodox which has less noisy MX brown switches but the typing experience on it is not very satisfying.

Alternative options

So while I wait, I wanted to try a board I have been interested in for awhile. The RealForce boards are made in Japan with Topre switches which are not exactly mechanical switches but do have very good build quality and are raved about online. The switches are some of the few switches available now that are patented and only made by RealForce and other Fujitsu brands. I believe because of this proprietary switch, their keyboards are inherently more expensive than pre-built mechanical keyboard options. Well, I still wanted to try it and make sure I wasn’t leaving a stone unturned before I buy what might be my endgame keyboard (GMMK Pro).
So when I ordered the RealForace R2 from Amazon, I also ordered the supposed dupe of it which is the Epomaker Niz Plum.

Comparing both boards

Before I jot down my thoughts, I want to point to a youtube video you can watch that compares these two boards as well:

The typing experience, for the first few minutes, on each keyboard feels the same. But as I spent more time typing, even while typing this blog post, the differences started to become clear.

Realforce R2 on top, Niz Plum x87 on bottom

Realforce R2

It definitely feels and types like a well built and solid board. Doesn’t have the cheap feel at all. This board is listed on Amazon for about $255 (USD). That means it’s one of the most expensive keyboards I’ve bought. This is expensive in general because you can get a wireless, type-c, and RGB enabled keyboard from Keychron for about $70.
This keyboard just looks old, the ivory color that I got has the vintage IBM era colors and it might look cool from far away but comparing this with all the various options available out there, I don’t like the looks of it.
The keycaps were hard for me to pull out so I didn’t want to mess with them after I couldn’t pull them with a keycap puller. This board uses electro-capacitive switches which is what the Topre switch is. The board doesn’t have general MX style + type switches so you can’t replace the keycaps. This is a big negative in my book since I am definitely considering buying some custom keycap layouts.
The layout of this keyboard uses a mixed weight for the actuation force and this actually is really cool. I have typed for about half an hour on it so I can’t say if it’s great for long term use but right off the bat, it did feel good for my weaker fingers like the ring and pinky finger.
A weird performance issue is happening on my Mac which is sort of making me nervous about this board, it skips every 20-25 keystrokes, I am not a perfect typist but I know I’m pressing some keys perfectly and it just doesn’t pick them up. I’m wondering if this is due to not getting any feedback or because it’s not registering some keystrokes.

Niz Plum x87

So Epomaker has been a hit or miss in my opinion for me, I’ve tried another board from them and it felt very weak as a board for about $100. The Niz Plum board is listed for $155 on Amazon. Almost a full hundred less than the RealForce. This keyboard also uses electro-capacitive which is primarily the reason for me to try this board. It has the same layout as the R2 and looks very similar except the color scheme and case are a brighter white and less gray than the R2.
The keycaps are MX compatible on this so easily replaceable.
This keyboard is listed as having switches with a 35g actuation force, which to me feels a bit too light. Some times, I’ll just be resting my fingers on the home row and the keys will be pressed in. Just like the R2, this keyboard doesn’t have much feedback when the key is actuated which seems like an odd experience for me.
Unlike the R2 that uses a fixed cable, the Niz Plum uses a type-C port. The board definitely is a modern take on the R2 in my opinion. Its typing experience is on par with the R2 for $100 less and for a better UX.
No keystrokes were skipped with this one which is a great thing to have on a board 😀

Which one would I consider keeping? I think the Niz Plum over the RealForce but I am going to spend about a week with each and see how things go.

Blogging from Ulysses

I’ve been enjoying blogging from my phone by emailing to my blog, it’s the most straight-forward way to get thoughts published. I’ve also been writing a lot more inside Day One and iA Writer on my phone (for quick thoughts that don’t need to see the daylight). Today, I saw that Ulysses updated to version 22 with new publishing features and I wanted to give it a go from my computer.

You can read more about their feature updates here: https://ulysses.app/

I’m trying to publish more often because it helps me get the thoughts out of my head and my brain feels less crowded.

Jugni — Rabbi Shergill

I forget about this song for long periods of time since it’s not on Spotify.

There’s a lot of substance in this song and it’ll be hard for me properly cover through translations but there are a few lines I’d like to summarize.

A personal take on this song

Jugni goes to her country, where the ones before her were born and where they kicked out the British, that’s the first few lines. Then Rabbi Shergill talks about how Jugni’s everywhere. Everywhere there’s something wrong but the problems won’t go away until the day Jhelum dries up. Jugni finds her way to Punjab, where the educated are useless and the ones who had land sold it to go mop some floors far away, they find a white girl while their families watch for their returns. And in Bombay, nobody sleeps, everyone is looking for something and nobody finds anything. Jugni finds no peace. The YouTube version ends too soon and I forget what exactly happens in the song.