Skip to content

Instantly share code, notes, and snippets.

View bonotake's full-sized avatar

Takeo Imai bonotake

View GitHub Profile
### Keybase proof
I hereby claim:
* I am bonotake on github.
* I am bonotake (https://keybase.io/bonotake) on keybase.
* I have a public key ASCraTyLJLGcmVO3SwQD_Z3TIoDtAy4EzDVT4jaOcu3rCgo
To claim this, I am signing this object:
@bonotake
bonotake / file0.txt
Last active November 15, 2018 15:51
Pythonでasyncioとコルーチンを使ってスレッドっぽい非同期処理をする ref: https://qiita.com/bonotake/items/fbf839b00b1b4cea0302
import asyncio
# コルーチン1
async def test1():
await asyncio.sleep(3)
print('now in test1.')
return "test1"
# コルーチン2
@bonotake
bonotake / direct_sum.als
Last active August 29, 2015 13:59
Alloyで直和を考える (direct sum in Alloy)
/**
Alloyで直和を考える
cf. http://d.hatena.ne.jp/bonotake/20140414/1397488714
http://d.hatena.ne.jp/m-hiyama/20140414/1397432990
*/
sig A, B, C {} -- univを豊かにするために置いておく
enum Tag { Fst, Snd }
fun prod1(a, b: univ): Tag -> univ {
@bonotake
bonotake / illustLogic.als
Created April 13, 2012 06:33
イラストロジック in Alloy
open util/ordering[Col] as cols
open util/ordering[Row] as rows
abstract sig Region {}
sig Col extends Region {
cell: Row -> Cell
}
sig Row extends Region {}
enum Cell { Black, White }
@bonotake
bonotake / Theme file
Created August 29, 2011 11:58 — forked from konn/marsandvenus.als
金星人の男と火星人の女は常に本当のことだけを云い、金星人の女と火星人の男は常に嘘を吐く。一発で男か女かを見分けることのできる、「はい」か「いいえ」で答えられる質問は何か?
<?xml version="1.0"?>
<alloy>
<view>
<projection> <type name="&#x8cea;&#x554f;"/> </projection>
<defaultnode/>
<defaultedge/>
@bonotake
bonotake / kalotan.als
Created August 29, 2011 07:15
カロタンパズル in Alloy
abstract sig カロタン {
性別: 男か女か,
発言1: Prop,
発言2: lone Prop
}
{
// 男なら常に真実を語る
性別 in 男性 => 発言1.真偽 in ホント and (some 発言2 =>発言2.真偽 in ホント)
// 女はどっちかホントでどっちかがウソ
else some 発言2 => 発言1.真偽 != 発言2.真偽
@bonotake
bonotake / Allegory.v
Created August 15, 2011 15:14 — forked from msakai/Allegory.v
Definition of Allegory
Require Export Category.
Set Implicit Arguments.
Unset Strict Implicit.
Section allegory.
Variable C : Category.
Variable Op_intersect : forall a b : Ob C, Map2 (Hom a b) (Hom a b) (Hom a b).
Variable Op_converse \u00a0: forall a b : Ob C, Map (Hom a b) (Hom b a).