Skip to content

Instantly share code, notes, and snippets.

View t2ru's full-sized avatar

Tetsuya Takatsuru t2ru

  • Chiba, Japan
View GitHub Profile
@t2ru
t2ru / fib.rs
Created September 16, 2015 23:20
generic fibonacci in rust
extern crate num;
//use std::num::One;
use num::traits::One;
use std::cmp::PartialOrd;
use std::ops::{Add, Sub};
fn fib<T>(n: T) -> T where
T: One + PartialOrd + Add<Output=T> + Sub<Output=T> + Clone {
if n < T::one() + T::one() {
@t2ru
t2ru / docker-compose.yml
Created July 3, 2015 02:18
Let's Chat用
mongo:
image: mongo:latest
app:
image: sdelements/lets-chat
links:
- mongo
ports:
- 8080:8080
- 5222:5222
environment:
# Connection plugin for configuring docker containers
# Author: Lorin Hochstein
#
# Based on the chroot connection plugin by Maykel Moya
import os
import subprocess
import time
from ansible import errors
from ansible.callbacks import vvv
@t2ru
t2ru / .screenrc
Created February 20, 2015 01:34
.screenrc
caption always "%{= wk} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wb}%y/%m/%d(%D) %{=b wb}%c"
{:user
{:plugins [[lein-marginalia "0.8.0"]
[lein-cloverage "1.0.2"]
[jonase/eastwood "0.2.1"]
[lein-cljfmt "0.1.10"]]}}
@t2ru
t2ru / .vimrc
Last active September 20, 2019 02:16
" neo bundle
set nocompatible
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
" generic
@t2ru
t2ru / gantt
Last active July 12, 2020 19:52
gantt chart using matplotlib
# -*- coding: utf-8 -*-
import datetime as dt
import numpy
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as md
import locale
from functools import reduce
locale.setlocale(locale.LC_ALL, "")
matplotlib.rcParams['font.family']='IPAPGothic'
@t2ru
t2ru / alloy
Last active August 29, 2015 14:06
Alloy Analyzer 30行でスリザーリンクの問題を解く ref: http://qiita.com/t2ru/items/c9a88b6f724fd4a75e99
abstract sig Board {
maxadjs: Int
}
abstract sig Side {}
one sig Inside, Outside extends Side {}
abstract sig Cell {
adjacent: some Cell,
num: Int,
package t
import scalaz._
import Scalaz._
import scala.collection.immutable._
object rwse {
type ErrMsg = String
abstract sealed class Err
case class EmptyErr() extends Err
@t2ru
t2ru / typedmonad.clj
Last active August 29, 2015 14:03
Clojure Typed Monad
;;; Monad
(defprotocol [m] Monad
([a] return [ctx, v :- a] :- (m a))
([a b] bind [ctx, mv :- (m a), f :- [a -> (m b)]] :- (m b)))
(defalias TFn1 (TFn [[x :variance :covariant]] Any))
;;; Identity Monad