See https://github.com/romainl/vim-rnb for an up-to-date version.
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
import argparse | |
from mock import Mock | |
m = Mock() | |
parser = argparse.ArgumentParser() | |
subparsers = parser.add_subparsers() | |
query_group = subparsers.add_parser('query') | |
add_group = subparsers.add_parser('add') |
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 (~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 |
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
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
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
(* simple lisp interpreter *) | |
type sym = string | |
datatype exp = Sym of sym | |
| List of exp list | |
| Num of int | |
| Str of string | |
| Bool of bool | |
| Lam of (sym list) * ((sym * exp) list) * exp |
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
function chcc { | |
case "$1" in | |
--unset) unset CC ; unset CXX ;; | |
clang) export CC=clang ; export CXX=clang++ ;; | |
gcc) export CC=gcc ; export CXX=g++ ;; | |
distcc) export CC=distcc ; export CXX=distcc ;; | |
llvm-gcc) export CC=llvm-gcc ; export CXX=llvm-g++- ;; | |
llvm-gcc-4.8) export CC=llvm-gcc-4.8 ; export CXX=llvm-g++-4.8 ;; | |
arm) export CC=arm-linux-gnueabi-gcc ; export CXX=arm-linux-gnueabi-g++ ;; |
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
" Delete surrounding function call | |
" Relies on surround.vim | |
" | |
" function_call(cursor_here) => dsf => cursor_here | |
" | |
" Try `dsf` with more complicated structures: | |
" | |
" nested(function_call(cursor_here)) | |
" nested(cursor_here(chewy_center)) | |
" One::Two.new([cursor_here]) |
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
package LinkedListA0; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class LinkedListImplTest { | |
@Test | |
public void clearEasy() { |
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
package BST_A2; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class BSTTest { | |
@Test | |
public void testFindMin() { |
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
" :[range]SortGroup[!] [n|f|o|b|x] /{pattern}/ | |
" e.g. :SortGroup /^header/ | |
" e.g. :SortGroup n /^header/ | |
" See :h :sort for details | |
function! s:sort_by_header(bang, pat) range | |
let pat = a:pat | |
let opts = "" | |
if pat =~ '^\s*[nfxbo]\s' | |
let opts = matchstr(pat, '^\s*\zs[nfxbo]') |
OlderNewer