Skip to content

Instantly share code, notes, and snippets.

View ksato9700's full-sized avatar

Ken Sato ksato9700

View GitHub Profile
#!/bin/bash
index=$1
HOST=127.0.0.1
PR_PORT=$(expr 7000 + $index)
MY_PORT=$(expr 4000 + $index)
if [ $index -gt 1 ]
then
PEERS="-peers "
for i in $(seq 2 $index)
do
@ksato9700
ksato9700 / 0_reuse_code.js
Created March 23, 2014 21:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ksato9700
ksato9700 / file0.txt
Created October 20, 2013 01:01
homebrew-caskを使ってKobitoをインストール ref: http://qiita.com/ksato9700/items/cf9430a9a04cab1a5be6
$ brew tap phinze/homebrew-cask
$ brew install brew-cask
$ brew cask install kobito
@ksato9700
ksato9700 / gist:6876505
Created October 7, 2013 23:03
Ubuntu release upgrade
$ sudo apt-get install update-manager-core
$ sudo do-release-upgrade -d
@ksato9700
ksato9700 / client.coffee
Created September 16, 2012 03:16
mocha iterative test case example
class Client
constructor: (name, ready)->
setTimeout =>
@name = name
ready()
, 1000
exports.Client = Client
@ksato9700
ksato9700 / systolic_array.go
Created May 19, 2012 14:17
Systolic array simulator implementation in Go
package main
import "fmt"
const SIZE = 3
//
// CalcCell
//
type CalcCell struct {
ain, bin, aout, bout, cout chan int
@ksato9700
ksato9700 / result.txt
Created January 8, 2012 20:38
How to check python class instance
<type 'instance'> __main__.A True True
<class '__main__.B'> <class '__main__.B'> True True
<type 'int'> <type 'int'> False False
<type 'tuple'> <type 'tuple'> False False
<type 'list'> <type 'list'> False False
<type 'dict'> <type 'dict'> False False
<class '__main__.DD'> <class '__main__.DD'> True True
<type 'bool'> <type 'bool'> False False
@ksato9700
ksato9700 / systolic_simulator3.erl
Created December 29, 2011 20:31
Yet another systolic array simulator implementation in Erlang
-module(systolic_simulator3).
-export([run/0, pipe/3, terminator/0, cell/2, cell/4, input/3]).
input(AB, Next, [])->
Next ! {AB, stop};
input(AB, Next, Seq)->
[Head | Rest] = Seq,
Next ! {AB, Head},
input(AB, Next, Rest).
@ksato9700
ksato9700 / systolic_simulator2.erl
Created December 29, 2011 09:20
A sample program to simulate systolic array compuatation
-module(systolic_simulator2).
-export([run/0, cell/6, input/3, terminator/0]).
input(AB, Next, [])->
Next ! {AB, stop};
input(AB, Next, Seq)->
[Head | Rest] = Seq,
Next ! {AB, Head},
input(AB, Next, Rest).
@ksato9700
ksato9700 / cell.coffee
Created December 28, 2011 22:02
Coffeescript implementation of systolic array simulation
events = require 'events'
initiator = new events.EventEmitter
class Pipe extends events.EventEmitter
constructor: (@name)->
@queue = []
recv: (event, value) =>
@queue.push(value)