View __scenario_flows.rb
# lib/test/scenario_flows.rb
module Test
module ScenarioFlows
def formatter
@formatter ||= RSpec.configuration.formatters.first
end
def formatter_names
@formatter_names ||= RSpec.configuration.formatters.map { |f| f.class.to_s }.join(' ')
View ffmpeg -- logo overlay
ffmpeg -i video.mp4 -vf \
"movie=logo.png [overlay]; \
[overlay] scale=250:-1 [a]; \
[a] format=yuva420p,colorchannelmixer=aa=0.5 [b]; \
[in] curves=preset=lighter [vid]; \
[vid][b] overlay=50:50 [out]" \
-pix_fmt yuv420p \
output.mp4 \
&& terminal-notifier -message 'done'
View consumer.rb
class Worker
include Sidekiq::Worker
def perform(message)
puts message
end
end
View load_data.sh
# interpolated load tables step
find . -type f -print0 | xargs -0 -n1 -P50 bash -c "psql -U <postgres_user> <mydatabase> < \$0"
View psql.rb
execute <<-EOSQL
CREATE SEQUENCE #{schema}.id_generator_seq;
CREATE OR REPLACE FUNCTION #{schema}.current_shard_id(OUT result int) AS $$
BEGIN
result := #{shard_id};
END;
$$ LANGUAGE PLPGSQL;
View connection_adapters.rb
require 'active_record/connection_adapters/postgresql_adapter'
module ActiveRecord
module ConnectionAdapters
class TableDefinition
def references(*args)
options = args.extract_options!
polymorphic = options.delete(:polymorphic)
index_options = options.delete(:index)
args.each do |col|
View database.yml
common: &common
adapter: postgresql
host: 127.0.0.1
port: 5432
username: *******
password: *******
encoding: unicode
pool: 20
min_messages: WARNING
schema_search_path: public
View postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
View databases.rake
# The built-in Rails database rake task is completely crazy, and defines methods on Object. This causes
# problems with Makara, which uses a delegator pattern along with method_missing.
require 'active_support/core_ext/object/inclusion'
require 'active_record'
class Object
remove_method :configs_for_environment
remove_method :create_database
remove_method :current_config
View fork arguments
> sudo dtrace -n '::forksys:entry / pid == $target / { printf("%d %d", arg0, arg1); }' -p 7580
CPU ID FUNCTION:NAME
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
7 13517 forksys:entry 0 0
0 13517 forksys:entry 0 0
0 13517 forksys:entry 0 0