% self  % total  name
 68.90    68.90  sleeping - ci/ruby-programs/day.rb
 10.33    10.33  black_panther - ci/ruby-programs/day.rb
  6.99     6.99  learn - ci/ruby-programs/day.rb
  6.89     6.89  eat - ci/ruby-programs/day.rb
  6.89     6.89  clean - ci/ruby-programs/day.rb
  0.00   100.00  block in <main> - ci/ruby-programs/day.rb
  0.00   100.00  <main> - ci/ruby-programs/day.rb
  0.00   100.00  <c function> - unknown
# to try this you'll need to edit in the name of your ruby binary and install bcc-tools
# bcc installation instructions are at
from __future__ import print_function
from bcc import BPF
from time import sleep
import os
# load BPF program
View freeze-mac.c
#include <mach/mach_init.h>
#include <mach/port.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
int main() {
for (;;) {
pid_t pid = fork();
if (pid == 0) execv("/usr/bin/true", NULL);
View regexp_compilation.rb
require 'pathname'
def chop_basename(path)
base = File.basename(path)
if /\A#{SEPARATOR_PAT}?\z/ =~ base
return nil
return path[0, path.rindex(base)], base
View things_i_don'

things I don't know

I took this list from What CS majors should know.

I think it is fun to list things I don't know so I did it =D. I actually found it to be a cool exercise -- maybe I should do a fun graphics project and learn about Open GL!

i wrote this because, while i think the things on this list are potentially worth knowing, and I actually think it's an awesome list of project ideas as well as good food for thought for people developing CS curricula (many of the things I don't know are great exercises!) -- I thought it was really weird to say that every CS student should know all of them. I have a CS degree and I learned very few of the things I do know inside my degree.

I classify "do know" as anything that I have a reasonable grasp of or at least some basic experience with -- the kind of experience I'd expect a CS student to be able to get. If I say I don't know something, it means either I know pretty much nothing about it (for "gr


You are trying to make a lot of simulataneous network connections to localhost. You get up to about 2000 HTTP requests per second, when your CPU usage goes up to 100% on all cores.

perf top reports the following:

 31.01%  [kernel]                    [k] inet_csk_bind_conflict
 20.60%  [kernel]                    [k] inet_csk_get_port
  9.82%  [kernel]                    [k] _raw_spin_lock
  4.62%  perf                        [.] 0x0000000000038ba1
  3.90%  [kernel]                    [k] _raw_read_unlock_bh
import random
import gevent
from collections import defaultdict
class ReadError(Exception):
class Connection(object):
def __init__(self):

why I didn't understand Bundler

Yesterday I was having drinks with @sferik, and I mentioned that I find Bundler really confusing, more confusing than virtualenv. And then he called me on it and was like "okay but why?"

And I think we figured it out! And it wasn't just that I know the Python ecosystem better than the Ruby one (though I do). Here's the story. (it doesn't have much to do with bundler, and it might not be true, but it felt satisfying to me)

In 2012, I wanted to install Octopress. I already had some Rubies on my computer, and Octopress had helpful instructions telling me to bundle install. It did not work and I was real sad.

the story gets real simple real fast: if you want to install a Python package, it almost always works with Python 2.7. If you have any Python on your computer and it was installed in the last couple years, you have Python 2.7.


Diversity needs resources.

ideas are great. here are some great ideas. you however cannot implement ideas without resources, which basically means money. I am a lot less interested in ideas for a company right now that aren't backed by that company's money / staff.

a few ways to use resources:

  • do you have 2 awesome recruiters who want to do more? let them do it full time.
  • sponsor your employees to give talks about things they care about. (mentorship? good management? =D)
  • systematically reward people for doing diversity work. give them promotions or raises. let everyone know that's how it works.
  • sponsor events (like AlterConf) in your office, and give them organizational support.