Two years in San Francisco

Hi all, last time I posted was on my 30th birthday, a whole 2.5 years ago… I never explained where I decided to go to apply my (then) newly acquired software engineering skills. So here we go. =)

After evaluating possibilities in startups, hedge funds and big tech companies I decided on joining Google. The offer wasn’t the highest I had but definitely competitive, their San Francisco office was a charming brick building converted from an old coffee factory overlooking the Bay Bridge, but most importantly it was one of the ‘things I want to do when I grow up‘ since I was 12 years old (I remember reading about the arcade and scooters in offices).

Highlight of the job: view from my desk. Some days at dusk, the bridge directly reflects the sunlight and turns golden, along with the shiny glass windows on Treasure Island in the background:

Sketch from workstation

To fully embrace city life, I rented a tiny (but absurdly expensive) studio apartment in a cool looking high-rise building that’s a few minutes walk from the office. For the very first time, I acquired a few physical items from designers I’ve always admired (Chairs by Charles Eames and Arne Jacobson, Fortuny Pallucco floor lamp, Philippe Starck’s spider lemon squeezer and Zaha Hadid cheese grader).

Anyways, so everything went pretty smoothly for about a year, I joined a team in mobile performance analytics (basically I was selecting a team in SF and made the decision based on conversation with a particularly charismatic skip manager). The job turned out to be quite mundane and neither creative nor very intellectually stimulating. But I found ways to entertain myself elsewhere, such as hanging out with friends, annual ski pass, periodical visits to Disney… Speaking of which, Galaxy’s Edge is absolutely amazing! In my opinion it’s probably the best piece of Imagineering in a few decades!

Then Corona hit in March 2020, I was trapped at home, got depressed, started re-thinking my life again (don’t worry, it’s been amazing how quickly I became totally un-depressed the moment I un-trapped myself and started moving around ^_^).

Anyways, exactly a year later in March 2021, as the world started to open back up, I got out of Google, moved my belongings into a storage unit and went back on the road =)

Yes I finally got a driver’s license… and a tiny car ^_^

Some random programs I wrote (Part II)

Unrelated note: I turned 30 today and am currently at the final stage of deciding between offers for my next career (very exciting times & stay turned for updates =) )

42 profile as of March 6th, 2019

Somewhere in the middle of my time at 42, I took a “C++ piscine”, graduated from C to C++ and started writing object oriented programs. This post will give a pictorial outline of a few of those later projects. Again, most of those are 2-man projects I shared with my coding companion Liam Dehaudt.


This is an off-the-galaxy project “custom created” for us by a guy named Gaetan who run the school here. The goal was to understand this paper, which presents a consensus algorithm comparable to block-chain and implement a small scale version of the system.

Hashgraph visualizer in action (intentionally slowed down for clarity)

In the example above we have 6 nodes in the network, they randomly ‘gossip’ to each other with gossips potentially carrying a payload. Every local graph is then updated through the gossip. New nodes representing the event of the gossip is added on (blue nodes), every ’round’ there is a layer of ‘witness nodes’ (red); when witness was well know they become ‘famous’ (yellow) and the famous witnesses then vote for the authenticity of other nodes (once nodes are approved, they turn green and is then logged into the database). If nodes are not approved (i.e. error or fraud), they will turn grey and a waring will be printed. We also implemented our own MD5 hashing algorithm to use for all connection and signatures.

Museum of Shaders

A cool graphics project exploring the fantastic world of openGL fragment shaders (i.e. using a single shader applied to a quad to render things line 3 dimensional fractals). We place shaders in a museum environment (Which I definitely did not steal from the British Museum Elgin marble room) by using billboards to fake 3D and switch between two different display/perspective systems when far away and close to the shaders.

As some may have picked up, I was able to put in some not-so-subtle references from mathematics, the shaders exhibited are:

  • Mandelbox (the scale multiplier changes over time)
  • Mandelblub
  • Sierpinski’s tetrahedron
  • IFS based on Sierpinski symmetry
  • Semi-transparent Quaternion Julia set (4th dimension evolves over time)
  • Cloud with Volumetric ray-marching
  • Structure generated by Kleinian group in 3D torus
  • Galaxy (2D shader)
  • Kaleidoscope (2D shader with octagon symmetry)

Was a lot of fun playing with shader ray-marching to get them to work =) & in the process I have discovered some amazing online fractal and shader enthusiast communities such as ShaderToy.

Voxel World

Sunset from a mountain top

Generated infinite Minecraft style terrains using a few layers of Perlin noise. Optimized in openGL by making block meshes etc. I had lots of fun making landscape look natural, included snow, mountains, grass, sand, water, trees and caves.

Moving, running or gliding through the world


An AI capable of playing the classical board game Gomoku along with an implementation of the game mechanisms and UI.

