Skip to content

Instantly share code, notes, and snippets.

View kzk's full-sized avatar
🍶

Kazuki Ohta kzk

🍶
View GitHub Profile
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.concurrent.*;
import java.lang.reflect.*;
import java.nio.ByteBuffer;
import org.jboss.netty.bootstrap.*;
import org.jboss.netty.channel.*;
import org.jboss.netty.channel.socket.nio.*;
# TransparentHugePage/ libhugetlbfs Benchmark Test
# with...
# Intel(R) Xeon(R) CPU X3430 @ 2.40GHz
# 8Gmem
# THP: enable
# HUGETLBFS: disable
$ echo "always" >/sys/kernel/mm/redhat_transparent_hugepage/enabled
$ echo "0"> /proc/sys/vm/nr_hugepages
$ gcc -O2 a.c; ./a.out
@kzk
kzk / evhttp-multh-thread-httpd.cpp
Created November 6, 2010 13:53
Multi-Threaded HTTPServer using evhttp
#include <event.h>
#include <evhttp.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <iostream>
package net.kzk9;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import java.io.*;
import java.util.*;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.util.*;
public class Test {
public static void main(String[] args) {
@kzk
kzk / gist:4499673
Last active December 10, 2015 22:08
日本Hadoopユーザー会は、第4回目のカンファレンス「Hadoop Conference
Japan 2013 Winter」を1月21日に東京ビッグサイトにて開催します。
> http://hcj2013w.eventbrite.com/
オリジナル開発者 Doug Cuttingからのメッセージ、LINE, Treasure Data,
Amazon Elastic MapReduce等のキーノートを始め、Apache Hadoopに関す
る技術や事例を一同に集め、多くの方が出会える場として企画を進めています。
早くも席が埋まり始めているので、なるべくお早めにご登録下さい。
@kzk
kzk / gist:3875967
Created October 11, 2012 22:32
/usr/sbin/td-agent
#!/usr/lib/fluent/ruby/bin/ruby
ENV["FLUENT_CONF"]="/etc/td-agent/td-agent.conf"
ENV["FLUENT_PLUGIN"]="/etc/td-agent/plugin"
ENV["FLUENT_SOCKET"]="/var/run/td-agent/td-agent.sock"
# Please add these lines
ENV["GEM_HOME"]="/usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/"
ENV["GEM_PATH"]="/usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/"
load "/usr/lib/fluent/ruby/bin/fluentd"
$ gem install fluent-plugin-mongo
Fetching: bson-1.7.0.gem (100%)
Fetching: mongo-1.7.0.gem (100%)
Fetching: fluent-plugin-mongo-0.6.7.gem (100%)
Successfully installed bson-1.7.0
Successfully installed mongo-1.7.0
Successfully installed fluent-plugin-mongo-0.6.7
3 gems installed
Installing ri documentation for bson-1.7.0...
Installing ri documentation for mongo-1.7.0...
module UnicornWorkerKiller
def self.kill_self(logger, start_time)
alive_sec = (Time.now - start_time).to_i
i = 0
while true
i += 1
sig = :TERM
if i > 10 # TODO configurable TERM MAX
sig = :QUIT
$ bundle exec je ./script/rails s