This file contains hidden or 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
import atexit | |
calls = 0 | |
signature_calls = 0 | |
def some_generator(target, source, env, for_signature): | |
global calls, signature_calls | |
calls += 1 | |
if for_signature: | |
signature_calls += 1 |
This file contains hidden or 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
/usr/bin/time /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --dbg=on --opt=on --link-model=dynamic --implicit-cache --cache --experimental-visibility-support=on --install-action=hardlink --build-tools=next --disable-warnings-as-errors --modules= --build-dir=$(pwd)/build/toolpy37 --cache-dir=$(pwd)/cache -j300 install-unittests --debug=time 2>&1 | tee toolpy37.cleanbuild.log | |
/usr/bin/time python3.8 buildscripts/scons.py --dbg=on --opt=on --link-model=dynamic --implicit-cache --cache --experimental-visibility-support=on --install-action=hardlink --build-tools=next --disable-warnings-as-errors --modules= --build-dir=$(pwd)/build/syspy38 --cache-dir=$(pwd)/cache -j300 install-unittests --debug=time 2>&1 | tee syspy38.cleanbuild.log | |
\rm -rf build/toolpy37/cached build/toolpy37/install | |
/usr/bin/time /opt/mongodbtoolchain/v3/bin/python3 buildscripts/scons.py --dbg=on --opt=on --link-model=dynamic --implicit-cache --cache --experimental-visibility-support=on --install-acti |
This file contains hidden or 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
namespace { | |
class Canary { | |
public: | |
static constexpr size_t kSize = 1024; | |
explicit Canary(volatile unsigned char* const t) noexcept : _t(t) { | |
::memset(const_cast<unsigned char*>(_t), kBits, kSize); | |
_verify(); |
This file contains hidden or 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
#ifndef LIBFOO_H_INCLUDED | |
#define LIBFOO_H_INCLUDED | |
#pragma once | |
#include "libfoo_export.h" | |
#if defined(__cplusplus) | |
#define LIBFOO_NOEXCEPT noexcept |
This file contains hidden or 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
OS X: | |
mkdir SKUNKWORKS | |
cd SKUNKWORKS | |
git clone https://github.com/acmorrow/mongo | |
cd mongo | |
git checkout sw-cmake | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja |
This file contains hidden or 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 numDatabases = 3; | |
var numDocumentsPerCollection = 5; | |
var collections = []; | |
for ( var i=0; i<numDatabases; i++ ) { | |
collections.push( db.getSisterDB("mms" + i).things ); | |
} | |
var base = { a : 0, h : {}, z : 0 }; |
This file contains hidden or 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
// In C++11, one constructor can call another, so we don't need to rewrite | |
// the initializer list again() and again() and again() and again()... | |
struct Thing { | |
Thing(std::string name, Color color) | |
: name_(std::move(name)) | |
, color_(color) {} | |
Thing(std::string name) | |
: Thing(name, Color::Green) {} |
This file contains hidden or 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
// In C++03, we need to resort to tricks or funky | |
// base classes to control whether classes are copyable: | |
class Foo : public boost::noncopyable{}; | |
class Bar { | |
private: | |
Bar(const Bar&); // Not implemented | |
Bar& operator=(const Bar&); // Not implemented | |
}; |
This file contains hidden or 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
// In C++11, we can ask for the size of a type for which we don't have an instance: | |
class Tcp6Socket { | |
public: | |
struct SockAddr { ... }; | |
}; | |
char buf[1024]; | |
static_assert(sizeof(buf) >= sizeof(Tcp6Socket::SockAddr)); | |
// Can't do that in C++03, but it works in C++11 |
This file contains hidden or 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
// C++11 offers a built-in "owning" pointer which allows transfer of ownership | |
// and manages lifetime but disallows copying. There is no runtime overhead for its use: | |
std::unique_ptr<socket> connect_to(const std::string& host, int port) { | |
/// ... | |
return new socket(fd); | |
} | |
{ | |
auto connected = connect_to("www.10gen.com", 80); |
NewerOlder