We implemented a version of minimax algorithm with Alpha-Beta pruning enhanced by killer heuristics. One of the rather unconventional idea used was, to reach higher search depth and take full advantage of the entire game time as a real player would, I decided to make a parallel thread which continuously search and hash moves back-stage while human player is thinking, then we are able to cap the return time at 0.5 seconds once player placed a stone by iterative deepening.

Some random programs I wrote (Part I)

In late April 2018, I officially went onboard 42 as a ‘cadet‘ and have since ‘climbed the ranks’ all the way to ‘captain‘ by completing various programming projects in the ‘galaxy‘. It has been a uniquely addictive process. I decided to write a post to outline some of the projects as well as sharing my plans on what’s next. Please also feel free to visit my Github for the source code and more detailed descriptions of the projects.

The galaxy

Below are a few of my personal favorites, ordered roughly chronologically.

Note: many of below are team projects done in pairs or triples, I’ll credit my awesome friends and teammate Liam Dehaudt and Charlie Gleason here =)


This was one of the first projects in the curriculum. The goal is to render various fractals in \mathbb{C} in real-time by taking mouse position as parameter. Parallel threads are used to speed up the rendering.

After completing the basic ‘stage set-up’ and the required Mandelbrot and z^2 + c. I had lots of fun coming up with color schemes and implementing rational function Julia sets such as those with locally connected Julia set homeomorphic to the Sierpinski carpet:

As well as those that has a hyperbolic symmetry similar to that of the Poincare disk:


This is an optimal transportation puzzle where one needs to find the minimal number of steps to transport a fixed amount of ants from one point to another through a graph. I had fun designing a retro-style ascii visualizer on top of the algorithm =)

We re-formulated the problem into a max-flow problem on a derived directed graph (we double all vertices and edges and form a larger graph) to apply the Ford–Fulkerson theorem. Project the resulting parallel paths to the original network and resolve overlaps. Then we queue the ants in the resulting set of disjoint paths depending on the length of each path. The result guarantees optimum solution as long as the number of ants is greater than the sum of lengths of paths from Ford–Fulkerson.

A simple example where the flow solution would result in overlapping paths and resolving overlap was required and the queuing can be seen observed


We made a reproduction of the Core War game. Including full implementation of assembly compiler, virtual machine and GUI.

Virtual Machine in action (4 worrier mode)

Core War is a 1984 programming game created by D. G. Jones and A. K. Dewdney, inspired by a malicious virus written in the 80’s. To deal with the self-replicating virus, a white hat hacker invented Reaper. It was a virus designed to spread and eliminate the malware.

The idea was simple. You compete by designing viruses to overtake a computer. You win by protecting your own program and overwriting your opponent’s programs. This is all happening on a virtual machine.

Particle System

An openCL and openGL simulation of movement of millions of particles in space in various gravitational modes. Used GPU for parallel computing.

Change gravity strength

Note: Due to the GPU restrictions, this project records with significant quality and performance loss, highly recommend trying it out!

…More to come in Part II…

2018 – Silicon Valley, 42 and programming (part II)

As explained in the previous post, I picked up programming in 2018 at a place named ’42’ (as in Hitchhiker’s guide to the galaxy) and got very much addicted to it. This post will outline how that happened and my somewhat non-traditional path in learning programming.

42 Silicon Valley campus

It all started one winter night in 2017 at a random hostel in HongKong, I went there for a few days between trips to pick up my Canadian visa. After visiting Disneyland and re-visited a few tourist attractions I found that there’s not much to fill my days with in this humid and bustling city. As I browsed blogs randomly, I stumbled upon this article, which described a new concept school in Paris that is apparently highly selective and completely free.

I was immediately curious about the place and learned that they have opened a campus in Silicon Valley. Without better things to do that night, I decided to make an account and try the ‘logic puzzle quiz’ which is the pre-requisite for entering. At 4 am I finished the quiz (which had the time limit of 4 hours and I was only partially aware when started). The next morning I received an e-mail invitation to their Silicon Valley campus for the 4-week long ‘piscine’ (something like bootcamp before the full-time program for further selection), which comes with free accommodation.

42 admission process as of Jan. 2018

Since I do plan to spend some time in the Bay Area and have alway had a slight regret on not having been properly introduced to actual programming (I learned a bit of VB in elementary school and didn’t like it, then took a graduate courses in purely theoretical algorithms and a computer graphics course in C++ without completing any coding pre-requisites). I signed up for the Piscine in March with the idea of treating it as a month-long puzzle-solving vacation to catch up on some missed liberal arts education. (the full program was said to take 3-5 years and I obviously won’t want that much more schooling)

The Piscine:

