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
inherit_from: .rubocop_todo.yml | |
Layout/SpaceBeforeBlockBraces: | |
Enabled: false | |
Style/NumericLiterals: | |
Enabled: false |
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
# class CreateCompanies < ActiveRecord::Migration | |
# def change | |
# create_table :companies do |t| | |
# t.string :name | |
# | |
# t.timestamps null: false | |
# 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
# Proc#call vs. yield - PB memo <http://d.hatena.ne.jp/nagachika/20111105/proc_call_versus_yield> | |
require 'benchmark' | |
n = 1_000_000 | |
def m1 | |
yield :m1 | |
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
require 'aws-sdk' | |
client = Aws::S3::Client.new( | |
access_key_id: "your_access_key_id", | |
secret_access_key: "your_access_key", | |
) | |
s3.list_objects(bucket: "your-bucket", prefix: "path/to/folder", delimiter: "/").common_prefixes.map(&:prefix) |
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
# AWS SDK v1 | |
require 'aws-sdk' | |
AWS.config(:access_key_id => 'foo', :secret_access_key => 'bar') | |
s3 = AWS::S3.new | |
key = "path/to/src" | |
s3.buckets['src_bucket'].objects.with_prefix(key).each do |o| | |
o.copy_to(o.key, bucket_name: "dst_bucket") | |
end |
- Installation
- Download DMG
- Launch
sudo launchctl load /Library/LaunchDaemons/td-agent.plist
less /var/log/td-agent/td-agent.log
- Post Sample Log
curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
- Send to S3
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/sh | |
DB="some_db" | |
DB_USER="user" | |
DB_PASS="pass" | |
TABLE="users" | |
CSV_FILE="/tmp/users.csv" | |
N_RECORD=1000000 |
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
# spec/support/database_rewinder.rb | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseRewinder['test'] | |
Octopus.config[Rails.env].each do |shard, shard_config| | |
DatabaseRewinder.cleaners << DatabaseRewinder::Cleaner.new( | |
config: shard_config, | |
connection_name: shard, |
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
SELECT id, name FROM users INTO OUTFILE work/users.tsv |
NewerOlder