Skip to content

Instantly share code, notes, and snippets.

Avatar

Mitsunori Komatsu komamitsu

View GitHub Profile
View airlift code reading
[io.airlit.sample.Main.main()]
- Bootstrap app = new Bootstrap(
new NodeModule(),
new DiscoveryModule(),
new HttpServerModule(),
new JsonModule(),
new JaxrsModule(),
new MBeanModule(),
new JmxModule(),
new JmxHttpModule(),
View Destructive_substitution.ml
module type Addable = sig
type t
val add: t -> t -> t
end;;
module type Pair_inf = sig
type t
type endpoint
val create: endpoint -> endpoint -> t
end;;
View jackson-databind memo
Map<String, Object> map = new HashMap<>();
map.put("name", "komamitsu");
map.put("age", 39);
ObjectMapper objectMapper = new ObjectMapper();
String serialized = objectMapper.writeValueAsString(map);
System.out.println(serialized);
Map<String, Object> deserialized =
objectMapper.readValue(serialized, new TypeReference<Map<String, Object>>() { });
System.out.println(deserialized);
@komamitsu
komamitsu / gist:0b8c22da8b2815bf9eb2
Last active Aug 29, 2015
jackson-dataformat-msgpack_benchmark
View gist:0b8c22da8b2815bf9eb2
Pojo:
Generator:
http://gyazo.com/7eb78f90605c412bfa8d425332213984.png
Parser:
http://gyazo.com/b9344c89980312c06ee88ebd5a76cf4e.png
@komamitsu
komamitsu / gist:d78249b9a32c3979e94a
Created Sep 15, 2014
Practice of First-class module (generate new module)
View gist:d78249b9a32c3979e94a
# module type Bumpable = sig
type t
val bump : t -> t
end;;
module type Bumpable = sig type t val bump : t -> t end
# module Int_bumper = struct
type t = int
let bump n = n + 1
end;;
View ReentrantReadWriteLockExample.java
static class ReentrantReadWriteLockExample {
private int loopNum = 30000;
private int slotNum = 10;
private int writeThreadNum = 5;
private int readThreadNum = 5;
public void examinReentrantReadWriteLock() throws InterruptedException {
final HashMap<Integer, Pair<Integer, Integer>> tbl = new HashMap<>();
for (int slot = 0; slot < slotNum; slot++) {
@komamitsu
komamitsu / pod_trunk_push.log
Last active Aug 29, 2015
"pod trunk push" doesn't use repos other than default
View pod_trunk_push.log
[komamitsu@potato td-ios-sdk (master)]$ pod trunk push --verbose TreasureData-iOS-SDK.podspec
Validating podspec
$$$$ Trunk#validate_podspec $$$$
$$$$ Validator.init: ["https://github.com/CocoaPods/Specs.git"] $$$$
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cocoapods-trunk-0.3.0/lib/pod/command/trunk.rb:337:in `new'
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cocoapods-trunk-0.3.0/lib/pod/command/trunk.rb:337:in `validate_podspec'
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cocoapods-trunk-0.3.0/lib/pod/command/trunk.rb:289:in `run'
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/claide-0.7.0/lib/claide/command.rb:271:in `run'
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cocoapods-0.34.2/lib/cocoapods/command.rb:48:in `run'
/Users/komamitsu/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cocoapods-0.34.2/bin/pod:33:in `<top (required)>'
View redis_cas_bench.rb
require 'redis'
class RedisBench
def initialize(count)
@count = count
@r = Redis.new
end
def bench(prepare_items, label, &blk)
@r.flushall
@komamitsu
komamitsu / memo.md
Last active Aug 29, 2015
Presto code reading memo
View memo.md

server.QueryResource#createQuery

  • server.QueryResource#createQuery
    • server.ResourceUtil#createSessionForRequest
    • execution.SqlQueryManager#createQuery
      • sql.parser.SqlParser#createStatement
      • event.query.QueryMonitor#createdEvent
      • execution.SqlQueryExecution#addStateChangeListener
      • execution.SqlQueryManager.QueryStarter#submit
      • execution.SqlQueryManager.QueryStarter.QueryQueue#enqueue
@komamitsu
komamitsu / PackedForward_message_from_irb.log
Last active Sep 15, 2015
Fluentd:PackedForward format
View PackedForward_message_from_irb.log
irb(main):027:0> c = TCPSocket.new('127.0.0.1', 24225) => #<TCPSocket:fd 15>
irb(main):028:0> c.write(MessagePack.pack(['foo.bar', MessagePack.pack([Time.now.to_i, {:name => 'aaa', :age => 12}]) + MessagePack.pack([Time.now.to_i, {:name => 'bbb', :age => 34}])]))
=> 54
>>>
2015-09-16 00:16:28 +0900 foo.bar: {"name":"aaa","age":12}
2015-09-16 00:16:28 +0900 foo.bar: {"name":"bbb","age":34}