Skip to content

Instantly share code, notes, and snippets.

@tetsuok
tetsuok / en-ja-tree-to-string.pdf
Created June 23, 2012 20:18
An example of English-Japanese pair with human-annotated parse trees and word alignments
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tetsuok
tetsuok / word-alignment.tex
Created June 23, 2012 18:24
Draw word alignment matrix.
% Note: works only for XeLaTeX.
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usepackage{zxjatype}
\setjamainfont[Scale=0.8]{Hiragino Kaku Gothic Pro W3}
\setmainfont[Mapping=tex-text,Scale=MatchLowercase]{Helvetica} % \sffamily
\setsansfont[Scale=MatchLowercase]{Helvetica} % \sffamily のフォント
\usepackage{xltxtra}
\begin{document}
@tetsuok
tetsuok / fig_cpd.pdf
Created June 18, 2012 18:33
Figure generator for Centroid Path Decomposition
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tetsuok
tetsuok / unnamed_type.cc
Created June 18, 2012 16:53
unnamed type
// clang++ 3.1 warns template argument uses unnamed type [-Wunnamed-type-template-args],
// but compiles without error although GCC (4.2, 4.4.3) complained.
#include <algorithm>
#include <vector>
using namespace std;
enum {
SENTINEL = -1
@tetsuok
tetsuok / build_moses_with_regtest.sh
Created June 16, 2012 12:04
Build script for Moses with regression tests.
#!/bin/sh -x
num_cpu=32
path_to_moses=`pwd`
path_to_srilm=$HOME/local/src/srilm
test_num=10
path_to_regtest=$path_to_moses/regression-testing/moses-reg-test-data-$test_num
./bjam -j$num_cpu toolset=gcc \
--with-boost=/usr/include \
--with-srilm=$path_to_srilm \
@tetsuok
tetsuok / build_rampion.sh
Created June 7, 2012 09:10
Build script for Rampion.
#!/bin/sh -x
# Build script for Rampion (Gimpel & Smith, NAACL 2012).
#
# Tested rampion v0.1 on Mac OS X 10.7 and Linux.
src=rampion-v0.1.tar.gz
url=http://www.ark.cs.cmu.edu/MT/$src
# detect os, and set the number of jobs to run make.
ncpu=
downloader=
@tetsuok
tetsuok / filter.go
Created June 6, 2012 09:01
Grep like filter in Go
// Copyright 2012 Tetsuo Kiso.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@tetsuok
tetsuok / ls.go
Created June 6, 2012 04:19
ls utility in Go.
// simulates "ls -l"
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
)
@tetsuok
tetsuok / latency.txt
Created May 31, 2012 17:11 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@tetsuok
tetsuok / cat.go
Created May 27, 2012 00:34
An implementation of cat in Go.
// A simple cat(1) implementation in Go.
//
// Build Instructions:
//
// $ go build -o cat
//
// Usage:
//
// Basically, the usage is same as cat(1).
//