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
/* inline codes are within two ` */ | |
'a``b``c``d`e``f'.split(/``((?:[^`]|`[^`])*)``/) | |
/* ["a", "b", "c", "d`e", "f"] */ |
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
var tknz = typeof require === 'undefined' ? window.tokenizer | |
: require('./tokenizer'); | |
var t = tknz.Tokenizer(); | |
t | |
.simpleSymbols('=+-*/%<>!.', 'operator') | |
.simpleSymbols('(', 'op_paren') | |
.simpleSymbols(')', 'cl_paren') | |
.simpleSymbols('{', 'op_brace') | |
.simpleSymbols('}', 'cl_brace') | |
.simpleSymbols(';', 'semicolon') |
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 cartesianProduct(sets) { | |
return sets.reduce(function(items, nextSequence) { | |
return nextSequence.map(function(element) { | |
return items.map(function(item) { | |
var copyItem = item.slice(0); | |
copyItem.push(element); | |
return copyItem; | |
}); | |
}).reduce(function(sum, current) { | |
return sum.concat(current); |
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 <unistd.h> | |
#include <sys/wait.h> | |
int main(int argc, char* argv[]) | |
{ | |
if (argc == 1) { | |
fprintf(stderr, "Usage:\n"); | |
fprintf(stderr, "keeprun prog arg0 arg1 ..."); | |
return 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
# encoding=utf-8 | |
# from http://bbs.eve-china.com/thread-583164-1-1.html | |
SHIP_REPROCESSING = { | |
'Incursus': { | |
u'三钛合金': 11528, | |
u'类晶体胶矿': 9882, | |
u'类银超金属': 3656, | |
u'同位聚合体': 7, |
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 sys | |
import os | |
import tempfile | |
import uuid | |
import subprocess | |
import collections | |
def parse_seq(sequence): | |
Segment = collections.namedtuple('Segment', 'epnum,start,duration,subt') | |
result = [] |
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 sys | |
import json | |
FIXED_WIDTH = len('_________') | |
FIXED_HEIGHT = 6 | |
def map_characters(string, typo_group): | |
return { | |
string[col]: [typo_group[row][col * (1 + FIXED_WIDTH): |
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 Group(object): | |
pass | |
class Sequence(Group): | |
def __init__(self, suit, starting_rank): | |
self.suit = suit | |
self.starting_rank = starting_rank | |
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
template <typename Iterator, typename Function> | |
Function for_each_i(Iterator begin, Iterator end, Function f) | |
{ | |
typedef decltype(*begin) value_type; | |
int i = 0; | |
return std::move(std::for_each(begin, end, [&](value_type& e) {f(i++, e);})); | |
} |
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 sys | |
import uuid | |
import random | |
from datetime import datetime | |
import redis | |
prefix = str(uuid.uuid4()) | |
groups = 20 | |
run_per_group = 1000 | |
total = groups * run_per_group |
OlderNewer