Skip to content

Instantly share code, notes, and snippets.

@matsu-chara
matsu-chara / InitializationException.scala
Last active July 4, 2016 15:42
ActorInitiliazationExceptionのRestartだとpreStart以外は呼ばれない
package ex2
import akka.actor.SupervisorStrategy._
import akka.actor._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
object Main1 extends App {
val system = ActorSystem()
import java.util.concurrent.CountDownLatch
import akka.actor.SupervisorStrategy.{Restart, Resume, Stop}
import akka.actor._
object Main extends App {
val system = ActorSystem()
try {
val actor = system.actorOf(Props[RootSupervisor])
actor ! 1
@matsu-chara
matsu-chara / ssh-host-color.sh
Last active February 10, 2017 03:18 — forked from themoriarty/ssh-host-color.sh
iterm2 version 3.0.0 fix error `44:52: syntax error: end of line があるべきところですが identifier が見つかりました。 (-2741)`
#!/bin/bash
# https://gist.github.com/themoriarty/584b759513c5c5864dac
#
# (1) copy to: ~/bin/ssh-host-color
# (2) set: alias ssh=~/bin/ssh-host-color
#
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color
# Fork from https://gist.github.com/773849
#
@matsu-chara
matsu-chara / demo.sh
Last active June 8, 2016 01:17
markdown内のjsonコードブロックを拾ってjsonlintかけてくれる君
~sand/markdown-json-lint $ node index.js sample.md
Parse error on line 1:
{ "b: 'a' }
--^
Expecting 'STRING', '}', got 'undefined'
Parse error on line 1:
{ "x: 2 }
--^
Expecting 'STRING', '}', got 'undefined'
~sand/markdown-json-lint $ node index.js sample2.md
/Users/matsu_chara/ghq/src/github.com/dwango/scala_text/src/IDE.md
1:1 error #(h1), ##(h2)の見出し行に難易度表記(★)がありません # IDE (Integrated Development Environment) chapter-difficulty-stars
62:1 error #(h1), ##(h2)の見出し行に難易度表記(★)がありません ## sbtプロジェクトのインポート chapter-difficulty-stars
102:1 error #(h1), ##(h2)の見出し行に難易度表記(★)がありません ## プログラムを実行する chapter-difficulty-stars
/Users/matsu_chara/ghq/src/github.com/dwango/scala_text/src/INTRODUCTION.md
1:1 error #(h1), ##(h2)の見出し行に難易度表記(★)がありません # はじめに chapter-difficulty-stars
36:1 error #(h1), ##(h2)の見出し行に難易度表記(★)がありません ## ライセンス chapter-difficulty-stars
<?php
abstract class Mofu {
abstract function isNyan();
public function mofureyo() {
if($this->isNyan() === true) {
return "mofure";
} else {
return "mofuruna";
}
<?php
abstract class Mofu {
abstract protected function isNyan();
public function mofureyo() {
if($this->isNyan() === true) {
return "mofure";
} else {
return "mofuruna";
}
package io.grpc.examples.helloworld;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
@matsu-chara
matsu-chara / Vagrantfile
Last active March 10, 2016 14:58
ponyc llvm37ビルド on ubuntu trusty64
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
end
@matsu-chara
matsu-chara / hangpony.pony
Created March 6, 2016 12:32
長時間ブロックするアクターをスレッド数(デフォルトでは物理コア数)だけ用意すると全体のパフォーマンスが落ちる例(ずっとブロックして先にいかないし、GCも効かない。env.outにも処理が行かないので表示もされない)
use "collections"
actor Main
let env: Env
new create(env': Env) =>
env = env'
let ls = List[LightWorker]
let hs = List[HeavyWorker]