Skip to content

Instantly share code, notes, and snippets.

@zettoone
zettoone / lisp.hs
Created January 7, 2012 22:59
Minimal Lisp in Haskell
{-# 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)
@zettoone
zettoone / .gitignore
Created January 13, 2012 01:15 — forked from bkeepers/.gitignore
My Sublime settings
*
@zettoone
zettoone / .gitconfig
Created January 25, 2012 22:51
git tricks
# 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
@zettoone
zettoone / default_mathjax.html
Created July 24, 2012 03:36
Jekyll MathJax Template Layout
<!-- 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']
}
});
@zettoone
zettoone / style.css
Created July 24, 2012 03:51
jekyll MathJax Template
body div.content {}
body div.content code.has-jax {
font: inherit;
font-size: 100%;
background: inherit;
border: inherit;
color: #000000;
}
@zettoone
zettoone / typechecking_macros.c
Created November 6, 2012 06:19
Typechecking macro in c
#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); \
Windows Registry Editor Version 5.00
; Sublime Text 2 "Open With" context menu for files and folders.
; Also assigns the icon to the menu item.
; By Danik
;
; IMPORTANT!
; You need to replace all the paths to sublime_text.exe if it's
; installed in a different location than
; C:\Program Files\Sublime Text 2\sublime_text.exe
@zettoone
zettoone / latency.txt
Created December 31, 2012 05:21 — forked from jboner/latency.txt
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
@zettoone
zettoone / DX11.lua
Last active December 13, 2015 22:19
premake4 script collections
-- 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=\"{(.+)}\""
@zettoone
zettoone / phrases.txt
Last active December 13, 2015 23:39
ibus自用短语, 丢去~/.config/ibus/pinyin/phrases.txt
fu=╭∩╮(︶︿︶)╭∩╮
songjian=╮( ̄﹏ ̄)╭
naive=Θ..Θ
xianzhuo=(ノ=Д=)ノ┻━┻
xianzhuo=(╯#-_-)╯~~╧═╧
xianzhuo=(/థฺ౪థ)/~~╧═╧
aojiao=(/>///<)/~~╧═╧