Skip to content

Instantly share code, notes, and snippets.

View BillyDonahue's full-sized avatar
🎯
Focusing

Billy Donahue BillyDonahue

🎯
Focusing
  • MongoDB
  • New York
View GitHub Profile
@BillyDonahue
BillyDonahue / vec.cc
Last active January 2, 2018 01:12
operator= by ref vs by value.
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
struct AssignByRef {
explicit AssignByRef(std::string s) : s(std::move(s)) {}
AssignByRef(const AssignByRef& src) : s(src.s) {}
AssignByRef(AssignByRef&& src) : s(std::move(src.s)) {}
AssignByRef& operator=(const AssignByRef& src) { // copy assign
--- /Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf 2017-01-17 11:01:38.000000000 -0500
+++ /usr/local/etc/avrdude.conf 2016-02-16 16:30:04.000000000 -0500
@@ -828,118 +828,100 @@
usbvendor = "www.fischl.de";
usbproduct = "USBasp";
# following variants are autodetected for id "usbasp"
# original usbasp from fischl.de
# see above "usbasp"
@BillyDonahue
BillyDonahue / nm output
Last active June 20, 2019 22:02
intelFP renames missed
$ nm --extern-only --defined-only build/dynamic_gcc/third_party/IntelRDFPMathLib20U1/libintel_decimal128.so |grep -v mongodb_local |sort -k3
00000000000ca1c0 T bid128_to_binary128_2part
00000000003de060 D bid_bid_bid_recip_scale32
00000000003de000 D bid_bid_reciprocals10_32
0000000000014c60 T bid_f128_acos
0000000000014cb0 T bid_f128_acosd
0000000000014230 T bid_f128_acosh
00000000000125e0 T bid_f128_add
0000000000014bb0 T bid_f128_asin
0000000000014c00 T bid_f128_asind
@BillyDonahue
BillyDonahue / utf8_decoder.cpp
Last active August 28, 2019 01:22
Utf8 to uint16_t decoder
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <string>
struct Utf8Decoder {
Utf8Decoder() : state(0), value(0) {}
/// \return
+/**
+ * Test uniformity of nextInt32(max)
+ */
+TEST(RandomTest, NextInt32Uniformity) {
+ PseudoRandom prng(10);
+ /* Break the range into sections. */
+ /* Check that all sections get roughly equal # of hits */
+ constexpr int32_t kMax = (int32_t{3} << 29) - 1;
+ constexpr size_t kBuckets = 64;
+ constexpr size_t kNIter = 1'000'000;
#include <cstdint>
#include <iostream>
#include <type_traits>
template <typename> const std::string tName{"???"};
template <> const std::string tName<char>{"char"};
template <> const std::string tName<signed char>{"signed char"};
template <> const std::string tName<unsigned char>{"unsigned char"};
template <> const std::string tName<short>{"short"};
template <> const std::string tName<unsigned short>{"unsigned short"};
@BillyDonahue
BillyDonahue / action_type.h
Created April 29, 2020 16:12
generated action_type.h
// AUTO-GENERATED FILE DO NOT EDIT
// See src/mongo/db/auth/generate_action_types.py
/**
* Copyright (C) 2018-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
@BillyDonahue
BillyDonahue / hash_table_bm.out
Created May 27, 2020 07:16
string_data_comparator hash container speed results.
Running build/install/bin/hash_table_bm
Run on (40 X 3100 MHz CPU s)
CPU Caches:
L1 Data 32K (x20)
L1 Instruction 32K (x20)
L2 Unified 256K (x20)
L3 Unified 25600K (x2)
Load Average: 1.39, 1.37, 1.61
------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
@BillyDonahue
BillyDonahue / vpn_evg.sh
Last active June 9, 2020 06:06
Create a route to an Evergreen workstation through the selected VPN interface
#!/bin/bash
set -e
host="${1:-$(<~/.local/etc/evghost)}"
vpn_name="${2:-"mongo vpn"}"
cat >&2 <<EOF
host: [$host]
vpn_name: [$vpn_name]
@BillyDonahue
BillyDonahue / hits.out
Last active June 26, 2020 18:08
8-digit LOGV2 identifiers git grep -En 'LOGV2.*\(\s*[0-9]{8}' >hits.txt
[
{
"file": "src/mongo/db/auth/sasl_mechanism_registry.cpp",
"line": 192,
"data": " LOGV2_ERROR(47429001,",
"blame": "b'817a7f19511 (Mark Benvenuto 2020-04-20 14:34:56 -0400 192) LOGV2_ERROR(47429001,\\n'"
},
{
"file": "src/mongo/db/catalog/index_catalog_entry_impl.cpp",
"line": 356,