This file contains hidden or 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
| """ | |
| Forked and heavily adappted from: | |
| https://gist.github.com/kitwalker12/517d99c3835975ad4d1718d28a63553e | |
| Copies all keys from the source Redis host to the destination Redis host. | |
| Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are | |
| restricted (e.g. on Amazon ElastiCache). | |
| The script scans through the keyspace of the given database number and uses | |
| a pipeline of DUMP and RESTORE commands to migrate the keys. |
This file contains hidden or 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
| Sat Nov 11 00:07:24 UTC 2017 |
This file contains hidden or 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
| replica_sets = mm_env['replica_sets'] # node1:port&node2:port | |
| rs_list = replica_sets.split("&").map {|rs| host,port = rs.split(":"); [host,port.to_i] } | |
| MongoMapper.connection = Mongo::RetryReplicaSetConnection.new(*(rs_list << {:read_secondary => true, :auto_refresh => true })) | |
| MongoMapper.database = mm_env['database'] | |
| MongoMapper.database.authenticate(mm_env['username'], mm_env['password']) |
This file contains hidden or 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
| # unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| # 16 workers and 1 master | |
| worker_processes (rails_env == 'production' ? 16 : 4) | |
| # Load rails+github.git into the master before forking workers | |
| # for super-fast worker spawn times | |
| preload_app true |
This file contains hidden or 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
| # Created by Eric Lindvall <[email protected]> | |
| # | |
| # WHAT: Provides a simple overview of memory allocation occuring during a | |
| # require. | |
| # | |
| # For a longer explanation, see my post at: | |
| # | |
| # http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
| # | |
| # NOTE: The numbers provided are of self + children, meaning the same will |
This file contains hidden or 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 'pp' | |
| require 'rubygems' | |
| require 'mongo_mapper' | |
| MongoMapper.database = 'testing' | |
| class Rating | |
| include MongoMapper::EmbeddedDocument | |
| key :user_id, ObjectId |
This file contains hidden or 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
| upstream unicorn { | |
| server unix:/var/www/example/current/tmp/sockets/unicorn.sock; | |
| } | |
| server { | |
| listen 80; | |
| server_name example.org www.example.org; | |
| access_log /var/log/nginx/example.access.log; | |
| location / { | |
| root /var/www/example/current/public/; | |
| if (-f $request_filename) { |
This file contains hidden or 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
| module ShouldaContextExtensions | |
| def self.included(base) | |
| base.class_eval do | |
| alias_method_chain :build, :fast_context | |
| alias_method_chain :am_subcontext?, :fast_context | |
| end | |
| end | |
| def fast_context(name, &blk) | |
| @fast_subcontexts ||= [] |
This file contains hidden or 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
| #! /usr/bin/env ruby | |
| MEMORY_LIMIT = 300 | |
| # Parse output like this | |
| # --------- Passenger processes ---------- | |
| # PID Threads VMSize Private Name | |
| # ---------------------------------------- | |
| # 1942 27 24.0 MB 1.1 MB PassengerNginxHelperServer /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.5 /opt/ruby-enterprise/bin/ruby 3 4 0 6 0 0 1 nobody 33 33 /tmp/passenger.1939 | |
| # 1957 1 71.0 MB 10.5 MB Passenger spawn server |
This file contains hidden or 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 'rubygems' | |
| require 'test/unit' | |
| require 'shoulda' | |
| class NestedMacrosTest < Test::Unit::TestCase | |
| def self.named_context(name, &block) | |
| context "named context #{name}" do | |
| setup do | |
| @foo = name |
NewerOlder