Skip to content

Instantly share code, notes, and snippets.

Eliot Horowitz erh

Block or report user

Report or block erh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mongo_conn_test.go
package main
import "flag"
import "runtime"
import "sync/atomic"
import "time"
import "gopkg.in/mgo.v2"
import "gopkg.in/mgo.v2/bson"
View gist:908067250006a6067506
### 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:
@erh
erh / gist:bfc65a3b11555dc1f7c5
Created Oct 21, 2015
one name verification
View gist:bfc65a3b11555dc1f7c5
Verifying that +eliothorowitz is my blockchain ID. https://onename.com/eliothorowitz
@erh
erh / README.md
Last active Jan 23, 2018
sample aggregation stage module - inject
View README.md

This is a sample aggregation stage that insert a field into every document.

Steps:

  1. Git clone the mongodb source code.
  2. Create a directory called 'modules' in src/mongo/db/modules.
  3. Git clone this repo as src/mongo/db/modules/inject
  4. Build MongoDB
  5. Now try the new aggregation stage:
@erh
erh / histogram.py
Last active Dec 19, 2015
This is a very simple python program that reads your email inbox and generates a histogram of how much email is unread in your inbox.
View histogram.py
#/usr/bin/env python
###
### This generates a very simple histogram of unread e-mail in your INBOX.
### This is meant as a toy, and your are free to do whatever you want with the code.
###
# core python libraries
import datetime
@erh
erh / test.cpp
Created Apr 25, 2011
boost shared_mutex test
View test.cpp
// 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>
View MultiKey sorting example
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 } )
View big1.js
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",
View where with js types
t = db.blah;
t.drop();
t.save( { screenshots : 1 } )
t.save( { screenshots : [ 1 ] } )
printjson( t.find( { "$where" : "this.screenshots instanceof Array" } ).toArray() )
View gist:107056
// 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. */
You can’t perform that action at this time.