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
#compile g++ -Wall re2test.cpp -o re2.out -lre2 -lpthread | |
#include <iostream> | |
#include <string> | |
#include <re2/re2.h> | |
#include <cassert> | |
using namespace std; | |
int main(int argc, char **argv){ |
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 <string> | |
#include <re2/re2.h> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
string str("あぶらかたぶら"); |
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 <string> | |
#include <re2/re2.h> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
string str("あぶらかたぶら"); |
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 <string> | |
#include <re2/re2.h> | |
#include <vector> | |
using namespace std; | |
void test_fullmatch(){ | |
string s,t; | |
string str("あぶらかたぶら"); |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'URI' | |
file = ARGV.shift | |
num_split = ARGV.shift.to_i | |
order = Math::log10(num_split).truncate + 1 | |
url_hash = {} |
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 lvc() { if [ -f $1 ]; then pygmentize -O encoding=utf-8 "$1" |lv -c; fi; } |
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
``` | |
$ pip install pygments | |
``` | |
``` | |
$ diff templates.py templates.py.old | |
57d56 | |
< filenames = ['*.erb'] | |
``` |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import Mykytea | |
import sys, codecs | |
class WordSegmenter: | |
def __init__(self, opt = "-out tok"): | |
self.mk = Mykytea.Mykytea(opt) | |
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 'narray' | |
require 'rational' | |
phi = NMatrix.object(3,4).collect!{ Rational(rand(10)) } | |
t = NVector.float(4).collect!{ Rational(rand(10)) } | |
w = (phi.transpose * phi).lu.solve(phi.transpose * t) |
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
foo = 'foo' | |
str = <<EOS, foo | |
hoge | |
EOS | |
# => ["hoge\n", "foo"] |
OlderNewer