All posts by Elijah Mirecki

Matlab nanrms

I often find the Matlab nanmean function very useful. Unfortunately there is no builtin to behave similarly for RMS. So here is a snippet which may yield use!

Biking to Bremgarten

Today was a beautiful sunny day in Zürich. After a week of rain, I seized the opportunity to bike in the sun! I started biking to Spreitenbach to see the Bruno Weber Park, which is roughly 10km West of Zürich. However, either fate wanted me to go South, or I’m just bad with directions (admittedly, probably the later) because I ended up heading towards Bremgarten in the Canton of Aargau. I saw a picture of a cool old tower in the Bremgarten Alte Stadt, so I continued to bike there, which was another good option!

Continue reading

Hiking through Schlieren Forest

I recently moved to Schlieren, a city westly adjacent to Zürich. It’s a quiet city, and feels much closer to classic Switzerland than Zürich city, where I lived for two months. My co-worker also moved to Schlieren, so we decided to explore Schlieren forest, which is about a 15 minute walk from where I live.

There are trails all over the forest. Even some fire areas! We explored mainly the western half of the forest for about 2 hours, then we ended up in Uitikon, a small farming village. Unfortunately, by the time we arrived there it was too dark to take pictures on my potato camera, so I can’t show you the cows and feilds. At some point, I will definitely bike/hike back there and document said cows 🙂

Continue reading

Moving to Zürich

In early May, I moved to Zürich for Software Development internship at Verity Studios AG.

My roommate and I explored a bit, and found this cool park called MFO, which was a massive metal cube structure with vines growing everywhere. The picture (or Google Maps) don’t really do it justice!

MFO Park in Oerlikon

We also found the obligatory bull of Zürich:

Bull of Oerlikon (Zürich)

In the second week or so, I bought a Swiss made bike from a sketchy flea market:

Meine Übervelo from my flat balcony

Dabbling around with x86

I am going to work as an embedded software developer in May, so I thought I should feel cozy with x86. The only experience I have with x86 is in a dissassembler context… so be warned! This may be messy.

I wrote this little fellow which simply prints a given number in octal using recursion :]

To all the potential employers out there, here is a bonus… fizz buzz :3


A couple months ago, I made the switch from Vim to Emacs. However, I’m using Evil mode, so I still have all the nice Vim keybindings.

One of my biggest complaints about Emacs is ergonomics – “Emacs Pinky” is a legitimate concern:

One solution is getting foot pedals or a fancy ergonomic keyboard like the Ergodox or Keyboardio, but I didn’t want to commit to the investment just yet. Thus, PinkyCtrls was born! I forked an existing project that turned the space key into a control key if you held it, but worked as space if you tapped it (Space2Ctrl). However, with Space2Ctrl I found that I generally mistyped spaces a lot, since I tend to mash the space key soon after typing words. So I decided to shove the functionality onto the Caps Lock & Minus key (where the quote key is on QWERTY layouts).

After about 2 weeks of using this mod, I find it uncomfortable to use the normal control keys, and I have no problems with all the finger stress when using Emacs.

Note: The code in my PinkyCtrls repo is currently pretty ugly… I may clean it up eventually, but for now it does the job. If you want to fork PinkyCtrls to work on another layout or with other keys, let me know and I’ll show you what you need to change!

Hello World, using only C syscalls

I’m currently working on implementing system calls in BlarbVM (see my previous post on it), so I am trying to get comfortable using only syscalls.

In Linux, you can change the heap size through brk (syscall #12). To write a string to standard output, you must provide a pointer to a location on the heap.

The following code:

  1. Get’s the end of the heap address
  2. Increments the end of the heap address by 6 bytes
  3. Set’s the value of those 6 bytes to a null terminated “hello\n” string
  4. Runs a syscall on the desired heap position to print “hello\n”

WearHacks Toronto 2016 Project: InfraViewer

At WearHacks Toronto 2016, we were trying to think of project ideas, but nothing came to mind that we all agreed on. So Adrian, Austin and I went out for coffee to take a mental break. While at the coffee shop, we were talking about all the types of light humans are blind to. Wouldn’t it be amazing if we could the whole spectrum of light, including infra red and ultra violet? … maybe we can!

When we got back to the Bitmaker offices (where the hackathon was held), we checked out the available hardware to see if there were any IR cameras. Unfortunately, the only IR camera we could find was on the Kinect, and it’s IR camera only has intensity (not spectrum data). So we made due with what we had and decided to use both the IR and RGB cameras of the Kinect to render both layers on top of each other.

Josh, Austin and I worked on the translation algorithm while Kulraj and Nick created an SFML GUI. The colorspace transformation algorithm we ended up designing and implemented was to shift the visible light by 10 degrees (hue), then shift the IR spectrum into the first 10 degrees of red hue. Essentially, we squeezed the visible light from the non-IR camera so there was no red left, then put a red layer on top of that image to display the infra red data.

The hardware turned out to be pretty difficult to overlay. The IR camera and visible light cameras had significantly different resolutions and aspect ratios. So we had to program some magic to translate the IR data to fit on top of the RGB data. Because of this, the IR layer was slightly offset from where it should have been. For instance, a slight red glow would appear around our bodies (from our body heat), but it would be shifted one side, since the camera perspectives were not identical.


You can check out the project here: InfraViewer. But be warned, the code base is pretty messy!


Esoteric programming languages are awesome. So I decided to create one, which I call BlarbLang.

The goal of this language is to be the simplest possible systems programming language. It uses a stack for parameters, and every function must destruct its own stack frame, and push a return value, manually. The language “doesn’t care” about performance, only simplicity. It currently supports only 5 operations:

  • a b ~ Store the value of a in register b
  • a $ Push register a onto the stack
  • b a ! NANDS index a with index b and stores the result in index b
  • a ^ pop ‘a’ elements
  • a ? if index a is true (non-zero), execute the rest of the line

In one of my CS lectures (CSC258) I remembered learning that every gate can be created using NAND gates, so that is the only type of logical operation in the language! Using the above 5 operations, tons of different operations can be created, including adders, shifters, comparison operators, and more.

There are 8 registers available for users. The 0th register is the line pointer, registers 1-3 are temporary registers (for swapping and stuff), and the 4-7 registers are “long term” registers, meant to be used outside of the standard library (by the user).

Labels allow creation of functions. For instance, the following code creates a function called “nandi” which NANDs two immediate stack values:

In the future, I want to add one more operation: the system call operation. Currently, the language can only modify data within the VM. That is, on the stack and in registers. However, using system calls, users will be able to allocate heap memory and perform useful tasks such as reading from STDIN and writing to STDOUT.