Skip to content

Instantly share code, notes, and snippets.

View y-yu's full-sized avatar

YOSHIMURA Yuu y-yu

View GitHub Profile
@y-yu
y-yu / LazyList.hx
Created November 19, 2014 10:38
LazyList
enum StreamCell<T> {
Cons(x : T, t : Stream<T>) : StreamCell<T>;
Nil : StreamCell<T>;
}
typedef Stream<T> = Void -> StreamCell<T>
class LazyList<T> {
private var body : Stream<T>;
private static var nil = function () : StreamCell<T> {
return Nil;
@y-yu
y-yu / CharArray.hx
Last active August 29, 2015 14:09
CharArray
abstract CharArray(String) {
inline function new(x) {
this = x;
}
public function get() { return this; }
@:from public static inline function fromString(x : String) : CharArray {
return new CharArray(x);
}
@y-yu
y-yu / reg2anfa.ml
Created October 14, 2014 09:07
implement to convert REs to aNFA and parse the RE greedy
type alphabet =
Char of char
| Choice of bit
| Log of bit
and
bit = bool
let one = true
let zero = false
@y-yu
y-yu / reg2dfa.ml
Last active August 29, 2015 14:07
convert regular expression to dfa
type sym = Eps | Char of char
type reg =
Lit of char
| Alt of reg * reg
| Con of reg * reg
| Star of reg
module SymSet = Set.Make(struct
type t = sym
@y-yu
y-yu / Makefile.patch
Last active September 21, 2018 08:05
履歴書スタイルファイルのB4(B5の割付)版(http://www.tamacom.com/rireki-j.html のパッチファイル)
--- rireki-2.6/Makefile 2014-08-12 10:29:00.000000000 +0900
+++ Makefile 2014-09-20 14:28:31.000000000 +0900
@@ -25,16 +25,16 @@
#
PDF = rireki.pdf
DVI = rireki.dvi
-PAPER = a4
+PAPER = jisb4 -l
all: $(PDF)
@y-yu
y-yu / engA.md
Created July 26, 2014 13:47
engA

sample-ja.texのアレなところ

TeX Liveを使っている人向けの情報です。 ちなみに某科学類の計算機にはTeX Live(2013)がインストールされています。

ここで紹介しているパッケージは全てTeX Liveに入っているので、 特別な操作をしなくてもそのままコンパイルできます。

dvipdfm

@y-yu
y-yu / split.pl
Last active August 29, 2015 14:04
split.pl
#!/usr/bin/env perl
use strict;
use warnings;
my $pdffile = $ARGV[0];
my $output = $ARGV[1] ? $ARGV[1] : ".";
my ($pagesize) = `pdfinfo $pdffile` =~ m/Pages:\s* (\d+)/x;
my $tenth = int($pagesize / 10);
@y-yu
y-yu / mp.py
Last active January 3, 2022 11:43
from charm.toolbox.integergroup import IntegerGroupQ
from charm.core.math.integer import toInt
import random
from functools import reduce
group = IntegerGroupQ()
group.paramgen(512)
cards = 52
@y-yu
y-yu / mental_mahjong.md
Last active March 14, 2018 00:02
Mental Mahjong

Mental Mahjong

Mental Mahjongとは?

Mental MahjongとはP2Pの仕組みを用いて、不誠実な(不正をするかもしれない)プレイヤー同士で、 第三者的の公平なジャッジサーバーを用いずに公平なゲームをする方法です。 Mental Pokerという ゲームを参考に僕(@yyu)と @shincbl@re_Ord@linerlock@mimizunohimono

% need color package
\definecolor{solarized@base03}{HTML}{002B36}
\definecolor{solarized@base02}{HTML}{073642}
\definecolor{solarized@base01}{HTML}{586e75}
\definecolor{solarized@base00}{HTML}{657b83}
\definecolor{solarized@base0}{HTML}{839496}
\definecolor{solarized@base1}{HTML}{93a1a1}
\definecolor{solarized@base2}{HTML}{EEE8D5}
\definecolor{solarized@base3}{HTML}{FDF6E3}