Skip to content

Instantly share code, notes, and snippets.

View killLongRunningOps.js
// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid
@dszeto
dszeto / import_ml10m.rb
Created Jul 28, 2013
Import MovieLens 10M data set from http://www.grouplens.org/node/73 to PredictionIO 0.5.0
View import_ml10m.rb
require "predictionio"
if (ARGV[0].nil? || ARGV[1].nil?)
abort("Usage: import_ml.rb <app key> <movie lens data file>")
end
client = PredictionIO::Client.new(ARGV[0],
50,
"http://localhost:5586")
@dszeto
dszeto / import_ml.rb
Last active Dec 12, 2015
Import MovieLens 100k data set from http://www.grouplens.org/node/73 to PredictionIO 0.5.0
View import_ml.rb
require "predictionio"
if (ARGV[0].nil? || ARGV[1].nil?)
abort("Usage: import_ml.rb <app key> <movie lens data file>")
end
client = PredictionIO::Client.new(ARGV[0],
50,
"http://localhost:8000")