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
src = '''\ | |
Chapter 1 | |
foo | |
- figure 1.1 | |
bar | |
Section 1.1 | |
- figure 1.2 | |
- figure 1.3 | |
baz | |
Section 1.2 |
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
def ispower(a,b): #a==b^i ? | |
while a>1: | |
if a%b==0:a/=b | |
else:return False | |
return True | |
def beal(max_base, max_power): | |
bases, powers, table, pow = initial_data(max_base, max_power) | |
for x in bases: | |
flag2=flag3=False # for 2^m+3^n=z^r x=2^i or x=3^i ? |
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
~> ccg -f github.com/reusee/cowmap -t Key=string,Value=string -r Map=StrStrMap,New=NewStrStrMap | |
import "sync" | |
type StrStrMap struct { | |
v atomic.Value | |
l sync.Mutex | |
} | |
func NewStrStrMap(m map[string]string) *StrStrMap { | |
ret := new(StrStrMap) |
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
require 'weakref' | |
$debug = false | |
SPACE = [' ', "\t"] | |
NEWLINE = ["\r", "\n"] | |
QUOTE = { | |
'"' => '"', | |
"'" => "'", | |
'{' => '}', | |
'(' => ')', |
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 Isred(Redis): | |
def node(self, serial = None): | |
return Node(self, serial) | |
class Node(dict): | |
def __init__(self, r, serial = None): | |
self.redis = r | |
self.serial = str(serial) if serial else r.incr('serial') | |
def __getitem__(self, key): |
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
colo evening | |
syntax on | |
filetype plugin on | |
set autochdir | |
set autoindent | |
set cursorline | |
set dir=~/.vimdir | |
set expandtab | |
set fileencoding=utf-8 |
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
local yield = coroutine.yield | |
local create = coroutine.create | |
local status = coroutine.status | |
local resume = coroutine.resume | |
local setmetatable = setmetatable | |
local next = next | |
local pop = table.remove | |
local insert = table.insert | |
local type = type | |
local pairs = pairs |
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: utf8 | |
import re | |
class Formatter(dict): | |
def __init__(self, input_file): | |
dict.__init__(self) | |
xml_source = open(input_file, 'r') | |
for line in xml_source.xreadlines(): | |
line = line.strip() |
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
\ProvidesClass{kindle} | |
\LoadClass{book} | |
\usepackage[margin=0mm,top=1mm,bottom=1mm,papersize={90mm,120mm}]{geometry} | |
\usepackage{xltxtra} | |
\usepackage{fontspec} | |
\setmainfont{LiHei Pro} | |
\pagestyle{empty} | |
\sloppy | |
\XeTeXlinebreaklocale "zh" |
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 <iostream> | |
#include <list> | |
using std::list; | |
using std::string; | |
using std::cout; | |
using std::endl; | |
#define ROOT_BITS 8 | |
#define REST_BITS 8 | |
#define REST_NUM 3 |
OlderNewer