It’s beginning of March, my plan was to fly directly from London to Oakland and land the night before the program starts. I managed to miss the plane due to a combination of London train delays, over-confidence in being the last person to check-in built from McKinsey days and the famous black-cab taking a lot longer than legend has it… Anyways, I ended up having to fly through Scotland then Iceland and spending a night at an airport hotel. So by the time I arrived at the Piscine it was already mid-night of day00 (all counting starts at 0 here, the way John Conway used to teach us).

A team speed-coding game

So the piscine starts, to me the school felt somewhat like a place in a sci-fi story, ran by aliens/robots/rats, everything is automated, there were no staff aside from a few student volunteers:

  • We code in C by learning from sequence of videos ordered by day
  • A new set of puzzles is released every weekday morning at 8:42am and due at 11:42pm the next day (so they overlap)
  • One exam per week on Fridays where you log-on to complete
  • One group project and one individual project for each weekend

There is an interesting ‘correction points’ economy, where each submitted day has to be peer-reviewed 2 times before it can be computer corrected (i.e. one needs to schedule corrections and spend points to get people to go through the submitted code; one earns correction points by grading others). I was able to catch up on the first day’s problems in the next day but between corrections and all the other events, time was quite tight if one aims to finish all problems, even for me.

The automated correction system is designed to be quite brutal, lots of edge case testings and one small error in one exercise would stop the grades from all the later exercises to count. So even though I managed to solve all problems I still failed a couple days.

A day where a small error sneaked in and a few harder problems doesn’t count

The goal of the Piscine is to gather XP from days, projects and exams to level-up as much as possible. This gamification worked really well on me as I found myself working till 3 am regularly trying to be the highest leveled person in the piscine. It’s perhaps the most fun I’ve had in solving puzzles after Mathcamp back in high school =)

Piscine aftermath:

It was mid-April, the Piscine ended and I felt that I haven’t had enough… Since I had no concrete plan on the horizon (vaguely my plan was to start a new career in Toronto for a few years, ideally doing something new and exciting), I decided to enroll in the full-time program ‘while I’m figuring out what to do next and leave anytime’… this turned out to be a dangerous plan as I am still here after a straight 8 months of coding and having completed the entire program (beside internships), now winding up my interview process and choosing offers for software engineering.

This post is getting a bit long and I haven’t even gotten into any actual programming yet… I’ll probably do a separate post (or two) to describe some projects and the time I spent in their Paris and Ukraine campuses…

2018 – Silicon Valley, 42 and programming (part I)

Hi friends, it’s been another year & time to (finally) write an update on what’s keeping me busy! =)

Super-brief summary:

I got addicted to programming and am landing my next career in software engineering.

Brief summary:

  • January: I took a back-country split-boarding course with NOLS in Wyoming
  • February: I briefly moved to Toronto, obtained my permanent resident card while making some long-overdue progress in drawing and painting before taking a short touristy trip in Abu Dhabi and London
  • March – October: I came to Silicon Valley in response to an invitation from a French programming school named 42, initially I intended to stay for one month, solve some puzzles and pick up some basics of coding (which I always thought might be fun but never actually managed to take the time to learn). This last part turned out to be highly addictive and before I knew it, I have programmed non-stop till the end of the year and found myself interviewing as software engineer at various tech companies.
  • November – December: Stayed for 6 weeks in France and Ukraine to visit other campuses of 42, collaborated with local students and more level-ing up kicked off the interview process for my next career.

Due to the different nature of topics, I’ll spilt the post into two parts: Part I contains various bits of random trips/things I do till I started programming and Part II describes some programing projects and how I got intensely interested in the field.

So let’s start by rewinding time to January 2018:

Split-boarding with NOLS:

I took a 14-day backcountry split-boarding course with NOLS which includes a 10-day expedition into the mountains of Wyoming (i.e. drag a sled containing all gears, food, cooking equipment; built quinzhee to live in etc.). Was a lot of work but an extremely rewarding experience, learned a lot about rations, avalanches, cold injury, how to crafting snow into useful structures… Now I feel ready to head into the wildness even in the winter.

…and of course there’s the snowboarding part where we made marks on lots and lots of untouched powder!

Some drawing and painting in Toronto:

I got back to Toronto late January to finish some logistics and immigration paperwork (was planning to work in Toronto for a few years, although that plan didn’t end up happening). While in the city I signed up with a local atelier managed to do some drawing and painting there (the above are mostly my works from a Sargent workshop in which we learned to reproduce the technique used by John Singer Sargent, I also did some Bargue drawing and life portraits)

Abu Dhabi & London:

In mid February I went to UAE for the first time to see a friend and visit the Louvre of Abu Dhabi and the most expensive painting ever sold. Stopped by London for a week to catch some shows, museums and good food, before flying to California for what I thought was a one-month intensive programming camp… (continue in Part II)