- Installation
- Download DMG
- Launch
sudo launchctl load /Library/LaunchDaemons/td-agent.plistless /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
| # use twitter.gem earlier than 5.0.0 | |
| require "pp" | |
| require "twitter" | |
| # 1. Comment out oauth_token and oauth_token_secret. | |
| # 2. Visit https://dev.twitter.com/apps/new. Get consumer_key and consumer_secret. | |
| # 3. Execute. | |
| # 4. Visit the Developper's site agein. | |
| # 5. Go to "settings", and get oauth_token and oauth_token_secret. |
| I try to install libxml-ruby-2.3.3 at MacOSX Marvericks via gem (rbenv, Ruby-2.1.0), get below errors: | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing libxml-ruby: | |
| ERROR: Failed to build gem native extension. | |
| /Users/***/.rbenv/versions/2.1.0/bin/ruby extconf.rb | |
| extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config. | |
| extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config. | |
| checking for socket() in -lsocket... no |
| http://stackoverflow.com/questions/13963404/rails-and-os-x-how-to-install-rmagick | |
| $ cd `Magick-config --prefix`/lib | |
| $ for f in libMagick*-*.[0-9].dylib; do ln -s $f `echo $f | sed -e 's/-.*\.dylib/.dylib/'`; done |
| SELECT id, name FROM users INTO OUTFILE work/users.tsv |
| # 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, |
| #!/bin/sh | |
| DB="some_db" | |
| DB_USER="user" | |
| DB_PASS="pass" | |
| TABLE="users" | |
| CSV_FILE="/tmp/users.csv" | |
| N_RECORD=1000000 |
sudo launchctl load /Library/LaunchDaemons/td-agent.plist
less /var/log/td-agent/td-agent.logcurl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
| # 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 |
| 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) |
| # 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 |