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> | |
#include <stdlib.h> | |
#include <string.h> | |
#define DATA_FILE "./rand.txt" | |
#define N 1000000 | |
void my_msort(int* ary, int stack_level, int sidx, int eidx) { | |
int i, j, tmp; | |
int len = eidx - sidx + 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#define MAX 10000000 | |
void bit_true(char* vec, int pos) { | |
int char_idx = pos / 8; | |
int bit_idx = pos % 8; | |
int mask = 1 << bit_idx; |
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
# coding: utf-8 | |
# only works on 1.9+ | |
# base idea is from: | |
# - http://stackoverflow.com/questions/2583472/regex-to-validate-json | |
# - http://www.slideshare.net/takesako/shibuyapm16-regexpjsonvalidator | |
module JsonMatcher | |
NUMBER = /-? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)?/x | |
BOOLEAN = /true | false | null/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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import tornado.web | |
import tornado.httpserver | |
import tornado.gen | |
import tornado.ioloop | |
import functools | |
import collections | |
import pprint |
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 java.util.Random; | |
public class ThreadLocalTest implements Runnable { | |
public static final Random RAND = new Random(); | |
public static int counter = 1; | |
public static class MyObject { | |
private final int n; | |
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
class LTSV { | |
static Map parse(String str) { | |
var pairs = str.trim().split("\t"); | |
var ret = {}; | |
for (var pair in pairs) { | |
var chunks = pair.split(":"); | |
var name = chunks.removeAt(0); | |
ret[name] = chunks.join(":"); | |
} |
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
imap <C-j> <esc> | |
set backspace=indent,eol,start | |
noremap | |
noremap! | |
noremap <BS> | |
noremap! <BS> | |
set number |
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
setopt prompt_subst | |
setopt print_eight_bit | |
setopt no_flow_control | |
setopt hist_ignore_dups | |
setopt hist_reduce_blanks | |
#setopt share_history | |
HISTFILE=~/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 |
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
escape | |
startup_message off | |
#attrcolor b ".I" | |
defbce on | |
term xterm-256color | |
termcapinfo xterm* ti@:te@ | |
termcapinfo xterm-256color 'is=J7h1;4;6l' | |
vbell off | |
hardstatus alwayslastline "%`%-w%{=b bw}%n %t%{-}%+w" | |
autodetach on |
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(){ | |
// do something onready | |
]}); |