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
python twitter-harvest.py --db mongodb-uri --consumer-key consumer-key --consumer-secret consumer-secret --access-token access-token --access-secret access-secret -r --numtweets 100 |
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
% python twitter-harvest.py -h | |
optional arguments: | |
-h, --help help | |
-r, --retweet include native retweets | |
-v, --verbose print harvested tweets in shell | |
--numtweets NUMTWEETS set harvest number | |
--user USER choose twitter user timeline | |
--db DB MongoDB URI |
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
python twitter-harvest.py -h | |
usage: twitter-harvest.py [-h] [-r] [-v] [--numtweets NUMTWEETS][--user USER] | |
--db DB --consumer-key CONSUMER_KEY | |
--consumer-secret CONSUMER_SECRET | |
--access-token ACCESS_TOKEN | |
--access-secret ACCESS_SECRET | |
optional arguments: |
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
python setup.py install | |
python twitter-harvest.py --consumer-key CONSUMER_KEY --consumer-secret CONSUMER_SECRET --access-token ACCESS_TOKEN --access-secret ACCESS_SECRET |
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
/* | |
* Copyright (c) 2013 ObjectLabs Corporation | |
* Distributed under the MIT license - http://opensource.org/licenses/MIT | |
* | |
* Written with mongo-2.11.2.jar | |
* A Java class connecting to a MongoDB database given a MongoDB Connection URI. | |
*/ | |
import java.net.UnknownHostException; | |
import com.mongodb.*; |
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
var express = require('express'); | |
var mongodb = require('mongodb'); | |
var app = express(); | |
var MONGODB_URI = 'mongo-uri'; | |
app.get('/', function(req, res) { | |
// BAD! Creates a new connection pool for every request | |
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
var express = require('express'); | |
var mongodb = require('mongodb'); | |
var app = express(); | |
var MONGODB_URI = 'mongodb-uri'; | |
var db; | |
var coll; | |
// Initialize connection once |
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
Mon Oct 7 17:44:25.121 [initandlisten] connection accepted from 127.0.0.1:59002 #2 (1 connection now open) | |
Mon Oct 7 17:44:25.121 [initandlisten] connection accepted from 127.0.0.1:59003 #3 (2 connections now open) | |
Mon Oct 7 17:44:25.122 [initandlisten] connection accepted from 127.0.0.1:59004 #4 (3 connections now open) | |
Mon Oct 7 17:44:25.123 [initandlisten] connection accepted from 127.0.0.1:59005 #5 (4 connections now open) | |
Mon Oct 7 17:44:25.123 [initandlisten] connection accepted from 127.0.0.1:59006 #6 (5 connections now open) | |
Mon Oct 7 17:44:25.591 [initandlisten] connection accepted from 127.0.0.1:59007 #7 (6 connections now open) | |
Mon Oct 7 17:44:25.592 [conn7] end connection 127.0.0.1:59007 (5 connections now open) | |
Mon Oct 7 17:44:25.593 [initandlisten] connection accepted from 127.0.0.1:59008 #8 (6 connections now open) | |
Mon Oct 7 17:44:25.594 [initandlisten] connection accepted from 127.0.0.1:59009 #9 (7 connections now open) | |
Mon Oct 7 17:44:25.595 [initandlisten] connection accepted from |
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
/* Mongoose 3.8.x configuration settings | |
* | |
* As discussed in: www.blogpost.com | |
*/ | |
var mongoose = require('mongoose'); | |
var uriUtil = require('mongodb-uri'); | |
/* | |
* Mongoose by default sets the auto_reconnect option to true. |
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
var MongoClient = require('mongodb').MongoClient; | |
var URI = 'mongodb://localhost/test'; | |
var options = { server : { poolSize : 5 } }; | |
MongoClient.connect(URI, options, | |
function(err, db) { | |
//Create arbitrary long operation | |
db.eval('function (x) { while(x<10000000000){x++;} }',[0], { nolock: true }, function(err, result){ |
OlderNewer