Skip to content

Instantly share code, notes, and snippets.

View mpenick's full-sized avatar
🍵

Michael Penick mpenick

🍵
View GitHub Profile
#pragma clang diagnostic ignored "-Wold-style-cast"
@mpenick
mpenick / metadata_hash_table.cpp
Created January 9, 2019 15:47
Vector vs HashMap for result metadata
#include <benchmark/benchmark.h>
#include <iostream>
#include <random>
#include "small_dense_hash_map.hpp"
#include "dense_hash_map.hpp"
#include "hash_table.hpp"
#include "string_ref.hpp"
#include <iostream>
#include <string>
#include <tuple>
#include <limits>
class StringRef {
public:
StringRef(const char* str) { }
};
class HostEventFuture : public cass::Future {
public:
typedef SharedRefPtr<HostEventFuture> Ptr;
enum Type {
INVALID,
START_NODE,
STOP_NODE,
ADD_NODE,
REMOVE_NODE
@mpenick
mpenick / throughput.c
Last active October 25, 2017 20:12
A rough template for achieving high read throughput using the DataStax C/C++ driver
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@mpenick
mpenick / down.sh
Created September 1, 2017 17:56
Attempt to reproduce "All hosts in current policy attempted and were either unavailable or failed" error
#!/bin/bash
while true; do
NODE="node$(( ( RANDOM % 3 ) + 1 ))"
echo "Marking $NODE down..."
ccm $NODE stop
ccm $NODE start
sleep 1
done
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
#include <iostream>
#include <functional>
using namespace std;
template<class T>
class Handler {
public:
typedef std::function<void(T&)> Callback;
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the