This file contains 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
> mongoimport --help | |
Import CSV, TSV or JSON data into MongoDB. | |
When importing JSON documents, each document must be a separate line of the input file. | |
Example: | |
mongoimport --host myhost --db my_cms --collection docs < mydocfile.json | |
options: | |
--help produce help message |
This file contains 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
initKeenIO: (project_id, write_key) -> | |
window.Keen = window.Keen || { | |
configure: (e) -> | |
this._cf = e | |
addEvent: (e,t,n,i) -> | |
this._eq = this._eq || [] | |
this._eq.push [e,t,n,i] | |
setGlobalProperties: (e) -> | |
this._gp = e | |
onChartsReady: (e) -> |
This file contains 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
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch target_file.ext’ --prune-empty --tag-name-filter cat -- --all |
This file contains 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
$('.issue-title-link').each(function(i, el) { | |
window.open($(el).attr('href'), '_blank') | |
}); |
This file contains 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
#!/bin/bash | |
# credit: Robert Larsen | |
function create_shard(){ | |
shard=$1 | |
repl_factor=$2 | |
shard_name="shard_${shard}" | |
shard_dir=shard${shard} | |
init='rs.initiate({_id:"'${shard_name}'",members:[' |
This file contains 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
prompt = function() { | |
var ndocs, obj, p, sec; | |
ndocs = function(n) { | |
return "" + n + " document" + (n > 1 ? 's' : ''); | |
}; | |
db.setProfilingLevel(2); | |
obj = db.getLastErrorObj(); | |
p = db.system.profile.find({ | |
$and: [ | |
{ns: {$not: /profile$/}}, |
This file contains 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
db.users.insert({"_id":"joe","joined":ISODate("2012-02-03T00:00:00Z"),"likes":["tennis","golf"]}) | |
db.users.insert({"_id":"jane","joined":ISODate("2012-02-09T00:00:00Z"),"likes":["tennis","golf"]}) | |
db.users.insert({"_id":"remesh","joined":ISODate("2012-05-05T00:00:00Z"),"likes":["basketball"]}) | |
db.users.insert({"_id":"john","joined":ISODate("2012-03-05T00:00:00Z"),"likes":[]}) | |
db.users.insert({"_id":"mary","joined":ISODate("2012-03-22T00:00:00Z"),"likes":["golf","sailing"]}) | |
db.users.insert({"_id":"ann","joined":ISODate("2012-01-22T00:00:00Z"),"likes":["golf","basketball"]}) | |
db.users.insert({"_id":"jim","joined":ISODate("2012-11-01T00:00:00Z"),"likes":["tennis","fishing","golf","snowboard","football"]}) |
This file contains 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
> db.getSisterDB('week5').help() | |
DB methods: | |
db.addUser(username, password[, readOnly=false]) | |
db.adminCommand(nameOrDocument) - switches to 'admin' db, and runs command [ just calls db.runCommand(...) ] | |
db.auth(username, password) | |
db.cloneDatabase(fromhost) | |
db.commandHelp(name) returns the help for the command | |
db.copyDatabase(fromdb, todb, fromhost) | |
db.createCollection(name, { size : ..., capped : ..., max : ... } ) | |
db.currentOp() displays currently executing operations in the db |
This file contains 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
# dependencies | |
fs = require 'fs' | |
http = require 'http' | |
path = require 'path' | |
Crawler = require 'crawler' | |
# script | |
crawled = {} | |
c = new Crawler { |
OlderNewer