Skip to content

Instantly share code, notes, and snippets.

View tamtam180's full-sized avatar

tamtam180 tamtam180

View GitHub Profile
# coding: utf-8
require 'json'
require 'yajl'
x = eval('{"logType"=>"ads", "abc"=>"\xE3\x82\xA4\xE3\x83\xB3\xE3\x82\xB9\xE3\x83\x88\xE3\x83\xBC\xE3\x83\xAB", "time"=>"2015-05-17T03:00:00Z", "tag"=>"aaa"}')
puts x["abc"].force_encoding("ASCII-8BIT")
puts x["abc"].encoding
puts x
[2015-07-11T00:40:12+00:00] ERROR: service[td-agent] (td-agent::default line 119) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /sbin/service td-agent start ----
STDOUT: Starting td-agent: [FAILED]
STDERR: /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate googleauth-0.4.1, because multi_json-1.11.1 conflicts with multi_json (= 1.11) (Gem::LoadError)
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /usr/lib64/
@tamtam180
tamtam180 / hoge.rb
Last active August 29, 2015 14:26
再現コード
# coding: utf-8
require 'json'
rand = Random.new
i = 0
while true do
i += 1
obj = {
@tamtam180
tamtam180 / gist:1797071
Created February 11, 2012 06:19
hive ticket draft1
----- 手直ししたバージョン -----
summary:
utc_from_timestamp and utc_to_timestamp returns incorrect results.
detail:
how to reproduce:
{noformat}
$ echo "2011-12-25 09:00:00.123456" > /tmp/data5.txt
@tamtam180
tamtam180 / gist:2055893
Created March 17, 2012 06:54
MurmurHash1のJava実装. オリジナル実装はunsigned intで行っているが、signed intでもビットパターンは変わらないので問題なし(のはず)
public class MurmurHash1 {
public long digest(byte[] data, int seed, boolean bigendian) {
int m = 0xc6a4a793;
int r = 16;
int len = data.length;
int h = seed ^ (len * m);
@tamtam180
tamtam180 / EncodeUtils.java
Created March 17, 2012 08:24
MurmurHash2のJava実装。32ビットハッシュを求めるやつと64ビットハッシュを求めるやつ
public class EncodeUtils {
public static long toLongBE(byte[] b, int offset) {
return (((long)b[offset+0] << 56) +
((long)(b[offset+1] & 255) << 48) +
((long)(b[offset+2] & 255) << 40) +
((long)(b[offset+3] & 255) << 32) +
((long)(b[offset+4] & 255) << 24) +
((b[offset+5] & 255) << 16) +
@tamtam180
tamtam180 / EncodeUtils.java
Created March 17, 2012 10:39
MurmurHash3のJava実装。32ビットと128ビットを求めるやつ。x86とx64で結果は異なる
public class EncodeUtils {
public static int toIntBE(byte[] b, int i) {
return ((b[i+0] << 24) + (b[i+1] << 16) + (b[i+2] << 8) + (b[i+3] << 0));
}
public static int toIntLE(byte[] b, int i) {
return ((b[i+3] << 24) + (b[i+2] << 16) + (b[i+1] << 8) + (b[i+0] << 0));
}
Index: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
===================================================================
--- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (revision 1304983)
+++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (working copy)
@@ -6468,10 +6468,8 @@
// Finally add the partitioning columns
for (FieldSchema part_col : tab.getPartCols()) {
LOG.trace("Adding partition col: " + part_col);
- // TODO: use the right type by calling part_col.getType() instead of
- // String.class
abstract class Base {
protected String aaa;
public Base setAaa(String aaa) {
this.aaa = aaa;
return this;
}
}
class Hoge extends Base {
protected String xxx;
Rest call:
/_api/collection/collection-identifier/parameter
I got follows error:
{"error":true,"code":404,"errorNum":404,"errorMessage":"expecting one of the resources 'count', 'figures'"}
[tamtam@tamsvr20 tmp]$ curl -X GET --dump - http://localhost:8529/_api/collection/tamtam
HTTP/1.1 200 OK
connection: Keep-Alive
content-type: application/json