Skip to content

Instantly share code, notes, and snippets.

View mediocretes's full-sized avatar

Nathan D Acuff mediocretes

  • Expected Behavior
View GitHub Profile
@mediocretes
mediocretes / gist:721969
Created November 30, 2010 16:56
mongostat output
insert/s query/s update/s delete/s getmore/s command/s flushes/s mapped vsize res faults/s locked % idx miss % q t|r|w conn time
123 455 342 148 57 77 0 153752 159869 10902 16 28.7 0 0|0|0 498 16:55:21
136 484 408 188 82 129 0 153752 159869 10902 42 45.3 2.3 0|0|0 498 16:55:22
113 530 579 184 70 155 0 153752 159869 10903 39 62.3 0 17|6|11 498 16:55:23
100 564 362 178 57 167 0 153752 159869 10903 26 50.6 0 36|18|18 498 16:55:24
87 400 266 133 70 89 0 153752 159869 10903 33 47.2 3.4 48|25|23 498 16:55:25
143 309 153 67 3 34 0 153752 159869 10899 12 16.4 0 0|0|0 498 16:55:26
129 6
total used free shared buffers cached
Mem: 17118 17023 95 0 147 15878
Low: 17118 17023 95
High: 0 0 0
-/+ buffers/cache: 997 16120
Swap: 0 0 0
Total: 17118 17023 95
> db.serverStatus()
{
* executing `production'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote [email protected]:iGoDigital-LLC/greenhawk.git HEAD"
* executing "git clone -q [email protected]:iGoDigital-LLC/greenhawk.git /var/www/greenHawk/releases/20101214204047 && cd /var/www/greenHawk/releases/20101214204047 && git checkout -q -b deploy 0cb2c6268134ea47690c1d32bbffeab425c171b6 && (echo 0cb2c6268134ea47690c1d32bbffeab425c171b6 > /var/www/greenHawk/releases/20101214204047/REVISION)"
servers: ["collector-l5.public.aws.igodigital.net"]
[collector-l5.public.aws.igodigital.net] executing command
** [collector-l5.public.aws.igodigital.net :: out] ERROR: Permission to iGoDigital-LLC/greenhawk denied to expectedbehavior/igodigital_analytics_dashboard.
migrate_one_faster = function(c) {
print("Collection: " + c);
print("Initial Count: " + db[c].count());
i = 0;
db[c].find({created_at:{$exists:true}}).forEach(function(item){
if(i++ % 10000 == 0){ print("progress: " + i);}
item.timestamp = item.created_at;
delete item.created_at;
db[c].save(item);
print(tojson(db.getLastErrorObj()));
insert/s query/s update/s delete/s getmore/s command/s flushes/s mapped vsize res faults/s locked % idx miss % q t|r|w conn time
12 275 275 0 114 4 0 218232 225400 21598 28 22.1 0 0|0|0 491 18:07:12
9 214 53 0 35 1 0 218232 225400 21598 7 6.5 0 0|0|0 491 18:07:13
7 197 43 0 54 5 0 218232 225400 21599 13 10.8 0 0|0|0 491 18:07:14
7 161 249 0 136 3 0 218232 225400 21602 27 33.8 0 0|0|0 491 18:07:15
10 257 47 0 61 5 0 218232 225400 21602 19 13.1 0 0|0|0 491 18:07:16
14 203 52 0 90 1 0 218232 225400 21602 8 5.2 0 0|0|0 491 18:07:17
11 195
class Simulation < ActiveRecord::Base
@queue = :simulation
@unique_jobs = true
@delayed_jobs = true
def simulate
Resque.enable_delay(:simulation) #call this elsewhere in a production app
Resque.enqueue(Simulation, {:_id => self.id, :delay_until => Time.now + 1800})
end
{ "_id" : ObjectId("4d5165a29426b56825000001"), "class" : "Simulation", "args" : [ { "submitted_by" : "Website", "punishment_id" : 2 } ], "resque_enqueue_timestamp" : "Tue Feb 08 2011 10:47:46 GMT-0500 (EST)" }
i = 0;
print("View load: " + db["Views." + x].find({ created_at:{ $exists:true}}).count());
db["Views." + x].find({ created_at:{ $exists:true}}).forEach(function(y){
y.timestamp = y.created_at;
delete y['created_at'];
db["Views." + x].save(y);
});
//OR:
db["Views." + x].remove({ created_at:{ $exists:true}});
Total movies 7645
Total actors 18973
Total movies with at least 2 actors 6778
Actors movie combinations 57187
bacon number 0 has 36
bacon number 1 has 1437
bacon number 2 has 5111
bacon number 3 has 566
bacon number 4 has 51
bacon number 5 has 13
class MiniTest::Unit
alias :run_test_suites_old :run_test_suites
def run_test_suites(filter = /./)
@test_count, @assertion_count = 0, 0
old_sync, @@out.sync = @@out.sync, true if @@out.respond_to? :sync=
TestCase.test_suites.each do |suite|
test_cases = suite.test_methods.grep(filter)
if test_cases.size > 0
@@out.print "\n#{suite}:\n"
end