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
dataChunks(4, function (idx) { | |
return orzo.fileChunkReader(env.inputArgs[0], idx, null, 1); | |
}); | |
applyItems(function (dataChunk, map) { | |
while (dataChunk.hasNext()) { | |
map(dataChunk.next()); | |
} | |
}); |
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
""" | |
KonText vs. Manatee - multi-dimensional frequency distribution | |
words = manatee.StrVector() | |
freqs = manatee.NumVector() | |
norms = manatee.NumVector() | |
crit = 'opus.rokvyd 0 opus.genre 0' | |
corpus.freq_dist(range_stream, crit, limit, words, freqs, norms) | |
""" |
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 os | |
import argparse | |
import random | |
import hashlib | |
from functools import partial | |
import shutil | |
class TreeWalker(object): |
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
# an URL shortener | |
from hashlib import md5 | |
chars = ( | |
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', | |
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', | |
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', | |
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' | |
) |
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 (exports) { | |
'use strict'; | |
/** | |
* | |
* @constructor | |
*/ | |
function DoAll() { | |
this.actions = []; | |
this.confirms = []; |
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 | |
import hashlib | |
def process_item(item): | |
rec = item['_source'] | |
rec['isQuery'] = rec.pop('entryQuery') | |
if rec.get('action', None) in ('wsketch', 'thes', 'wsdiff'): | |
rec['isQuery'] = True |
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 partition(data, left, right, pivot_idx): | |
pivot_value = data[pivot_idx] | |
real_pivot_idx = left | |
data[pivot_idx], data[right] = data[right], data[pivot_idx] | |
for i in range(left, right + 1): | |
if data[i] < pivot_value: | |
data[i], data[real_pivot_idx] = data[real_pivot_idx], data[i] | |
real_pivot_idx += 1 | |
data[right], data[real_pivot_idx] = data[real_pivot_idx], data[right] | |
return real_pivot_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
(function () { | |
'use strict'; | |
var foo, bar1, bar2; | |
function Foo () { | |
this.counter = { i : 0}; | |
this.counter2 = 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 <string> | |
/* | |
How to install: | |
1) compile the module: | |
g++ -Wall -fPIC -DPIC -shared -o ucnkdynfn.so ucnkdynfn.cc |
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 Nothing() {} | |
function Just(x) { | |
this.x = x; | |
} | |
function divide(a, b) { | |
if (typeof a !== 'number' || typeof b !== 'number' || b === 0) { | |
return new Nothing(); |
OlderNewer