Skip to content

Instantly share code, notes, and snippets.

View joker1007's full-sized avatar

Tomohiro Hashidate joker1007

View GitHub Profile
@joker1007
joker1007 / gist:60b7f8e8dc1131656800f34342985fb3
Last active September 27, 2017 06:12
[Resolved] fluentd out_relabe is buffered??
<match dummy.tag>
  @type copy

  <store>
    @type relabel
    @label @bigquery-out
  </store>

  <store>
@joker1007
joker1007 / gist:b970e73a3c66f56f00be8d4c68ab67f7
Created December 19, 2016 08:09
Array#== irregular result (ruby-2.3.2, activesupport-5.0.0.1, test-unit-3.0.9)
# require 'active_support/all'
# require 'test/unit'
p({"foo" => "bar"} == {"foo" => "bar"}) # => true
p [{"foo" => "bar"}] == [{"foo" => "bar"}] # => true
@joker1007
joker1007 / Dockerfile
Last active July 4, 2022 13:55
Sample Dockerfile for rails app
FROM appbase
# install npm & bower packages
WORKDIR /root
COPY package.json bower.json /root/
RUN npm install --only=prod && \
npm cache clean && \
bower install --allow-root
# install gems
require 'pp'
require 'timeout'
require 'terminal-table'
require 'paint'
class EcsDeploy
WAIT_TIMEOUT = 300
CHECK_INTERVAL = 5
attr_reader \
@joker1007
joker1007 / docker_build_cap.rb
Created May 11, 2016 10:16
capistranoでビルドサーバーにdocker buildを実行してもらう処理のサンプル
namespace :docker do
desc "build and push docker image on remote host"
task :build do
docker_registry_host = SSHKit::Host.new(fetch(:docker_registry_host))
docker_registry_host.ssh_options = {
user: "ec2-user",
keys: ENV['SSH_KEY'],
}
sha1 = `git rev-parse #{fetch(:branch)}`.chomp
@joker1007
joker1007 / embulk_error.md
Created February 1, 2016 07:31
embulk_error
Caused by: org.embulk.config.ConfigException: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Character out of VALUE_STRING token
 at [Source: N/A; line: -1, column: -1]
        at org.embulk.config.ModelManager.readObjectWithConfigSerDe(org/embulk/config/ModelManager.java:75)
        at org.embulk.config.DataSourceImpl.loadConfig(org/embulk/config/DataSourceImpl.java:220)
        at org.embulk.standards.CsvFormatterPlugin.transaction(org/embulk/standards/CsvFormatterPlugin.java:91)
        at org.embulk.spi.FileOutputRunner$RunnerControl$1.run(org/embulk/spi/FileOutputRunner.java:101)
        at org.embulk.spi.util.Encoders$RecursiveControl.transaction(org/embulk/spi/util/Encoders.java:77)
        at org.embulk.spi.util.Encoders.transaction(org/embulk/spi/util/Encoders.java:33)
        at org.embulk.spi.FileOutputRunner$RunnerControl.run(org/embulk/spi/FileOutputRunner.java:98)
@joker1007
joker1007 / dump.rb
Last active January 24, 2016 12:23
異なるmsgpackのバージョン同士でのdumpとload
require 'msgpack'
data = {
"foo" => "bar",
"ascii" => "bar".force_encoding(Encoding::ASCII_8BIT),
"utf8" => "あいうえお".force_encoding(Encoding::UTF_8),
"bad_ascii" => "あいうえお".force_encoding(Encoding::ASCII_8BIT),
"binary" => "Ruby".unpack("U*").pack("i*"),
"int" => 42,
"float" => 2.3,
@joker1007
joker1007 / esm_drinkup_sake_list.md
Last active December 20, 2015 06:48
Rubykaigi2015 ESM drinkupで提供予定の日本酒一覧

ESM Drinkup で提供予定のお酒一覧

  • いづみ橋 恵 青ラベル 純米吟醸 1800ml
  • いづみ橋 桃色黒とんぼ きもと純米酒 1800ml
  • 七本鎗 無有(むう) 無農薬純米 1800ml
  • 七本鎗 純米吟醸 "吟吹雪" 1800ml
  • 七田 純米吟醸 雄町50 1800ml
  • 三井の寿(みいのことぶき) 純米吟醸 酒未来 福岡県産 1800ml
  • 上喜元 純米 "雄町" 1800ml
  • 作 雅乃智(純米大 吟醸中取り) 1.8L
class TestObject
def initialize(name)
@name = name
@children = []
end
def add_child(child)
@children << child
self
end
@joker1007
joker1007 / 10_create_users.rb
Created May 5, 2015 11:55
FactoryGirlのtransientとtraitのサンプル
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.references :user_account
t.timestamps null: false
end
end
end