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 | |
L0 = sys.argv[1] | |
N = int(sys.argv[2]) | |
alpha = set("abcdefghijklmnopqrstuvwxyz") | |
words = set() | |
for L in open("words_alpha.txt"): | |
L = L.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
function e(type, opts) { | |
var i; | |
if (!opts) opts = {}; | |
i = type.indexOf("."); | |
if (i >= 0) { opts.className = type.slice(i+1); type = type.slice(0, i); } | |
i = type.indexOf("#"); | |
if (i >= 0) { opts.id = type.slice(i+1); type = type.slice(0, i); } | |
var d = document.createElement(type||"div"); | |
if (opts.className) d.className = opts.className; | |
if (opts.id) d.id = opts.id; |
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
#if !defined(LOG_H_INCLUDED) | |
#define LOG_H_INCLUDED | |
#include <stdio.h> | |
#include <vector> | |
#include <string> | |
#include <deque> | |
#include <map> | |
#include <functional> | |
#include <time.h> |
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
#if !defined(REFCOUNT_H_INCLUDED) | |
#define REFCOUNT_H_INCLUDED | |
#include <atomic> | |
#include <algorithm> | |
struct RefCounted { | |
std::atomic_int refcount; | |
RefCounted() : refcount(0) {} | |
}; |
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 <stdarg.c> | |
#include <string> | |
#include <vector> | |
std::string stringf(const char *fmt, ...) { | |
std::vector<char> buffer(256); | |
va_list args, cp; | |
va_start(args, fmt); | |
va_copy(cp, args); | |
int sz = vsnprintf(&buffer[0], buffer.size(), fmt, args); |
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 strip_comments(s) { | |
return s.replace(/[ \t\r\n]+|\/\*(?:[^*]|[*][^\/])*\*\/|\/\/[^\n]*\n|"(?:[^\\"]|\\.)*"|[^ \t\r\n"\/]+/g, | |
function(s){ return (" \t\r\n\/".indexOf(s[0])==-1) ? s : ""; }); | |
} |