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 / pagenum.pl
Last active August 29, 2015 13:58
ページ番号を振るCGI
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use File::Copy;
\linespace{\section{見出し}} % 自動で何行取るのか計算される
\linespace[3]{\section{見出し}} % 何行取るか手動で入れる
@y-yu
y-yu / hamming.ml
Last active August 29, 2015 14:00
type tree =
T of int * child list
and
child = unit -> tree
let rec mktree n =
let f i = fun () -> mktree i in
(T (n, [f (n * 2); f (n * 3); f (n * 5)]))
let less (T(v1, _)) (T(v2, _)) = v1 < v2
% 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}
@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 / engA.md
Created July 26, 2014 13:47
engA

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

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

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

dvipdfm

@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 / 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 / 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 / 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;