30 December 2013

Dream Come True

Can I help you?
Yeah. Do you have the new 911?
Yeah. It's right over here.

Do you want to get in?


Do you have a business card?

I'll see you in about 20 years.

It's a funny thing about a Porsche. There's the moment you know you want one. There's the moment you first own one. And for the truly afflicted, there's the decade or two that passes in between.

Only took about 11 years!

08 December 2013

Words of Wisdom

In the process of choosing which job to take next year, I have received the following pieces of advice:

"Go to the company with the smartest people."

"Go to the company at which you think you'll most likely be fired."

"Go to the company whose project most interests you."

"Go to where the Lamborghinis are."

"Go to where you want to go."

"Go to where you think you'll be happiest."

"Don't buy GPUs to mine coins."

29 October 2013

Costly Signaling: The Quest for a 90.0%

I remember that during my senior year of high school, there was some unofficial competition among friends to get the lowest final grade possible without ``Asian-failing." That is, to do as poorly as possible on graded assignments without getting the dreaded B+. The GPA cutoffs was set such that an A [93%, 100%] was a 4.0/4.0, A- [90%, 93%) was a 3.8/4.0, and B+ [87%, 90%) was a 3.3/4.0, so dropping from an A- to B+ is a much bigger deal than dropping from an A to A-. This game was certainly fun to play, but at that time I didn't understand the reasons that we participated.

It turns out that costly signaling could explain this phenomenon. Costly signaling, or the handicap principle, is a behavior that is costly for all groups, but more costly for the ``worse'' group than it is for the ``better'' group. In this case, better and worse are in terms of ability to do well in class and cost is the expected grade, which is related to the probability of sinking below 90% and the probability of being able to rescue a failure. I assume that the less smart kids have less control over their performance on assessments since they probably (1) can correctly answer fewer questions and (2) are more prone to make trivial errors.

Riskier variations include playing the game below senior year, during which grades are more valuable (since colleges will see them), or at MIT. I wonder how the brave souls at the Institvte would do, since the cliff between an A- (5.0/5.0) and a B+ (4.0/5.0) is massive.

28 October 2013

All I Do These Days

  • Problem sets
  • Ride planes and trains
  • Code over the phone or on whiteboards
  • Obsessively hit refresh on Autotrader.com

24 September 2013

Porsche 918 Configurator LIVE!

The most expensive car whose price is shown in an online configurator is...the Porsche 918 Spyder! And to add further insult, all 918 examples have been pre-ordered.

Here's to hoping I'll have a chance to drive one of these bad boys!

15 September 2013

San Francisco

Immediately after my internship, I flew to San Francisco for a short one-week vacation to chillax while I still had the chance.

Jet lag produces excellent morning photos

I made a day trip to south bay to visit Apple. I had lunch with my mentor and then went for coffee with a few others on the iOS team.

The reason I chose to go to south bay on this day is that Apple organized a small auto show at one of the campuses. I got to see a number of supercars and classics.

AC Cobra

McLaren MP4-12C air vent

Wings of freedom

Lamborghini Gallardo LP570-4 Superleggera mirror cap

AC Cobra Coupe


McLaren MP4-12C mirror cap

McLaren MP4-12C engine

McLaren MP4-12C door opened

Mercedes-Benz SLS AMG front emblem

The most intriguing supercars were the McLaren MP4-12C and the Mercedes SLS. I may just have a thing for door mechanisms, but I gotta say, scissor doors are the coolest. I think they intrigue me because I don't have a clear picture of where the hinge mechanism is mounted -- there's no obvious flat edge on which the door pivots like in traditional doors (leftmost edge) or gullwings (topmost edge).

I'm not too versed on classic cars, but I did recognize the BMW 2002! Oh, the things I learn from playing Forza 4. There were also a bunch of Cobras and a Porsche 356 Speedster in British racing green.

