# config.yml.liquid
in:
type: file
path_prefix: /Users/akira/sketch/embulk/sample/try1/csv/sample_
decoders:
- {type: gzip}
parser:
charset: UTF-8
newline: CRLF
This file contains 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 "fileutils" | |
class ScatteredFile | |
attr_writer :filelist | |
def initialize(file_template) | |
@file_template = file_template | |
@filelist = [] |
This file contains 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
enum A : String, EnumProtocol { | |
case AAA, BBB | |
} | |
protocol EnumProtocol { | |
func desc() -> String | |
} | |
extension EnumProtocol { | |
func desc() -> String { return self.rawValue } // Value of type 'Self' has no member 'rawValue' |
This file contains 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 | |
module StringRefine | |
refine String do | |
def refine_test | |
self.upcase | |
end | |
end | |
end |
This file contains 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
#!/bin/bash | |
if [[ -z "$1" ]]; then | |
echo "[error] app_name required." >&2 | |
echo "Usage:" >&2 | |
echo " bash $0 app_name args..." >&2 | |
exit 1 | |
fi | |
app_name=$1 |
This file contains 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 | |
@hoge = "@fuga" | |
@fuga = "@hoge" | |
puts "#@hoge" | |
puts eval "#@hoge" | |
puts eval eval "#@hoge" | |
puts eval eval eval "#@hoge" | |
# => |
This file contains 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
$ \pry --no-plugins | |
[1] pry(main)> RUBY_VERSION | |
"2.1.2" | |
[2] pry(main)> Pry::VERSION | |
"0.10.1" | |
[3] pry(main)> def class; end | |
:class | |
[4] pry(main)> class Hoge; end | |
/Users/akira/.rvm/gems/ruby-2.1.2/gems/coderay-1.1.0/lib/coderay/scanner.rb:150:in `initialize': undefined method `normalize' for nil:NilClass (NoMethodError) | |
from /Users/akira/.rvm/gems/ruby-2.1.2/gems/coderay-1.1.0/lib/coderay.rb:269:in `new' |
This file contains 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
parallel= | |
xargs_type= | |
para_func= | |
function find_parallel() { | |
echo test | gparallel --gnu echo >/dev/null 2&>/dev/null && parallel="gparallel --gnu" && para_func="_parallel" | |
if [[ -z "$parallel" ]]; then | |
echo test | parallel --gnu echo >/dev/null 2&>/dev/null && parallel="parallel --gnu" && para_func="_parallel" | |
fi |
This file contains 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
# | |
# tw ( http://shokai.github.io/tw/ ) から fluentd を経由して Elasticsearch に投入する | |
# | |
# tw 単体で起動すると↓みたいな JSON が出力される | |
# $ tw --stream --format=json | |
# {"id":000000000000000000,"user":"XXXX","text":"test test test","time":"2014-03-20 01:00:00 +0900","fav_count":null,"rt_count":null} | |
# | |
$ tw --stream --format=json | fluent-cat twitter.timeline |
This file contains 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 SequelAutoTableLoader | |
def method_missing(name, *args, &block) | |
if name =~ /^#{self.class.const_get(:TABLE_PREFIX)}_/ | |
table_class_name = name.to_s.split(/_/).map(&:capitalize).join | |
table_name = [table_class_name[0].downcase, table_class_name[1..-1]].join | |
unless instance_variable_defined? "@#{name}" | |
instance_variable_set( | |
"@#{name}", | |
self.class.const_get(table_class_name).send( |
NewerOlder