Skip to content

Instantly share code, notes, and snippets.

View victorcampos's full-sized avatar

Victor Campos victorcampos

View GitHub Profile
@victorcampos
victorcampos / drop.js
Created July 1, 2011 15:23
MongoDB - Drop tmp.mr for temporary mapReduce collections
db.system.namespaces.find({ name : /tmp.mr/ }).forEach(function(z) {
try {
db.getMongo().getCollection( z.name ).drop();
} catch (exception) {
try {
db.getMongo().getCollection( z.name.replace("$", "\\$") ).drop();
} catch(exception2) {
printjson({ error : 'error dropping collection', e : exception });
}
}
@victorcampos
victorcampos / mongo_clean_shutdown.sh
Created June 29, 2011 02:19
Startup and shutdown scripts for MongoDB 1.8.2 (setting journaling, dbpath, daemonize, logging and rest interface)
#!/bin/bash
kill -2 `cat /data/mongod.lock`
# MacPorts Installer addition on 2010-09-24_at_01:54:57: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export SVN_EDITOR="/usr/bin/vim"
# Finished adapting your PATH environment variable for use with MacPorts.
alias sshi='ssh -i ~/.ssh/piva'
alias sshprod='sshi piva@200.215.178.220'
alias sshprodtunnel='sshi -fvND 9090 piva@200.215.178.220'
alias sshec2='ssh -i ~/.ssh/piva.pem root@174.129.25.171'
alias scpec2='scp -i ~/.ssh/piva.pem'