Skip to content

Instantly share code, notes, and snippets.

@TylerBrock
TylerBrock / read_only_shard.js
Created September 24, 2014 00:22
Spin up read only shard
var st = new ShardingTest({
shards:1,
mongos:1,
other: {
rs: true,
numReplicas: 2,
separateConfig: true
}
})
@TylerBrock
TylerBrock / crud.cpp
Last active August 29, 2015 14:06
CRUD Example - C++11
/////////////////////////////////////////////////////////////////////
/// find
/////////////////////////////////////////////////////////////////////
// Coersion from document::view into model::find
auto cursor = coll.find(doc_view);
// Explicit creation of model::find
auto cursor = coll.find(model::find(doc_view).limit(10));
@TylerBrock
TylerBrock / aggregation.cpp
Created September 22, 2014 20:26
Aggregation Framework Example
/* Copyright 2014 10gen Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@TylerBrock
TylerBrock / standalone.feature
Last active August 29, 2015 14:06
Sample cucumber
Feature: Driver failure recovery
In order to ensure the driver remains usable in the face of failures
As a driver author
I want the driver to recover in the event of failures
Scenario: Server is stopped and started
Given a cluster in the standalone server configuration
When I insert a document
Then the insert succeeds
When I stop the server
db.test.write(std::vector awesome)
@TylerBrock
TylerBrock / magic.cpp
Last active August 29, 2015 14:05 — forked from acmorrow/magic
#ifndef LIBFOO_H_INCLUDED
#define LIBFOO_H_INCLUDED
#pragma once
#include "libfoo_export.h"
#if defined(__cplusplus)
#define LIBFOO_NOEXCEPT noexcept
extern "C" {
@TylerBrock
TylerBrock / configure
Created August 12, 2014 13:16
MongoDB C Driver man page install issue
$ ./configure --enable-man-pages --prefix /home/tbrock/mantest
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
@TylerBrock
TylerBrock / ssl_example.cpp
Last active August 29, 2015 14:00
MongoDB C++ Driver SSL example
#include "mongo/util/net/ssl_options.h"
#include "mongo/client/init.h"
int main() {
sslGlobalParams.sslMode.store(SSLGlobalParams::SSLMode_requireSSL);
// only really need a PEM on the server side
mongo::sslGlobalParams.sslPEMKeyFile = "<path/to/keyfile.pem>";
mongo::Status status = mongo::client::initialize();
yaourt trucov
1 aur/trucov 10.1-1 (1)
trucov coverage analysis tool a developer tool to analyze coverage information generated by gcc --coverage
==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)
==> -------------------------------------------------------
==> 1
==> Downloading trucov PKGBUILD from AUR...
x PKGBUILD
sudo ipsec auto --up xgen
104 "xgen" #1: STATE_MAIN_I1: initiate
003 "xgen" #1: received Vendor ID payload [RFC 3947] method set to=115
003 "xgen" #1: received Vendor ID payload [Dead Peer Detection]
106 "xgen" #1: STATE_MAIN_I2: sent MI2, expecting MR2
003 "xgen" #1: NAT-Traversal: Result using draft-ietf-ipsec-nat-t-ike (MacOS X): i am NATed
108 "xgen" #1: STATE_MAIN_I3: sent MI3, expecting MR3
004 "xgen" #1: STATE_MAIN_I4: ISAKMP SA established {auth=OAKLEY_PRESHARED_KEY cipher=oakley_3des_cbc_192 prf=oakley_sha group=modp1024}
117 "xgen" #2: STATE_QUICK_I1: initiate
003 "xgen" #2: NAT-Traversal: received 2 NAT-OA. ignored because peer is not NATed