Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@aprell
aprell / jmp.c
Created March 1, 2012 17:34
Switching between coroutines/tasks: setjmp/longjmp (single stack)
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <setjmp.h>
#include <assert.h>
#include <unistd.h>
#include <time.h>
#include "list.h"
@jboner
jboner / latency.txt
Last active July 16, 2024 16:04
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@yamaya
yamaya / xcode-clang-vers
Last active June 21, 2024 08:25
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
anonymous
anonymous / FenwickTreeBitmap32.cs
Created November 22, 2013 03:18
A Fenwick tree for slot usage tracking of 32 slots in a 64 bit bitmap
namespace TryOuts
{
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
/// <summary>
/// Tracker for usage of a block of 32 consecutive slots. Implemented as a
/// Fenwick tree with indexing optimized for queries. Encodes this
/// information into a long (64 bit) value, while leaving the high bit
anonymous
anonymous / UsageTrackingBlock.cs
Created November 22, 2013 03:48
A tracker of slot usage for a region spanning a total of 2^14 (16384) slots, in a total of 3072 bytes using a combination of a Fenwick tree and a bitmap vector.
namespace TryOuts
{
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
/// <summary>
/// Tracks usage of a block of 2^14 (16384) slots using a bitmap that
/// contains the 16384 used/free bit flags for each slot (taking up a
/// total space of 2048 bytes, accessed as an array of 512 ints), in
Tom Moertel <tom@moertel.com>
2013-12-16
We are given the following problem:
Given a text file with 999,999 lines, one number per line,
numbers in random order from 1 to 1,000,000 but a single number is
missing, figure out what number is missing.
Source: http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html#comment-1165807320
@Faxn
Faxn / fun.py
Last active October 15, 2020 05:11
We are given the following problem: Given a text file with 999,999 lines, one number per line, numbers in random order from 1 to 1,000,000 but a single number is missing, figure out what number is missing. Source: http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html#comment-1165807320
import argparse, locale, timeit, random
from math import *
"""
We are given the following problem:
Given a text file with 999,999 lines, one number per line,
numbers in random order from 1 to 1,000,000 but a single number is
missing, figure out what number is missing.
Source: http://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html#comment-1165807320
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define rgbtoy(b, g, r, y) \
y=(unsigned char)(((int)(30*r) + (int)(59*g) + (int)(11*b))/100)
#define rgbtoyuv(b, g, r, y, u, v) \