Skip to content

Instantly share code, notes, and snippets.

View tamtam180's full-sized avatar

tamtam180 tamtam180

View GitHub Profile
@tamtam180
tamtam180 / gist:2316537
Created April 6, 2012 03:19
CityHashのJava実装。
/*
* Copyright (C) 2012 tamtam180
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
# irb
2.3.1 :001 > q = Queue.new
=> #<Thread::Queue:0x00000002150908>
2.3.1 :002 > q.push(:a)
=> #<Thread::Queue:0x00000002150908>
2.3.1 :003 > q.push(:b)
=> #<Thread::Queue:0x00000002150908>
2.3.1 :004 > q.pop
=> :a
2.3.1 :005 > q.pop
@tamtam180
tamtam180 / json2bq.rb
Last active July 19, 2016 12:13
JSONログから雑にデータ構造を調べるための糞スクリプト。同じキーで異なる型は想定外
# coding: utf-8
require 'json'
def get_bqtype(k, obj)
return case obj
when TrueClass, FalseClass then "BOOLEAN"
when String then "STRING"
when Float then "FLOAT"
when Fixnum, Bignum
return "TIMESTAMP" if ["timestamp", "_ts"].include?(k)
irb(main):007:0* require 'Oj'
=> false
irb(main):008:0> Oj.load('{"x": 1e-314}')
=> {"x"=>0.0}
irb(main):009:0> Oj.default_options = { :bigdecimal_load => :bigdecimal }
=> {:bigdecimal_load=>:bigdecimal}
irb(main):010:0> Oj.load('{"x": 1e-314}')
=> {"x"=>#<BigDecimal:7fd73a87d188,'0.1E-313',9(18)>}
public class MyFactory {
public static Configuration newConfiguration() {
Configuration conf = new Configuration();
conf.setInt("xxx", 111);
return conf;
}
}
// こーいう場合(Factoryクラスがstaticメソッドでかつ他のクラスの場合) XMLどう書けばいいの...
// factory-beanはbean指定だからインスタンス化必須?

JS

<script type="text/javascript">

var data = {
  "id" : "aaa",
  "hoge" : 100
};

こんな感じ

cd $HIVE_HOME

# パッチをあててビルド
wget https://issues.apache.org/jira/secure/attachment/12577210/HIVE-4299.patch
patch -p0 < HIVE-4299.patch
ant clean package

# テストの内容作成(.qファイルを使ったpositiveテスト)
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
@tamtam180
tamtam180 / 1.txt
Last active December 14, 2015 00:58
2013-02-21 14:07:09,310 ERROR org.apache.hadoop.security.UserGroupInformation: PriviledgedActionException as:hdfs (auth:SIMPLE) cause:java.net.SocketTimeoutException: Read timed out
2013-02-21 14:07:09,310 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2672)
at java.security.DigestInputStream.read(DigestInputStream.java:144)
@tamtam180
tamtam180 / gist:4983766
Created February 19, 2013 07:26
in_status を stdoutに出力したら...
2013-02-19 16:22:25 +0900: failed to configure/start sub output webhdfs: can't add a new key into hash during iteration2013-02-19 16:22:24 +0900 status:
{"queue_size":0,"emit_count":0}
2013-02-19 16:22:24 +0900 status: {"queue_size":0,"emit_count":0}
2013-02-19 16:22:25 +0900: /usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluentd-0.10.31/lib/fluent/status.rb:28:in `[]='
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluentd-0.10.31/lib/fluent/status.rb:28:in `register'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluentd-0.10.31/lib/fluent/output.rb:203:in `configure'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluentd-0.10.31/lib/fluent/output.rb:449:in `configure'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluent-mixin-config-placeholders-0.2.0/lib/fluent/mixin/config_placeholders.rb:93:in `configure'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluent-mixin-plaintextformatter-0.2.1/lib/fluent/mixin/plaintextformatter.rb:18:in `configure'
/usr/local/rvm/gems/ruby-1.9.3-p385/gems/fluent-plugin-webhdfs-0.1.1/lib/fluent/plugin/out_we