Skip to content

Instantly share code, notes, and snippets.

View tomoki's full-sized avatar

Tomoki Imai tomoki

View GitHub Profile
#!/bin/sh
# put test.sh ,input files and output files in the same folder.
# $ ls
# test.sh main.cpp in1 in2 in3 out1 out2 out3
INPUTS=`find . -type f -name "in*" | sort`
PROG=$1
@tomoki
tomoki / template.cpp
Created December 15, 2013 10:56
template.cpp
// compile in C++11. use -std=c++11.
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
@tomoki
tomoki / test.sh
Created December 15, 2013 03:58
なんかテストするやつ
#!/bin/sh
INPUTS=`find . -type f -name "in*"`
PROG=$1
if [ $# -eq 0 ]
then
echo "Pass program as first argument."
exit 1
fi
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@tomoki
tomoki / monad.ml
Created October 19, 2013 18:43
monad?
(*simple monad*)
module type MONAD =
sig
(* Type for state.It's Covariant*)
type +'a t
(* lift up normal value to monaded value.*)
val return : 'a -> 'a t
(* bind is the function to apply function
that take normal value and return monaded value to monaded value*)
val bind : 'a t -> ('a -> 'b t) -> 'b t
@tomoki
tomoki / merge-sort.scm
Created October 7, 2013 14:43
merge-sort in mzscheme.
#lang mzscheme
(define-syntax equal??
(syntax-rules ()
((_ test-exp correct-ans)
(let ((observed-ans test-exp))
(if (not (equal? observed-ans correct-ans))
(printf "Failed : ~s returned ~s, should have returned ~s~%"
'test-exp
observed-ans
@tomoki
tomoki / .vimrc
Created September 2, 2013 08:00
vimrc
set fileencoding=utf-8
set nocompatible
set t_Co=256
set ambiwidth=double
syntax on
filetype plugin indent on
set nobackup
set noswapfile
@tomoki
tomoki / template.py
Created August 31, 2013 10:45
競技テンプレート for python
#!/usr/bin/env python
#coding:utf-8
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from math import *
from string import *
from fractions import *
// ==UserScript==
// @id GooglePlusAutoFuu
// @name Google+ Automatic Fuu Extension
// @version 0.6.9
// @namespace AutoFuu
// @author Jackson Tan
// @description Add a Fuu button below each post to help you send a comment with Fuu expression automatically.
// @include https://plus.google.com/*
// @run-at document-end
// ==/UserScript==
{1000000000,999999999,999999998,999999997,999999996,
999999995,999999994,999999993,999999992,999999991,
123123123,312314123,423423423,123123141,534536456,
312423425,645623423,645645675,124234534,756756756,
423534645,645745785,234523423,756758567,421232312,
1, 423425645,3453 ,423443423,634534534,
324, 42342342, 4234, 43423423 ,89999999,
242341232,543664564,212312121,423423423,34234234,
342342342,423423423,42342342,2323423,2322,
6567,4564564}