Skip to content

Instantly share code, notes, and snippets.

Shingo Omura everpeace

Block or report user

Report or block everpeace

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@everpeace
everpeace / dining-philosophers.als
Created Aug 7, 2011
Deadlock Detection for Dining Philosophers Problem in Alloy
View dining-philosophers.als
open util/ordering[State]
-- 哲学者
sig Philosopher {
-- 左と右には異なる1本のフォークがある
disj leftFork, rightFork: one Fork,
-- 左と右には異なる哲学者が1人ずついる
left, right: one Philosopher
}
-- フォーク
@everpeace
everpeace / dining_philosophers_ja.als
Created Aug 12, 2011
[Japanese Version]Deadlock Detection for Dining Philosophers Problem in Alloy
View dining_philosophers_ja.als
-- This can be executed by alloy4.2-rc.jar on http://alloy.mit.edu/community/node/1039
-- This version supports unicode identifiers.
open util/ordering[システム状態]
sig 哲学者 {
disj 左フォーク, 右フォーク: one フォーク,
左, 右: one 哲学者
}
sig フォーク {
disj 左, 右: one 哲学者
@everpeace
everpeace / BiKleisli.scala
Created Sep 21, 2011
Bi-Kleiseli on Scala
View BiKleisli.scala
package com.github.everpeace
import scalaz._
import Scalaz._
/**
* BiKleisli arrow
* W: comonad
* M: monad
*/
@everpeace
everpeace / A.txt
Created Mar 15, 2012
Matrix Multiplication in Scalding.
View A.txt
1 2 3
1 2 3
1 2 3
@everpeace
everpeace / README.md
Created Mar 27, 2012
Automata (DFA,NFA,εNFA) in Scala
@everpeace
everpeace / 普通に表示させると。
Created Apr 24, 2012
git log --graph のコミットハッシュ値を全部相対表現で表示する
View 普通に表示させると。
$ git log --graph --oneline
*-. 9010104 Merge branches 'master3' and 'master2'
|\ \
| | * dd0ba6d add b2
| * | 75a99a0 add b3
| |/
* | 743ad3b add b1
|/
* 81b919d add a
@everpeace
everpeace / gitsshm
Created May 15, 2012
GIT_SSH manager for github.
View gitsshm
#!/bin/bash
if [ -z $GITHUB_KEYS_DIR ]; then
GITHUB_KEYS_DIR="$HOME/github-keys"
fi
if [ -z $GITHUB_KEY_FILE_NAME ]; then
GITHUB_KEY_FILE_NAME="id_rsa"
fi
@everpeace
everpeace / show branch descriptions in "git branch"
Created Feb 4, 2013
oneliner for showing branch descriptions in "git branch". Branch descriptions can be set with "git branch --edit-descrption [branchname]".
View show branch descriptions in "git branch"
git branch | sed 's/^ /_/' | awk '{desc=""; "git config branch."$2".description"|getline desc ; print $1" "$2" "desc}'|sed 's/^_/ /g'
@everpeace
everpeace / sample.scala
Last active Dec 13, 2015
なぜ暗黙の型変換が適用されないのかわからない><
View sample.scala
import scala.language.higherKinds
// 代数の型クラスの階層があって
trait Algebra[E]{ def op(e1:E,e2:E):E }
trait SubAlgebra[E] extends Algebra[E]
// ある代数の型クラスのオブジェクトがあって
object ConcreteAlgebra extends SubAlgebra[Int]{
def op(e1:Int, e2:Int) = e1+e2
}
@everpeace
everpeace / Macros.scala
Last active Dec 14, 2015
ユーザから渡されたブロックにimplicit valを注入するマクロを組んでみたけどうまくいかない。
View Macros.scala
import reflect.macros.Context
object Macros{
// on(i){ ... }とやるとblockの中にiをimplicitとして注入するマクロ
def on[I, V](i:I)(block:V)= macro impl_on[I,V]
def impl_on[I, V](c:Context)(i:c.Expr[I])(block:c.Expr[V]):c.Expr[V] = {
import c.universe._
// type of block is
You can’t perform that action at this time.