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
View gist:99ae1591340be381f868
DELETE joininess-product
DELETE joininess-save
DELETE joininess-user
PUT joininess-product
PUT joininess-save
PUT joininess-user
DELETE joininess-product/_mapping/product
GET joininess-product/_mapping/product
View gist:061f95d3c159b1a7a315
# global zone
MAC_ADDRESS=$(dladm show-phys -m e1000g1 | tail +2 | awk '{ print $3 }')
ZONENAME=$(zoneadm list | grep -v global)
nictagadm add external "${MAC_ADDRESS}"
echo '{"add_nics":[{"nic_tag":"external","ip":"dhcp"}]}' | vmadm update ${ZONENAME}