This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BasicBuffer: | |
| has a map and a queue. the map's value is a chunk. the queue's element is a chunk. | |
| BasicBuffer#push(key): | |
| the chunk = identified by the key | |
| call enqueue(the chunk):abstract method | |
| @queue << the chunk | |
| delete the KV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ td query -w -d nginx " ¥ | |
| select ¥ | |
| count(td_time_format(td_time_parse(v['time']), 'yyyyMMdd')), ¥ | |
| td_time_format(td_time_parse(v['time']), 'yyyyMMdd') as d ¥ | |
| from ¥ | |
| access ¥ | |
| group by ¥ | |
| td_time_format(td_time_parse(v['time']), 'yyyyMMdd') ¥ | |
| order by d ¥ | |
| " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| %w|20130429 20130430 20130501 20130502|.each do |ymd| | |
| y, m, d = *[ymd[0, 4], ymd[4, 2], ymd[6, 2]] | |
| ym = y + m | |
| dirname = "logs_#{ym}" | |
| Dir.mkdir dirname unless Dir.exist? dirname | |
| File.open("#{dirname}/#{ymd}.csv", "a") do |f| | |
| 1000.times do |i| | |
| h = i / 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set expandtab | |
| set smartindent | |
| " where ^H is entered with CTRL-V CTRL-H. | |
| inoremap # X^H# | |
| set nowrapscan | |
| set ruler | |
| set background=dark | |
| filetype on | |
| filetype indent on | |
| au filetype ruby set ts=2 sw=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'rubydns' | |
| port = Integer(ARGV[0] || '53') | |
| INTERFACES = [ | |
| [:udp, "0.0.0.0", port], | |
| [:tcp, "0.0.0.0", port] | |
| ] | |
| Name = Resolv::DNS::Name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## web interface | |
| ### port numbers | |
| * name node: 50070 | |
| * job tracker: 50030 | |
| * data node: 50075 | |
| * task tracker: 50060 | |
| ### operations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exec_request.per_node_scan_ranges??? | |
| Status ImpalaServer::ExecuteInternal( | |
| > RETURN_IF_ERROR((*exec_state)->UpdateQueryStatus(GetExecRequest(request, &result))); | |
| >> Java:FrontEnd | |
| > RETURN_IF_ERROR((*exec_state)->Exec(&result)); | |
| >> return ExecQueryOrDmlRequest(); | |
| >>> // If desc_tbl is not set, query has SELECT with no FROM. In that | |
| >>> // case, the query can only have a single fragment, and that fragment needs to be | |
| >>> // executed by the coordinator. This check confirms that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Trie : sig | |
| type t | |
| val empty : t | |
| val update : string -> int -> t -> t | |
| val find : t -> string -> int list option | |
| val create_from_text : string -> t | |
| end = | |
| struct | |
| type node = {c:char; poslist:int list; children:t} | |
| and t = node list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ RUBY_LIB=lib irb | |
| irb(main):001:0> require 'fluent/load' | |
| => true | |
| irb(main):002:0> tp = Fluent::TextParser.new | |
| => #<Fluent::TextParser:0x007f91cab5c3a0 @parser=nil> | |
| irb(main):003:0> tp.configure({'format' => 'apache2'}) | |
| => true | |
| irb(main):004:0> s = %q|64.242.88.10 - - [07/Mar/2004:16:06:51 -0800] "GET /twiki/bin/rdiff/TWiki/NewUserTemplate?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4523| | |
| => "64.242.88.10 - - [07/Mar/2004:16:06:51 -0800] \"GET /twiki/bin/rdiff/TWiki/NewUserTemplate?rev1=1.3&rev2=1.2 HTTP/1.1\" 200 4523" | |
| irb(main):005:0> p Time.now; 1000000.times{tp.parse(s)}; p Time.now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'impala' | |
| conn = Impala.connect('127.0.0.1', 21000) do |conn| | |
| p conn.query('SELECT zip, income FROM zipcode_incomes ORDER BY income DESC') | |
| end |