This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{- To Run: | |
Load in ghci | |
:set -XOverloadedStrings (for convenience) | |
Execute repl expr -} | |
import Control.Applicative | |
import Data.Attoparsec hiding (Result) | |
import Data.Attoparsec.Char8 (char8, isDigit_w8, isSpace_w8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A few `git log` commands where things are nicely aligned | |
# from http://pyrtsa.posterous.com/aligning-your-git-logs and https://gist.github.com/1327258 | |
# Dependent on Gawk (brew install gawk in OsX) | |
[alias] | |
l50 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-50s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f" | |
l80 = "!f () { git log --abbrev-commit --date=short --pretty=format:'%h%x00%cd%x00%s%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-80s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{79}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5 }' | less -R; }; f" | |
lg50 = "!f () { git log --graph --color=always --abbrev-commit --date=relative --pretty=format:'%x00%h%x00%s%x00%cd%x00%an%x00%d' $@ | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m %-50s \\033[32m%14s\\033[0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- MathJax Section --> | |
<script type="text/javascript" | |
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | |
<script> | |
MathJax.Hub.Config({ | |
tex2jax: { | |
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'] | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body div.content {} | |
body div.content code.has-jax { | |
font: inherit; | |
font-size: 100%; | |
background: inherit; | |
border: inherit; | |
color: #000000; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define min_t(type, x, y) ({ \ | |
type __min1 = (x); \ | |
type __min2 = (y); \ | |
__min1 < __min2 ? __min1: __min2; }) | |
/* generate warning if the types are unmatched: "comparison of distinct pointer types lacks a cast" */ | |
#define min(x, y) ({ \ | |
typeof(x) _min1 = (x); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
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 | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- premake4 script for DirectX11 project with proper library linkages | |
local action = _ACTION or "" | |
------------------------------------------------------------------- | |
-- Maintain VS project guid between regenerations | |
------------------------------------------------------------------- | |
local fileext = "vcproj" | |
local pattern = "ProjectGUID=\"{(.+)}\"" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fu=╭∩╮(︶︿︶)╭∩╮ | |
songjian=╮( ̄﹏ ̄)╭ | |
naive=Θ..Θ | |
xianzhuo=(ノ=Д=)ノ┻━┻ | |
xianzhuo=(╯#-_-)╯~~╧═╧ | |
xianzhuo=(/థฺ౪థ)/~~╧═╧ | |
aojiao=(/>///<)/~~╧═╧ |
OlderNewer