Ever wanted more different ways to understand what’s going on in a program? Here I catalogue a huge variety of tracing methods you can use for varying types of problems. Tracing has been such a long-standing interest (and job) of mine that some of these will novel and interesting to anyone who reads this. I’ll guarantee it by including 2 novel tracing tools I’ve made and haven’t shared before…
In this post I’ll attempt the fun stunt of designing a system that could serve the full production load of Twitter with most of the features intact on a single (very powerful) machine. I’ll start by showing off a Rust prototype of the core tweet distribution data structure handling 35x full load by fitting the hot set in RAM and parallelizing with atomics, and then do math around how modern…
Ever since moving from NYC to SF to work at Anthropic I’ve been visiting NYC and working remotely quite often. So I designed myself a travel workstation that lets me get the best of ergonomics and packability. It includes a few off-the-shelf items, and a custom-designed laser cut aluminum keyboard case that doubles as a lap-board to hold my keyboard and trackpad: I can use the keyboard and Magic…
Ever since I built my light sensor based latency tester , I’ve wanted to use it to illuminate where the added latency of remote desktop / display streaming systems really comes from. In fall of 2021 I was let into the beta program of a remote browser startup I’ll call Remotey (not their real name) 1 . The idea is that you can save RAM on your machine and take advantage of powerful cloud computers…
Last weekend I played with Samurai in the DEF CON CTF Quals where I worked on a crazy problem which involved exploiting a program binary for a made-up architecture, which was running on a VM written for a weird made-up parallel machine architecture, running on another VM for that parallel machine which we only had outdated incorrect source code for. Because of this crazy nested weird VM setup,…
In the course of trying to figure out how to smoothly zoom timelines of a billion trace events, I figured out a cool tree structure that I can’t find elsewhere online, which it turned out two of my friends have independently derived after not finding anything on their own searches. It’s a way of implementing an index for doing range aggregations on an array (e.g “find the sum/max of elements…
Inspired by a few different conversations with friends who’ve switched to macOS where I give them a whole bunch of tips and recommendations I’ve learned about over many years which are super important to how I use my computer, but often quite hard to find out about, I decided to write them all down: Hidden macOS tips Dragging a file or folder onto a file open dialog selects it in the dialog.…
I recently played with Samurai in the DEF CON CTF 2020 finals, and want to write about an incredibly cool challenge I worked on called ropshipai . It involved reverse engineering a binary to discover the architecture and format of a neural network, creating a network to control your spaceship in an arena against all the other teams, then doing a ROP exploit using a buffer overflow to get more…
I watch a lot more YouTube than I do any other type of video content, and my favorite type of YouTube videos are interesting ones. I hesitate to call them “educational”, because they’re often not necessarily trying to teach, but to me the category distinction is they’re trying to be interesting in some way that pertains to the real world rather than just purely entertaining like video game content…
For a long time when I’ve wanted to test the latency of computers and UIs I’ve used the Is It Snappy app with my iPhone’s high speed camera to count frames between when I press a key and when the screen changes. However the problem with that is it takes a while to find the exact frames you want, which is annoying when doing a bunch of testing. It also makes it difficult to find out what the…
Something I’ve been thinking about recently is how when I’ve worked on any kind of distributed system, including systems as simple as a web app with frontend and backend code, probably upwards of 80% of my time is spent on things I wouldn’t need to do if it weren’t distributed. I came up with the following description of why I think this kind of programming requires so much effort: Everything is…
One day a coworker mentioned that he was thinking about APIs for distributed compute clusters and I jokingly responded “clearly the ideal API would be simply calling telefork() and your process wakes up on every machine of the cluster with the return value being the instance ID”. I ended up captivated by this idea: I couldn’t get over how it was clearly silly, yet way easier than any remote job…
I recently worked on a fun side project to make a font that used font shaping trickery to make it easier to read large numbers by underlining alternating digit groups or inserting fake commas. I wrote about it on the Jane Street tech blog since I started work there recently and I came up with the idea to help me visually parse tables of latency numbers for my job. You can read the post here:…
One reason to know how your data structures work is so that when your problem has unusual constraints you can tweak how they work to fit the problem better or work faster. In this article I’ll talk about four different fun tweaks to the concept of a hash table that I made in the process of using hash tables to implement interface method lookup vtables in my compilers class Java-subset compiler .…
I’ve noticed when I think about performance nowadays that I think in terms of two different aesthetics. One aesthetic, which I’ll call Never Miss a Frame , comes from the world of game development and is focused on writing code that has good worst case performance by making good use of the hardware. The other aesthetic, which I’ll call Do Almost Nothing comes from a more academic world and is…
After trying out VR and Beat Saber at Ctrl-V and really enoying it, I decided to pre-order an Oculus Quest , the first standalone VR headset with 6 DOF head and hand tracking. As expected I really enjoyed playing Beat Saber and practicing to play more difficult songs, but I also ended up getting wrapped up in the Beat Saber modding community and developing a patcher for adding custom songs which…
In some domains of programming it’s common to want to write a data structure or algorithm that can work with elements of many different types, such as a generic list or a sorting algorithm that only needs a comparison function. Different programming languages have come up with all sorts of solutions to this problem: From just pointing people to existing general features that can be useful for the…
There’s a problem with Apple’s Metal MTKView on macOS which is that seemingly nobody can figure out how to get smooth window resizing to work properly. I just figured it out, more on that later. If you reposition the triangle in Apple’s Hello Triangle program to the left (to make the rescaling more apparent) then you can see it judders horribly when the window is resized: What’s happening is often…
During my final term at UWaterloo I took the CS444 compilers class with a project to write a compiler from a substantial subset of Java to x86, in teams of up to three people with a language of the group’s choice. This was a rare opportunity to compare implementations of large programs that all did the same thing, written by friends I knew were highly competent, and have a fairly pure opportunity…
During my final term at UWaterloo I took the CS444 compilers class with a project to write a compiler from a substantial subset of Java to x86, with a language and two teammates of your choice. My group of three chose to write our compiler in Rust and it was a fun experience. We spent time coming to design decisions that worked out really well and used Rust’s strengths. Our compiler ended up being…
A few months ago I bought a featureless cube of tungsten. It’s 1.5 inches across and cost $130, but I argue it was one of the best purchases I’ve made recently. Why would I spend so much money on a cube? Well it’s really dense. Tungsten is one of the densest elements, over twice the density of steel. My cube weighs one kilogram despite being pretty small. The first time I held a friend’s tungsten…
Recently I flew to Vegas to attend the DEF CON 26 CTF with ( Samurai ), the team I played with when we won the qualifiers . I had a lot of fun and got very little sleep, working two consecutive 20 hour days and finishing off with another 4 hours of contest at the end. As a programmer entering CTF with only a little bit of reverse engineering experience and no exploit development skills, I was…
A friend invited me to join his CTF team ( Samurai ) this year for the Plaid CTF and the DEF CON qualifiers and I thought that sounded fun and wanted to learn more security and reverse engineering, so I did. For Plaid I just spent a couple hours tinkering with a few problems with my main accomplishment being reverse engineering a complicated APL program. For DEF CON I decided to go all out and…
While discussing Dan Luu’s keyboard latency experiments I realized that I had never tested my keyboard’s latency. I use a custom keyboard I designed and built , but when I wrote the firmware I was focused on getting it working and didn’t pay any attention to latency. When I took a look at the source code and immediately saw a 10ms delay that was there for no other reason than paranoia, I knew I…
Edit 2017/12/10: So I screwed up, I thought I was safe confirming it in two different ways but I was using an external monitor and all of the below is accurate only for a specific multi-monitor case. Skip to the bottom to read about my new results. CVDisplayLink is the recommended way to synchronize your drawing/animation with the refresh of the display on macOS. Many people assume it calls your…
This is a list of ideas for using eye tracking as a mouse replacement, specifically solving the problem that eye tracking often isn’t quite accurate enough to use raw. There’s lots of targets on a normal computer that are just too small for even the best fingertip-size eyetracker accuracies, like selecting individual characters, or small buttons. For some people, like me, eye trackers tend just…
During my internship at Jane Street 1 , one of my projects was a config editing tool that at first sounded straightforward but culminated in me designing a custom tree diffing algorithm using dynamic programming, relentlessly optimizing it and then transforming it into an A* accelerated path finding algorithm. This post is the story of the design and optimization of the algorithm, of interest to…
I’m a student at the University of Waterloo, famous for its co-op program where students do 6 4-month work terms throughout their degree. I’ve now done 7 internships both within the program and outside it. Doing internships before one graduates is a great way of experiencing lots of different teams, work environments and even cities. This has allowed me to gain a much better idea of what kind of…
I currently use a highly customized Sublime Text 3 as my text editor for almost all programming. However, people are often surprised to learn that I’ve used Vim for 6 months, Emacs/Spacemacs for 10 months (including much elisp hacking) and Atom for a month, yet I still prefer Sublime. This post explains my journey between text editors, what I learned, what I like and dislike about each of them,…
This afternoon I spent some time with the free trial of the Hopper Disassembler looking through the binary of Sublime Text 3. I found some interesting things and some undocumented settings. Undocumented Settings The most potentially useful and interesting thing I found were some undocumented settings for Sublime Text. A couple of them could even be useful to some people: draw_shadows : A boolean…
Along with Dash , Sketch and Papers , one of the main reasons I haven’t yet switched to Linux is Hammerspoon . Hammerspoon gives me most of the power that a fancy Linux tiling window manager and configurable desktop would give me, without having to switch operating systems. It’s fully configurable with Lua, has tons of built in modules and it is simple to write your own modules. I think of it more…
Last weekend me and my friend Marc went to TerribleHack III and made Dayder , a neat little website for finding spurious correlations in lots of time series data sets. I did the ingestion of our initial data set of causes of death over time, as well as the JS/HTML front end. Marc made the correlation finding web server in Rust and also did the final prettying up of the CSS. I’m quite proud of how…
During my time at the UWaterloo HCI Lab I’ve had the opportunity to try out 5 different eye trackers and compare them. These eye trackers span the price range from free to $10,000+ and use a variety of different tracking methods. These trackers are also not always direct alternatives, they are often meant for very different scenarios. Disclaimer: These are the results that I got for myself using…
Update: See bottom of the article for recent progress. I’ve managed to get a full 10-bit high def video feed and have released example code. In 2014 I bought an Eye Tribe eye tracker hoping to work on some neat eye tracking projects. Unfortunately I’ve never been able to reach the fingertip level accuracy they claim and that I have seen in videos. I always get around +/- 5cm (2 inches) or more of…
During my three terms at The University of Waterloo so far every single professor I’ve had has been quite good. Some however, are amazing. Each of these amazing profs is amazing in very different ways. Some are great lecturers, some great teachers and some great people. In this post I’ll highlight some of the great professors I’ve had so far and what makes them amazing. Prabhakar Ragde (CS 146) -…
A couple months ago Dave Pagurek and I decided on making an arbitrary scale finder for the upcoming UWaterloo “stupid shit no one needs” hackathon . I decided that I would do this by finding paths in the links between Wikipedia pages. The thing is to do this I needed a good data set in the right format. I did some research and found Six Degrees of Wikipedia which had some information but no data…
Deviating from the usual programming content of this blog I’d like to talk about an idea I’ve been thinking about recently. This week I went to a talk by Lewis Dartnell author of the most interesting non-fiction book I’ve ever read called The Knowledge . It’s a book that explores the essential science and technology necessary to build a modern society from the perspective of bootstrapping…
Edit: Some things in this post are now outdated. I’m currently using Sublime Text with Vim keybindings instead of Spacemacs so I haven’t been keeping up. I’ve fixed some things (Thanks Fabien!) but others may remain. If you want to fix something outdated submit a PR to my website . A few months ago I switched to using Spacemacs as my text editor of choice. It has great vim keybindings and…
Edit: I am now using Hammerspoon which is a fork of Mjolnir that is basically the same except it comes with the modules (no luarocks), it’s under active development and the naming is slightly different and more consistent. Most of this article still applies. Recently I started using the amazing and highly configurable window manager called Mjolnir . But really it isn’t a window manager, it’s an…
This summer I set myself the task of designing and building a chording keyboard from scratch. Chording keyboards use a different system of typing where you type entire syllables or words in a single stroke by pressing multiple keys at a time. My keyboard is designed to use a system similar to Velotype . This should theoretically let me type at up to 200WPM. To spoil the ending I managed to build a…
Recently I gave a full length talk at Ottawa Ruby on highlights of the Ruby standard library. It has elements suited to both beginner and advanced Rubyists. The Ruby standard library is huge and awesome and this talk was designed to show off some of the cool parts of it that are helpful in everyday Ruby programming, and some that are mostly just useful for trivia. I gave the talk on June 24, 2014.
Many high school students complain about boring and repetitive homework, but I’ve found a fun way of dealing with this that I find actually helps me understand concepts even better. When faced with large rote assignments I write programs to complete the homework like no human can: instantly, perfectly and on a large scale. In the past I have written written Literary Analysis Visualizations ,…
What if you improved your typing speed from wpm to wpm ? Over years typing minutes per work day you could: Spend times as much time typing saving hours . Or type times as many words jumping from million words typing to million words . If you earn per hour the extra productivity is worth . Learning to Type Efficiently in 3 Weeks Are you satisfied with your current typing speed? Do you even know…
There are many different comparisons of search engine results out there but I thought I would do one specifically geared towards the audience I identify with: programmers. Do note that these tests are not rigorous and are based on my observations of which search engine delivers the best results from a programmer’s perspective for a number of programming related searches. The tests were conducted…
I have too many projects, so I started a new project to solve my problems. This project is a little tool called pro which allows you to easily deal with all your git repositories. It has a handful of very useful features, each of which solves a problem that I have experienced. I imagine they will be useful to others as well. You can get pro by running gem install pro . Do note that a Unix system…
Ever since I was in grade 4 I have been playing the world’s best programming game. The game is highly rewarding, an excellent way to learn programming and it’s even free! This game has many advantages over other programming video games: Like Minecraft, it is open-ended and allows players to set their own goals. It allows players to use any library and programming language they want to. The game…
Background When most programmers think of Eclipse they think of the Java IDE but Eclipse is actually a huge group of projects with very little relation to each other except that they are all managed by The Eclipse Foundation. I had the privilege of working for The Eclipse Foundation this past semester at school as a High School co-op job. The Foundation does not actually employ developers but…
I have attended the Ottawa Group of Ruby Enthusiasts ( http://ottawaruby.ca/ ) for about a year now. It has been a great place to meet other Ruby developers and learn interesting things. The group normally has a main speaker who gives a long talk and one or two 10 minute lightning talks punctuated by breaks to eat pizza and talk. The main talk is normally over Skype and the lightning talks are…
I was sitting in English class last year and thinking about how English was about as far away from programming as you can get. We were discussing the significance of characters in the novel Lord of the Flies and I thought “I wonder if I could write a program to analyze this book, that would be ironic.” So that evening I wrote a Ruby script that analyzed the occurences of characters names in Lord…
Edit: I’ve recently switched to using Mjolnir and have posted a new tutorial on that. Switching windows with the keyboard on Mac OSX is hilariously inefficient: it involves repeatedly pressing command+tab through millions of programs until you get to the right one when you could have just clicked the window and been done with it. Moving windows is no better so people have resorted to paying for…