Skip to content

Instantly share code, notes, and snippets.

View aethanyc's full-sized avatar

Ting-Yu Lin aethanyc

  • Portland, OR, USA
  • 11:03 (UTC -07:00)
View GitHub Profile
@jboner
jboner / latency.txt
Last active May 18, 2025 17:44
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
@alexott
alexott / minimial-cedet-config.el
Created October 22, 2012 07:30
Working configuration for CEDET from bzr & GNU Emacs (with working C++ & Java name completion)
;;; minimial-cedet-config.el --- Working configuration for CEDET from bzr
;; Copyright (C) Alex Ott
;;
;; Author: Alex Ott <[email protected]>
;; Keywords: cedet, C++, Java
;; Requirements: CEDET from bzr (http://cedet.sourceforge.net/bzr-repo.shtml)
;; Do checkout of fresh CEDET, and use this config (don't forget to change path below)

NOTE: This was first authored on 26 Feb 2014. Things may have changed since then.

C++'s Templates

C++'s templates could be seen as forming a duck typed, purely functional code generation program that is run at compile time. Types are not checked at the initial invocation stage, rather the template continues to expand until it is either successful, or runs into an operation that is not supported by that specific type – in that case the compiler spits out a 'stack trace' of the state of the template expansion.

To see this in action, lets look at a very simple example:

template 
@mnjul
mnjul / pull.sh
Last active August 29, 2015 14:04
Pull & Extract / Pack & Push omni.ja from/to FxOS phone
adb pull /system/b2g/omni.ja
rm -rf omni.old
mv omni omni.old
mkdir omni
mv omni.ja omni
cd omni
unzip omni.ja
rm omni.ja
cd ..
// ==UserScript==
// @name Get Wiki format
// @namespace bugzilla
// @include https://bugzilla.mozilla.org/show_bug.cgi?id=*
// @version 1
// @grant GM_setClipboard
// ==/UserScript==
var title = document.getElementById("mode-container");
var button = document.createElement("button");
button.type = "button";
// ==UserScript==
// @name Get Wiki format for dashboard
// @namespace bugzilla
// @include https://bugzilla.mozilla.org/page.cgi?id=mydashboard.html
// @version 1
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_setClipboard
// ==/UserScript==
$("#query_count_refresh").append("<span>|</span><input type=button value='To Wiki' id='to-wiki-button' />")
@astleychen
astleychen / standing.sh
Last active October 3, 2017 16:07
A script to dump contributors standings in a period of time in a mercurial repo.
#!/bin/bash
# == Arguments ==
# $1 : date range, exp: "2016-07-01 to 2016-09-30"
# $2 ~ $n : bug mail list, exp: [email protected]
#
# == Output ==
# Individual standings and sum of standings.
dateRange="$1"
@MatsPalmgren
MatsPalmgren / general-fragmentation-bug-fallback.md
Last active July 26, 2020 04:23
General fallback mechanism for fragmentation bugs

Consider the following testcase:

<!DOCTYPE HTML>
<style>
body { font-size: 32pt; margin:0; }
</style>

<div style="color:blue">
<div style="position:absolute; top:calc(100% - 20px); border:1px solid">Hello</div>
 1