Automobiles aside, staying in San Francisco, specifically SoMa (South of Market for non-natives), was quite pleasant. Compared to the Tenderloin, where I stayed for an on-site interview. The surrounding area was decently clean (I would say not as clean as the loop in Chicago) and had plenty of attractions. Namely, the Apple store was only five minutes away by foot. :) Plenty of restaurants were close by, including Chinatown. (Aside/funny story: we went to a dim sum place for lunch, and I was awed when our waiter computed our bill (including tax!) in his head. I joked that I would never be able to work there.) We also walked along the piers and went to Ghiradelli Park one afternoon.

That said, rent in San Francisco is laughably expensive, to say the least. It turns out that rent for a one bedroom corner unit in a relatively nice location is $4k/month. To put this in perspective, a two bedroom/two bathroom unit in the penthouse tower in Chicago is $3.2k/month. One would think that high rent and high income taxes would be sufficiently large deterrents.

But inexplicably, I think that I will be sucked into this vortex known as the Bay Area.

05 September 2013

Automobile Shortlist

If you had unlimited funds to obtain the 10 cars of choice, what would you have?
  1. Porsche Boxster (981), daily driver.
  2. Lotus Elise (S2), in which general awesomeness can be had anywhere and everywhere (except in snow and rain).
  3. Jaguar C-X75, for its epic twincharged 4-cyl hybrid powertrain and its wonderful sports bike-like exhaust note.
  4. McLaren MP4-12C, high-speed beast, also nondescript enough for a viable occasional driver
  5. Lexus LF-A, for its lovely F1 exhaust note.
  6. Mercedes-Benz S600 (W222), because Magic Body Control and I need a limo.
  7. Tesla Model X, for all things that require a SUV and the exotic falcon wing doors.
  8. Mercedes-Benz 300SL, because every stable should have a classic, and who can deny gullwings?
  9. Koenigsegg Agera, for the exotic Koenigsegg doors and their no-compromise philosophy reflects what I want to achieve.
  10. Porsche 911 Carrera (991; in Guards Red, of course, and perhaps a GT3), because I've always wanted one as a kid.

02 September 2013


Never apologize for having high standards. People who really want to be in your life will rise up to meet them.

18 August 2013

Union Find

