Skip to content

Instantly share code, notes, and snippets.

View crowdmatt's full-sized avatar

Matthew Moore crowdmatt

View GitHub Profile
=SUMPRODUCT((E2:E4106<>"")/COUNTIF(E2:E4106,E2:E4106&""))
---- Begin output of echo 'sinatra restart' && sleep 0 && ../shared/scripts/unicorn clean-restart ----
STDOUT: STDERR: /opt/aws/opsworks/releases/20130418090734_113/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/node/attribute.rb:374:in `auto_vivifiy': You tried to set a nested key, where the parent is not a hash-like object: deploy/[MYAPP]/environment/RAILS_ENV/RAILS_ENV (ArgumentError)
from /opt/aws/opsworks/releases/20130418090734_113/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/node/attribute.rb:280:in `get_value'
from /opt/aws/opsworks/releases/20130418090734_113/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/node/attribute.rb:269:in `upto'
from /opt/aws/opsworks/releases/20130418090734_113/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/node/attribute.rb:269:in `get_value'
from /opt/aws/opsworks/releases/20130418090734_113/vendor/bundle/ruby/1.8/gems/chef-0.9.15.5/bin/../lib/chef/node/attribute.rb:134:in `each'
from /opt/aws/opsworks/releases/20130418090734_
@crowdmatt
crowdmatt / s3-redshift-load.rb
Created April 26, 2013 00:25
Example of loading data into Amazon Redshift using redshift database adapter.
ActiveRecord::Base.connection.execute(
"copy campaign_events from 's3://BUCKET/FILEPATHPREFIX/' credentials 'aws_access_key_id=XXX;aws_secret_access_key=XXX' emptyasnull blanksasnull fillrecord delimiter '|'"
)
gsutil -m cp -r s3://my-s3-bucket gs://my-gs-bucket
=CELL/(1000000000.00*60*60*24)+"1/1/1970"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
LIGHT_CYAN="\[\033[1;36m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"