Skip to content

Instantly share code, notes, and snippets.

View Kazark's full-sized avatar

Keith Pinson Kazark

  • Undisclosed
View GitHub Profile
@jeetsukumaran
jeetsukumaran / custom_iterator.cpp
Created February 18, 2010 02:33
Sample C++/STL custom iterator
// Sample custom iterator.
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558)
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
@tobym
tobym / vim_url_regex_syntax_hightlighting.vim
Created September 17, 2010 20:34
Vim-formatted regular expression to match a URL for syntax highlighting
" File: .vim/syntax/rdoc.vim
" RDoc inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
" ------------ _____________________ --------------------------- ________________________ ----------------- __
syntax match rdocInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
HtmlHiLink rdocInlineURL htmlLink
@chadselph
chadselph / patternmatching.py
Last active February 15, 2024 14:45
Functional language style pattern matching in python with a decorator
from collections import defaultdict
class BadMatch(NameError):
"""Exception when your args don't match a pattern"""
pass
class Any(object):
"""
>>> 'wutup' == Any()
True
@DNNX
DNNX / glob.bat
Created December 15, 2011 14:18
Glob expanding: Windows vs Unix vs PowerShell
SETLOCAL ENABLEDELAYEDEXPANSION
SET FILES=
FOR %%A IN (%1\*.gz) DO ( SET FILES=!FILES! %%A )
echo !FILES!
@ynkdir
ynkdir / wdiff.vim
Created January 18, 2012 14:28
wdiff.vim
" Usage:
" Copy this file to your ~/.vim/autoload directory.
" :edit oldfile
" :new newfile
" :call wdiff#highlight(2, 1) " wdiff#highlight(winnr1, winnr2)
let s:save_cpo = &cpo
set cpo&vim
function wdiff#highlight(Awinnr, Bwinnr)

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@rmartinho
rmartinho / darray2d.h
Created October 26, 2012 17:05
Two-dimensional array with dimensions determined at runtime
// Two-dimensional array with dimensions determined at runtime
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@bloodyowl
bloodyowl / README.md
Last active December 10, 2015 19:08
WTFJS

WTFJS

WTF?

Rules

A WTF expression :

  • is wrapped inside ()
  • starts with ([] + []) to define a new String