Skip to content

Instantly share code, notes, and snippets.

View mpenick's full-sized avatar
🍵

Michael Penick mpenick

🍵
View GitHub Profile
<?php
function startsWith($haystack, $needle) {
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
class DocComment {
const UNINITIALIZE = 1;
const INSIDE = 2;
<?php
#$cluster = Dse::cluster()->build();
define("NUM_ITERATIONS", 1000);
define("MICROSECONDS", 1000 * 1000);
define("PERCENTILES", array(0.0, 0.5, 0.75, 0.95, 0.98, 0.99, 0.999, 0.9999, 1.0));
function print_histogram($histogram) {
ksort($histogram);
#include "statement.hpp"
#include "request_handler.hpp"
// ...
BOOST_AUTO_TEST_CASE(spec_ex)
{
test_utils::CassClusterPtr cluster(cass_cluster_new());
if (ccm->create_cluster(3)) {
@mpenick
mpenick / perf.c
Last active October 12, 2016 20:24
/*
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
#!/bin/bash
trap "kill -9 $$" SIGINT SIGTERM
while true; do
echo -n "Checking node$1..."
START=$(date +%s)
echo "quit" | ccm node$1 cqlsh > /dev/null 2>&1
RESULT=$?
END=$(date +%s)
diff --git a/src/connection.cpp b/src/connection.cpp
index 0123437..0d902dd 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -795,6 +795,7 @@ void Connection::on_supported(ResponseMessage* response) {
// TODO(mstump) do something with the supported info
(void)supported;
+ listener_->on_connect(this); // Allow the listener to inject a query before startup
internal_write(new StartupHandler(this, new StartupRequest()));
@mpenick
mpenick / connect.c
Last active August 23, 2016 20:52
Examples
#include <cassandra.h>
int main() {
/* Setup and connect to cluster */
CassFuture* connect_future = NULL;
CassCluster* cluster = cass_cluster_new();
CassSession* session = cass_session_new();
/* Add contact points */
cass_cluster_set_contact_points(cluster, "127.0.0.1,...");
require 'net/http'
require 'uri'
require 'openssl'
#OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv3
#OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2
def path_for_url(url)
path =
if url.path.nil? || url.path.empty?
#include <future>
#include <thread>
#include <mutex>
#include <iostream>
#include <list>
#include <exception>
#include <sstream>
#include <cassandra.h>
/*
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