Skip to content

Instantly share code, notes, and snippets.

@genseric
genseric / moveMongoCollections.js
Last active August 29, 2015 14:11
move mongo collections to specific databases decided by checking the name of the collection.
//all collections starting with c_ will be moved. must be careful on what you want to move
//after import don't forget to repair the new dbs by running repair on the whole mongo instance
//run by mongo <host> moveMongoCollections.js
mainDB='mainDB';
db = connect('127.0.0.1:27017/'+mainDB)
dbm = connect('127.0.0.1:27017/admin')
db.getCollectionNames().forEach(function(c) {
if(c.match(/^c_/)!=null){
@genseric
genseric / bongo.sh
Last active August 29, 2015 14:11 — forked from jmoiron/bongo.sh
fixed version for ubuntu
#!/bin/bash
LOADING=false
usage()
{
cat << EOF
usage: $0 [options] dbname
OPTIONS:
@genseric
genseric / 0_reuse_code.js
Created January 13, 2016 15:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console