Skip to content

Instantly share code, notes, and snippets.

@tetsuok
tetsuok / compile_clang.md
Last active December 28, 2018 12:46
Compile Clang/LLVM

Setup

$ brew install cmake
$ brew install ninja

Getting the source

$ git clone http://llvm.org/git/llvm.git
$ cd llvm/tools
$ git clone http://llvm.org/git/clang.git
$ cd clang/tools

$ git clone http://llvm.org/git/clang-tools-extra.git extra

@tetsuok
tetsuok / .gitattributes
Last active August 29, 2015 14:07
Const pointer rules
*.png binary
@tetsuok
tetsuok / disable_copy_and_assign_cpp11.cc
Created August 24, 2014 10:09
disable copy and assign in C++98 and C++11
// g++ -std=c++11
class NonCopyable {
public:
NonCopyable() = default;
NonCopyable(const NonCopyable&) = delete;
void operator=(const NonCopyable&) = delete;
private:
friend class A;
};
; http://farid.hajji.name/blog/2009/12/26/hello-world-in-freebsd-assembler/
.type main,@function
.data
msg:
.ascii "Hello, world\n"
.text
.globl main
@tetsuok
tetsuok / double-array-build.tex
Created December 9, 2013 08:56
An example of construction of a double array.
\documentclass[t]{beamer}
\usepackage{palatino}
\usepackage{amssymb,amsmath}
\usepackage{tikz}
\usepackage{color}
\usepackage{colortbl}
\def\drawtrie{
\begin{tikzpicture}[->,thick,vertex/.style={circle,fill=white,draw=black, text=black,minimum size=13pt}]
@tetsuok
tetsuok / overlap.c
Last active December 20, 2015 14:59
sayonara memcpy
/*
* The purpose of this program is to show you should always use memmove
* instead of memcpy if there is no particular reason.
*
* This program intentionally copies overlapped memories, though.
*
* Try to compile with different optimizations, compilers, OSs.
*
* For example,
*
#!/usr/bin/env python
"""
Data format converter for Chris' fast_align: https://github.com/clab/fast_align
For the input format, please see the README of his code.
"""
import itertools
import sys
@tetsuok
tetsuok / .gitattributes
Last active December 16, 2015 06:29
An example of ITG parse tree.
*.eps binary
*.pdf binary
*.ps binary
@tetsuok
tetsuok / Makefile
Last active December 15, 2015 17:49
Toy programs to verify nested cases.
CC = gcc
CFLAGS = -O0
FILES = \
case.s \
case2.s
all: $(FILES)
diff case.s case2.s
@tetsuok
tetsuok / drawchart.tex
Last active December 15, 2015 12:29
Macros for drawing charts in NLP
% Copyright (c) 2013, Tetsuo Kiso. All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
% * Redistributions of source code must retain the above copyright
% notice, this list of conditions and the following disclaimer.
%
% * Redistributions in binary form must reproduce the above copyright