I never understood the point of union find (not after learning it in high school with Dr. Nevard, or even after learning about Kruskal's minimum spanning tree algorithm) until I saw this problem:

A journey to the Moon

The member states of the UN are planning to send two people to the Moon. But there is a problem. In line with their principles of global unity, they want to pair astronauts in such a way, that both are citizens of different countries.

There are N astronauts numbered with identifiers from 0 to N-1. They are qualified and trained to be sent to the moon. But the trouble is that those in charge of the mission haven’t been directly informed about the citizenship of each astronaut. The only information they have is that some particular pairs of astronauts belong to the same country.

Your task is to compute in how many ways they can pick a pair of astronauts satisfying the above criteria, to be sent to the moon. Assume that you are provided enough pairs to let you identify the groups of astronauts even though you might not know their country directly. For instance, if 1,2,3 are astronauts from the same country; it is sufficient to mention that (1,2) and (2,3) are pairs of astronauts from the same country without providing information about a third pair (1,3).

Input Format

The first line contains two integers, N and I separated by a single space. I lines follow. each line contains 2 integers separated by a single space A and B such that

0 ≤ A, B ≤ N-1

and A and B are astronauts from the same country.

Output Format

An integer containing the number of permissible ways in which a pair of astronauts can be sent to the moon.




Sample Input

4 2
0 1
2 3

Sample Output



As persons numbered 0 and 1 belong to same country and 2 and 3 belong to same country. So the UN can choose one person of 0,1 and one out of 2,3. So number of ways of choosing pair is 4.

This pre formatting sucks, but that's beside the point.

Here's my solution:

class DisjointSet(object):
    def __init__(self, vals):
        self.parents = {x: x for x in vals}
    def find(self, x):
        if self.parents[x] == x:
            return x
            return self.find(self.parents[x])
    def union(self, x, y):
        xRoot = self.find(x)
        yRoot = self.find(y)
        self.parents[xRoot] = yRoot
    def sets(self):
        d = {}
        for child in self.parents:
            parent = self.find(child)
            if parent not in d:
                d[parent] = set()
        return d        

N, L = map(int, raw_input().strip().split())
ds = DisjointSet(range(N))
for i in range(1, L+1):
    a, b = map(int, raw_input().strip().split())
    ds.union(a, b)

s = ds.sets()
acc = 0
if len(s) > 1:
    cumsum = [len(x) for x in s.values()]
    for i in range(len(cumsum)-2, 0, -1):
        cumsum[i] += cumsum[i+1]
    for i, x in enumerate(s.values()[:-1]):
        acc += len(x) * cumsum[i+1]
print acc

Maybe someday I will get proper code formatting for my blog.

15 August 2013

Stark Contrast

"That's the difference between you and me," he said. "I just assume that there will be nannies."
--Elon Musk

but s/nannies/supercars/

Source: http://www.marieclaire.com/sex-love/relationship-issues/millionaire-starter-wife

08 August 2013


"I am your wife," I told [Elon Musk] repeatedly, "not your employee."
"If you were my employee," he said just as often, "I would fire you."
Justine Musk's account of her failed marriage: http://www.marieclaire.com/sex-love/relationship-issues/millionaire-starter-wife

07 August 2013

A Summer of Cars: Part III

A generous salesman by the name of Matt at the New England Aston Martin-Lotus dealer volunteered to teach me how to drive a manual. Thanks for making my summer complete!

After arriving at the dealer, we took this beautiful white Lotus Elise to a nearby parking lot. Matt pushed the car quite hard to show me how nimble it was -- very! It showcased the car's favorable power-to-weight ratio.

A bit more about the Elise: it's a sub-2000lb roadster powered by a 180hp Toyota engine. The car is very stripped, whose interior consists of…almost nothing. The mirrors are manually adjusted. The seats don't have a backrest adjustment. The passenger seat is bolted to the chassis. As in, it doesn't move back and forth. And that's why I can't believe this car has power windows.

Now onto the fun part. I've watched several videos of people driving a stick, heel-to-toeing (an advanced technique), and such, but they don't reveal the subtleties. In particular, the clutch behaves more like a sigmoid than a digital function, to my surprise:

When you shift into gear, you (slowly) let go of the clutch until you feel it grabbing the engine, then give the engine some gas, and finally (slowly) release it. Releasing the clutch too fast, and the engine stalls. Release it too slow, and the clutch wears and may start smelling badly.

We started off by starting the car, shifting into first, driving in a large circle, shifting into neutral, and stopping. This took a few tries to get, and even then, I sometimes still had trouble because I was releasing the clutch too quickly after it engaged with the engine.

Next up was shifting into 2nd, which was fairly easy. I pushed the car a little harder by going faster (about 20mph) and making tighter turns while doing figure eights.

Impressed by how quickly I have progressed, Matt let me shift into third, which went smoothly, although an ominous smell emanated from the clutch. Oops!

I then tried starting the car on a 5* hill. The process was more or less the same, but I had to give the car a little more gas to counteract gravity. I took a few tries to get it since I wasn't stepping on the throttle enough.

Finally was reverse. I found this the trickiest, mainly because I suffered from some cognitive dissonance -- I illogically thought that reverse was so different from the forward gears. I got it after a few tries, but wasn't as good was shifting into first, etc.

As for the ride experience, the car is very loud. The engine drones, since it cruises around 3000-3500rpm; if you've sat in the godawful Smart ForTwo, it's a comparable experience. You feel every single imperfection in the road, and know which tires ran over the bump. An accurate description is a box on wheels, or a street legal go-kart. But it's so undeniably lovable, and I think that makes me sad if I were to turn it down.

So here comes the really heartbreaking part: I have to make a choice between the Elise and the 981 Boxster before the end of the year, since the lead time for order a bespoke Porsche is 6 months. (Porsche essentially shuts down the factory to handle all of the special orders at the end of a model year.) I'm not sure if I'll be able to live with the Lotus and its dearth of practicalities, such as next-to-nothing sound deadening, track seats, briefcase-sized trunk, and possibly awkward blind spots.

But for now, I'll live and dream as if I had both.

02 August 2013

Ideal Philosophy

The Koenigsegg philosophy does not tolerate compromise. Rather, we work at innovation in order to avoid compromise completely. Nothing is impossible. This open-mindedness and dedication are what define Koenigsegg and its cars.

29 July 2013

Probably how to not approach a bank

And somehow we found ourselves in a situation where they decided to invest, and I'm like oh my God this is amazing, and you know we're going through all this process and it happened pretty quickly, we showed up on a Friday, bit of handshake deal on Monday night, so one business day turnaround, which was pretty convenient. And then I had this new problem which was, the finance people are like emailing me like okay please send me your wiring instructions. I'm like wiring instructions, like the only training I had wiring instructions was, I think that happened in like James Bond movies, and I'm like I'm pretty sure we only have like the "my first business" checking account from Bank of America that we set up in the CambridgeSide Galleria Mall, and I'm like so this might be tough. So, Arash and I go to the North Beach branch of the Bank of America, and we we're like well, so you got the teller people, and you got the leather seat people, and we look at each other like, it's probably a leather seat problem. And we sit down and the woman was really nice, she was like, how can I help you, and I'm like is there a limit to how much a bank account can hold? And she was like, well what do you mean? And like I was dressed in shorts and a hoody and Arash was even more disheveled, and I'm like well, can it hold $1 million? And she was like yeah, and so, and I don't know if she thought it was like drugs or this kind of thing happens all the time out here, but both sides very quickly stopped asking questions and we got our routing number and everything and went back, but there is no like startup manual where you are like oh, well here is how that works, and so a lot of it is really, even when you look - at some of these amazingly successful companies and having had a chance to meet a lot of those people, so much of what makes startups crazy is just kind of this iterative process of just having these random things happen to you, or having these ideas and just kind of figuring it out. 

--Drew Houston, "Finding Your Way as an Entrepreneur

28 July 2013


We didn't know much about each other twenty years ago. We were guided by our intuition; you swept me off my feet. It was snowing when we got married at the Ahwahnee. Years passed, kids came, good times, hard times, but never bad times. Our love and respect has endured and grown. We've been through so much together and here we are right back where we started 20 years ago--older, wiser--with wrinkles on our faces and hearts. We now know many of life's joys, sufferings, secrets and wonders and we're still here together. My feet have never returned to the ground.

27 July 2013

Gems on Quora: My Motivation

All I Wanted was a Fucking Lambo
With so much talk about changing the world, and making a difference… I’m almost ashamed to admit my initial motivations for starting a business. When I was a management consultant back in NYC, a partner saw my Lamborghini wallpaper on my shitty Lenovo and exclaimed, “That your dream car? You’re not going to get that in THIS business.” I’ll admit, my heart sank a little when I heard that.
A couple months later, I quit and moved out to SF. I didn’t want to be another cog in the wheel anymore, I wanted to do big things, I wanted to make a name for myself, but most importantly, I wanted my fucking Lambo. 
Most people think a Lambo is a symbol of wealth and success, which it is, but for me, it’s more than that. It’s a symbol of personal accomplishment, a trophy that signifies that you’ve created value, and made some sort of impact in this world. And really, it’s just a sexy car… imagine all those numbers from girls! Kidding. (sorta) 
I know I know… material possessions don’t boost happiness in the long term, life is all about experiences, blah blah… People who say that usually don’t own a fucking Lambo. With that said, I love my job, I love my company, and it’s great that I can do all these things and have the goal of owning a Lambo still there, but sitting in the back burner. Here’s the obligatory part of the post where I talk about how awesome building a company is, and how the reward goes beyond just the monetary aspects and that success is more than just becoming rich… yep all that and more. 
But still… even to this day… the car… THAT car… It’s still a small reason why I wake up in the morning wanting to kick ass at what I do.
I think I push myself to work hard not only to be able to provide for my [soon-to-be] family and my parents, but also because I'm scared of living a "normal" life: having to worry about sufficient leisure funds, having to put up with annoyances that can be solved with money, etc etc -- mediocrity, or what seems like the opposite of a fulfilling life.

24 July 2013


Jobs suggested everyone at apple wear the uniforms but they all disagreed and booed him off the stage.
Imagine if everyone at Apple wore black turtlenecks, blue jeans, and New Balance 991 sneakers.

20 July 2013

A Summer of Cars, Part II

Last time, I said I would test drive the Mercedes-Benz SLK and the Lotus Elise. However, neither dealer has a testable car, so I doubt I'm testing either this summer.

Think that's all? Would you like to hear about some Aston Martins?

I thought so.

Today, I went to the joint Aston Martin and Lotus dealer in hopes of testing a Lotus Elise. I thought the dealer was closed when we got there, since it looked quite dim, but I noticed a salesman sitting at his desk. I walk in and head toward the Elise, parked amid several Vantages, Vanquishes, DB-9s, two Evoras, and a couple of classics.

Mercedes 190SL Roadster.

I got to get intimate with the cars. There was an immense amount of detail in the car not captured by marketing materials; I present several below. Getting up close with the cars convinced me to put Aston Martin back on my shortlist.
Glass buttons amid piano black and satin metal trim.

Door sill insignia.

A client picks up his car; fitting for a doctor. Note that the door tilts up when opened, and that the tail light fins have a similar pattern as the Aston Martin emblem wings.

Lotus Evora interior. Surfaces are either leather wrapped or covered with aluminum.

Aston Martin custom interior. Note the matte wood on the center stack. Apologies for the iPhone 5 sapphire flare.

Attractive glass needles on dials. Apologies for the iPhone 5 sapphire flare.

Extruded + on column-fixed paddle shifter.

A tasteful combination of matte burled wood, satin metal, and leather.

Illuminated keyhole.

One more thing…

Orgasmic, isn't it?

19 July 2013

Time, or lack thereof

"I don't like to wait or make my peers wait, but I'll be more than happy to pay for someone to wait for me."

It's depressing that time, a relatively illiquid asset, is considerably more valuable than money.

(Naruto Chapter 250, page 13 -- one of my favorite quotes from the series)

17 July 2013

And I thought I had left the gaming scene

Guess again!

(Don't worry, there's an Xbox 360 hiding down there. The Mac Pro sits there and looks pretty ^^)

Playing Forza 4 with the wheel is so much more pleasant than playing with the controller, despite not having vibration. There is simulated force feedback with a spring on bungee cord (fixed spring constant, unfortunately) inside. I'm also a little sad that the paddle shifters don't reach down to my ring fingers with my hands at the 9 o'clock and 3 o'clock positions, nor are they fixed to the steering column.

There definitely is merit to having a driving simulator when one has the potential to track in a nice car in real life: traveling to various tracks around the world with said car is quite impractical. Also impractical is owning the fleet of cars available in the game.

13 July 2013

Unconditional Love

Main Entry:   unconditional love
Part of Speech:   n
Definition:   affection with no limits or conditions; complete love

If you found out that a person who you deeply love committed a heinous act, would you still love them?

30 June 2013

The Capital of Algorithmic Trading

Welcome to Chicago!

Some observations:
  • It's got the best features of New York City, Boston, and San Francisco: a quick and functional public transportation system, manageable population, and cleanliness!
  • There's a surprising number of Porsches. I counted seven Porsches (about half were 911s) while wandering the streets for most of Saturday.
  • There's not as many Old Man Cars (7/LS/A8/S/XJ) as in New York City. I however did see a Rolls Royce Phantom en route to the airport.
  • The Canon EF 16-35mm f/2.8L lens is amazing. If I could only have one camera and lens, hands down I would use my 5D II with this lens.
Enough prose; what's a blog post without photos? Enjoy!

Night scene from the 58th floor. Underexposed by 2/3 stop.

No city is complete without a Trump Tower.


Crazy concert stadium in the Millennium Park.

Under the bean.



Navy Pier.

City from Navy Pier.

27 June 2013

Why hello there, Mac Pro

I bought a [single processor] Mac Pro on a whim (go figure). My intention was to see whether the Mac Pro 1,1/2,1 heatsink works in the Mac Pro 3,1 models. However, to my delight, the computer came with a magical second processor!

Turns out the computer was from a university. Maybe I should have waited for MIT to throw some out!

Feel free to scan the barcode.

Temporary setup. It probably should not live in front of my dresser.

That's a G5 carcass behind the Mac Pro.

Also, Apple certified FB-DIMMs are legit.

I <3 911s

22 June 2013

A Summer of Cars, Part I

As promised, I have test driven one (1) car a week every week I have been free. Here's a brief writeup of each:

Porsche Boxster (981): Wicked awesome. Great exhaust note, especially with the top down. Accelerates slow enough such that I could enjoy the exhaust note when merging onto highways, or accelerating from red lights. I was surprised that noise isolation was decent with the top up, in contrast to what I've read online. The interior fit and finish is good without full leather, but would be incredibly sumptuous with a special order two-tone natural leather with mahogany wood. I think this car could be a real winner (hey, it won a 10Best award from Car and Driver).

Porsche 911 Carrera (991): Unfortunately, I liked this test drive the least. I found the sport exhaust to be overwhelming; with it enabled while cruising, the exhaust is a loud, unpleasant droning noise. Sport plus mode was exceedingly scary, holding the engine at 5000+ RPM in second gear on the highway. I was also disappointed to find out that I could not fit in the claustrophobic rear seat with an extremely tall driver. So much for the #911fund.

BMW Z4 sDrive30i: Drove a pre-owned one since the dealer doesn't stock Z4s. More of a GT (grand tourer) than the Boxster. Engine roar was good, but quiet for my tastes. Lower quality interior materials than the Boxster, but not sure how a full leather interior would look. Steering was slow and light, unlike the Boxster's, which did not inspire confidence. The car also has poor rearward visibility with the top up. Also, to my horror during the test drive, the temporary license plate fell off when opening the hardtop.

Audi TT 2.0T: Drove a pre-owned one since the dealer doesn't stock TT's. The salesman said that I could "take my time" with the test drive, so I detoured from the normal route and drove on some smaller backroads. The steering was light compared to the Boxsters's, but had a tighter ratio than the Z4's. The accelerator was also very odd; it did not require any effort to push. The engine had unpredictable turbo lag (floor the car and the engine doesn't respond for a second), and did not sound as good compared to those of the Z4 and the Boxster (because of the turbo in the TT). The seats and steering wheel seemed unpadded and were very hard. I was delighted to learn that I can special order one with a manual gearbox to lease.

For kicks and laughs I test drove a Lexus CT200h. In short, it's Lexus's Prius, with the same lethargic powertrain, but considerably better fit and finish. Coming from the TT to a CT in Eco mode, the car was incredibly unresponsive -- pushing the accelerator halfway does practically nothing. Sport mode was marginally better. The car reacted to the throttle, but still moved relatively slowly. The engine roar was an irritating drone that I unconsciously blocked out. Steering was light, but somewhat twitchy. The brake pedal had a very short throw, which took a while to get used to. The synthetic leather feels really odd: it has a much finer grain texture than leather.

Some comments about the dealership experiences: I'm amused that I pass as a potential customer. At ze German dealers, the salesmen were not naggy at all, I think partly because I knew quite a bit about the respective cars. There was also a greater amount of trust: none of the salesmen came on the test drives. This was not the case at the Lexus dealer: the salesmen took every chance to ask if I needed help, and tagged along on the test drive. The Lexus salesman also seemed disappointed when I was "just looking," unlike the respective German marque salesmen.

Next up: Mercedes-Benz SLK and Lotus Elise!