I hereby claim:
- I am olbat on github.
- I am olbat (https://keybase.io/olbat) on keybase.
- I have a public key whose fingerprint is D1CC 3AE0 5ADA FF27 BEE6 27B7 0B1A 5390 865E 24D7
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
require "xml" | |
require "c/dlfcn" | |
PKGNAME = "icu-uc" | |
TESTFUNC = "u_init" | |
{% if flag?(:darwin) %} | |
SOFILE = "libicuuc.dylib" | |
{% elsif flag?(:windows) %} | |
SOFILE = "libicuuc.dll" | |
{% else %} |
src = STDIN.read | |
# iterate on "1st level" module definitions | |
src.dup.scan(/^module [^;]+$.+?^end/m) do |mod| | |
# get the nested modules' definitions | |
mdefs = mod.scan(/^ *module [^\n]+$(?=\n +module)/m).map(&:to_s) | |
# stop if there is no nested module definition | |
next if mdefs.empty? | |
ndefs = mdefs.size | |
# get the last definition that's not extracted because of the look ahead |
require "benchmark" | |
require "./src/icu" | |
REPEAT=1_000 | |
# from https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt | |
samples = [] of String | |
samples << <<-EOS | |
Σὲ γνωρίζω ἀπὸ τὴν κόψη | |
τοῦ σπαθιοῦ τὴν τρομερή, |
module Process::KillRecursive | |
refine Process.singleton_class do | |
def children(pid) | |
pids = nil | |
if RbConfig::CONFIG['host_os'] =~ /linux/i | |
if File.exist?("/proc/#{pid}/task/#{pid}/children") | |
pids = File.read("/proc/#{pid}/task/#{pid}/children").split(/\s/) | |
end | |
elsif !Gem.win_platform? | |
pids = `ps --ppid #{pid} -o pid=`.split("\n") |
module Time::Measure | |
refine Time.singleton_class do | |
def measure(&_block) | |
tstart = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
yield if block_given? | |
(Process.clock_gettime(Process::CLOCK_MONOTONIC) - tstart) | |
end | |
end | |
end |
#!/usr/bin/env python3 | |
""" | |
usage: {} < corpus.json > plot.pdf | |
The corpus file must contain one JSON document per line, | |
features must be stored in a field names "{}", | |
classes in a field names "{}". | |
""" | |
import sys |
#!/usr/bin/python3 | |
""" | |
usage: {} title data.txt [data2.txt ...] > histogram.png | |
""" | |
import sys | |
import math | |
import os.path | |
import matplotlib | |
matplotlib.use('Agg') |
#!/usr/bin/python3 | |
import sys | |
import unicodedata | |
import regex # https://pypi.python.org/pypi/regex/ | |
SPECIAL_CHARS = r"\-'" # FIXME: French specific | |
RE_WHITESPACES = regex.compile(r"\p{Zs}+") | |
RE_SENTENCE_TERMS = regex.compile(r" *\p{STerm}+ *") |