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
from pymongo.connection import Connection , ConnectionFailure | |
import datetime | |
try: | |
connection = Connection("localhost", 27017) | |
except ConnectionFailure: | |
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>""" | |
except Exception, detail: | |
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>""" |
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
from pymongo.connection import Connection , ConnectionFailure | |
import datetime | |
try: | |
connection = Connection("localhost", 27017) | |
except ConnectionFailure: | |
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>""" | |
except Exception, detail: | |
page_content = """<span class = "error">could not connect connect:besure that Mongo is running on localhost:27017</span>""" |
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
// sm.cpp | |
#define XP_UNIX | |
#include "mozjs/jsapi.h" | |
#include <string> | |
#include <string.h> | |
#include <assert.h> | |
#include <malloc.h> | |
/* The class of the global object. */ |
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
t = db.blah; | |
t.drop(); | |
t.save( { screenshots : 1 } ) | |
t.save( { screenshots : [ 1 ] } ) | |
printjson( t.find( { "$where" : "this.screenshots instanceof Array" } ).toArray() ) |
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.foo.drop() | |
o = { "upc" : 1 , | |
"related_skus" : [ 1,2, 3, 4, 5, 6 ] , | |
"price_special" : 700000, | |
"short_name" : "sn700000", | |
"ean" : "ean700000", | |
"price_promo" :700000, | |
"long_name" : "ln700000", | |
"url" : "url700000", |
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
coll = db.foo | |
coll.drop() | |
coll.insert( { arr : [ { a : 1 } , { b : 2 } , { c : 3 } ] } ) | |
coll.insert( { arr : [ { a : 2 } , { b : 3 } , { c : 1 } ] } ) | |
coll.insert( { arr : [ { a : 3 } , { b : 1 } , { c : 2 } ] } ) | |
coll.ensureIndex( { arr : -1 } ) |
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
// bm.cpp | |
// g++ test.cpp -lboost_thread-mt && ./a.out | |
// the ration of XXX and YYY determines | |
// if this works or deadlocks | |
int XXX = 20; | |
int YYY = 10; | |
#include <boost/thread.hpp> |
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
Verifying that +eliothorowitz is my blockchain ID. https://onename.com/eliothorowitz |
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
### Keybase proof | |
I hereby claim: | |
* I am erh on github. | |
* I am eliothorowitz (https://keybase.io/eliothorowitz) on keybase. | |
* I have a public key whose fingerprint is 7A3D D73A B8EF 0948 E7AE 9DD9 4409 F717 FB48 BD6C | |
To claim this, I am signing this object: |
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
package main | |
import "flag" | |
import "runtime" | |
import "sync/atomic" | |
import "time" | |
import "gopkg.in/mgo.v2" | |
import "gopkg.in/mgo.v2/bson" |
OlderNewer