Skip to content

Instantly share code, notes, and snippets.

View syuhei176's full-sized avatar
🎯
Focusing

Shuhei Hiya syuhei176

🎯
Focusing
View GitHub Profile
import akka.actor.{ ActorSystem, Actor, ActorRef, Props, PoisonPill }
class HelloActor extends Actor {
def receive = {
case i:Int => println("Int=" + i)
case msg => {
println(msg + " by MyAkkaActor")
sender() ! ("Hello," + msg.toString)
}
}
@syuhei176
syuhei176 / .kerlrc
Created October 25, 2016 12:58
kerl config file for erlang 18.3.4.4
KERL_CONFIGURE_OPTIONS="--enable-kernel-poll --enable-threads --enable-dynamic-ssl-lib --enable-smp-support --enable-darwin-64bit --disable-hipe --disable-native-libs --disable-sctp --without-javac --without-odbc --without-wx --without-debugger -without-observer --without-et --with-ssl=/usr/local/opt/openssl"
@syuhei176
syuhei176 / message.js
Last active July 15, 2016 21:19
メッセージ: ひたすら前に進んで、うしろを振り返らず、失敗してもすぐに仕切りなおす。
const next = (x) => {
try{
next(x + 1);
}catch(e) {
setImmediate(()=>{next(x)});
}
}
next(0);
@syuhei176
syuhei176 / uptime.js
Created July 15, 2016 06:05
push CPU Load Average to Milkcocoa
var MilkCocoa = require('milkcocoa');
var milkcocoa = new MilkCocoa('guitarib0a5pfk.mlkcca.com');
var ds = milkcocoa.dataStore('loadaverage');
ds.on('push', function(e) {
console.log(e);
});
@syuhei176
syuhei176 / index.html
Created June 17, 2016 22:19
leap motion screen touch
<div id="leap">Leap Motion was not connected</div>
<p>Touched: <span id="touched">…</span></p>
<p>Position: <span id="position">…</span></p>
<script src="//js.leapmotion.com/leap-0.6.3.min.js"></script>
<script>
var leapConnectedDom = document.getElementById("leap");
var touched = document.getElementById("touched");
var position = document.getElementById("position");
var div = document.createElement('div');
div.style["background-color"] = "#000";
@syuhei176
syuhei176 / regular_expression_sample.md
Last active January 11, 2016 15:30
regular expression

Erlang re module

>{ok, R} = re:compile("a+b*a+").
>re:run("abba", R).
{match,[{0,4}]}
@syuhei176
syuhei176 / openhybrid_hardwareinterfaces_socketio_index.js
Last active January 11, 2016 06:39
OpenHybrid HardwareInterface socketio
/**
* @preserve
*
* .,,,;;,'''..
* .'','... ..',,,.
* .,,,,,,',,',;;:;,. .,l,
* .,',. ... ,;, :l.
* ':;. .'.:do;;. .c ol;'.
* ';;' ;.; ', .dkl';, .c :; .'.',::,,'''.
* ',,;;;,. ; .,' .'''. .'. .d;''.''''.
@syuhei176
syuhei176 / get_message_history.js
Last active November 27, 2015 06:07
Milkcocoaで過去のメッセージを取得する。
var milkcocoa = new MilkCocoa('flagi9edsvtg.mlkcca.com')
var history = milkcocoa.dataStore('message').history();
history.sort('desc');
history.size(20);
// 2015/10/30-2015/11/10のpush()で保存したデータを取得
history.span(new Date(2015,9,30).getTime(), new Date(2015,10,10).getTime());
history.on('data', function(data) {
console.log(data);
@syuhei176
syuhei176 / check_cassandra_status.py
Last active November 27, 2015 06:03
Check cassandra status
import subprocess
import sys, re
hostname = 'cassandra host'
check = subprocess.check_output(['nodetool', '-h', hostname, 'status'])
line = check.split('\n')
for l in line:
m = re.match(r"DN" , l)
@syuhei176
syuhei176 / gist:4e0469d263f274a3cc39
Last active September 30, 2015 15:42
Milkcocoa data length
dataStore.stream().next(function(err, data) {
if(err) throw err;
foo(data.length);
});
function foo(size) {
//ここでsizeを扱う
console.log(size);
}