Skip to content

Instantly share code, notes, and snippets.

@maiha
maiha / ListMap.scala
Created November 14, 2014 07:17
OrderedMap in scala
scala> collection.immutable.ListMap(5->"",4->"",3->"",2->"",10->"",1->"") foreach(println)
(5,)
(4,)
(3,)
(2,)
(10,)
(1,)
@maiha
maiha / seq-try.scala
Created January 16, 2015 17:34
Seq[Try[A]]
val trys: Seq[Try[CreateChatRequest]] = foo
trys.find(_.isFailure) match {
case Some(error) => ChatsCreateFailed(sid, tid, error.toString)
case None =>
val reqs = trys.map(_.get)
store.addChats(sid, tid, reqs) match {
case Success(chats) => ChatsCreateFinished(sid, tid, chats)
case Failure(error) => ChatsCreateFailed(sid, tid, error.toString)
}
}
@maiha
maiha / 1.setup.sh
Last active August 29, 2015 14:19
RabbitMQ: delayed_message_exchange plugin
# enable plugin
% rabbitmq-plugins enable rabbitmq_delayed_message_exchange
# declare exchange
% rabbitmqadmin declare exchange name=delayed type=x-delayed-message arguments='{"x-delayed-type":"direct"}'
# declare queue
% rabbitmqadmin declare queue name=q1
# binding
@maiha
maiha / 1.install
Last active August 29, 2015 14:19
Docker
# docker
wget -qO- https://get.docker.com/ | sh
usermod -aG docker maiha
# fig(docker-compose)
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@maiha
maiha / remote.log
Created May 2, 2015 19:39
akka remoteでの気になるエラー
03:09:57.973 [ERROR] Remoting - Association to [akka.tcp://broker@ubuntu:2553] with UID [-1354268361] irrecoverably failed. Quarantining address.
java.lang.IllegalArgumentException: Highest SEQ so far was -1 but cumulative ACK is 3
at akka.remote.AckedSendBuffer.acknowledge(AckedDelivery.scala:103) ~[akka-remote_2.11-2.3.10.jar:na]
at akka.remote.ReliableDeliverySupervisor$$anonfun$receive$1.applyOrElse(Endpoint.scala:284) ~[akka-remote_2.11-2.3.10.jar:na]
... 11 common frames omitted
Wrapped by: java.lang.IllegalStateException: Error encountered while processing system message acknowledgement buffer: [-1 {}] ack: ACK[3, {}]
at akka.remote.ReliableDeliverySupervisor$$anonfun$receive$1.applyOrElse(Endpoint.scala:288) ~[akka-remote_2.11-2.3.10.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:467) ~[akka-actor_2.11-2.3.10.jar:na]
at akka.remote.ReliableDeliverySupervisor.aroundReceive(Endpoint.scala:188) ~[akka-remote_2.11-2.3.10.jar:na]
at akka.
@maiha
maiha / 1.1s-100k-1u
Last active August 29, 2015 14:21
rabbitmq stress test
bytes: 1
---- Global Information --------------------------------------------------------
> request count 100000 (OK=100000 KO=0 )
> min response time 0 (OK=0 KO=- )
> max response time 67 (OK=67 KO=- )
> mean response time 0 (OK=0 KO=- )
> std deviation 0 (OK=0 KO=- )
> response time 50th percentile 0 (OK=0 KO=- )
> response time 75th percentile 0 (OK=0 KO=- )
> mean requests/sec 20124.774 (OK=20124.774 KO=- )
@maiha
maiha / ゼウス・ディオス
Last active August 29, 2015 14:21
パズドラ攻略
ベジット
威嚇が効くので適当に倒す
[2015-05-27 02:29:46,650] ERROR Unhandled exception resulting in internal server error response (io.confluent.rest.exceptions.GenericExceptionMapper)
java.lang.NoSuchMethodError: scala.collection.JavaConversions.asScalaIterable(Ljava/util/Collection;)Lscala/collection/Iterable;
at io.confluent.kafkarest.MetadataObserver.getTopic(MetadataObserver.java:91)
at io.confluent.kafkarest.resources.TopicsResource.getTopic(TopicsResource.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
@maiha
maiha / 0.日本酒.rst
Last active August 29, 2015 14:22
日本酒

YK35系

  • 14代(本丸)
  • 仙禽一聲
  • 田酒
  • 獺祭23-39

販売店

@maiha
maiha / memory leak?
Created June 1, 2015 15:23
gatling-amqp error
================================================================================
2015-06-01 23:23:55 1310s elapsed
---- AMQP Publish(ack) ---------------------------------------------------------
[--------------------------------------------------------------------------] 0%
waiting: 0 / active: 10 / done:0
---- Requests ------------------------------------------------------------------
> Global (OK=128344 KO=0 )
> publish(ack) (OK=128344 KO=0 )
================================================================================