Skip to content

Instantly share code, notes, and snippets.

View mpenick's full-sized avatar
🍵

Michael Penick mpenick

🍵
View GitHub Profile
@mpenick
mpenick / package.js
Last active August 29, 2015 13:56
Helenus/Express Example
{
"name": "test",
"description": "An application to test helenus",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x",
"helenus": "0.6.x"
}
}
struct CassCluster;
CassCluster*
cass_cluster_new();
CassError
cass_cluster_setopt(CassCluster* cluster,
CassOption option,
const void* data, cass_size_t data_length);
#
# This is configuration file for CCMBridge library.
# Options have same name as in .NET CCMBridge settings file,
# except USE_NOBUFFERING which now is replaced by USE_BUFFERNING option.
#
IP_PREFIX=127.0.0.
CASSANDRA_VERSION=2.0.7
# Addresses MUST be in IP form
void kill_task(boost::shared_ptr<cql::cql_ccm_bridge_t> ccm) {
boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
ccm->decommission(2);
boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
ccm->decommission(3);
}
BOOST_AUTO_TEST_CASE(test_simple)
{
test_utils::CassClusterPtr cluster = test_utils::make_shared(cass_cluster_new());
@mpenick
mpenick / perf.c
Last active August 29, 2015 14:04
Prepared Inserts
/*
Copyright (c) 2014 DataStax
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
template<typename From, typename To>
To alias_cast(From from)
{
struct AliasType
{
union
{
From from;
To to;
};
template<typename From, typename To>
inline To copy_cast(const From& from)
{
To to;
memcpy(&to, &from, sizeof(from));
return to;
}
int main() {
float f = 0.1;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
template<typename From, typename To>
inline To copy_cast(const From& from)
{
To to;
memcpy(&to, &from, sizeof(from));
#!/bin/bash
RUN="/usr/bin/valgrind.bin --tool=memcheck test/integration_tests/cassandra_integration_tests"
#RUN="/usr/bin/valgrind --leak-check=full --tool=memcheck test/integration_tests/cassandra_integration_tests"
#RUN="test/integration_tests/cassandra_integration_tests"
function run_test() {
echo -e "$(tput setaf 3)#### Running filter: '$1' ####$(tput sgr 0)";
#export DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
#!/bin/bash
while true
do
r=$(( ( RANDOM % 100 ) + 1 ))
if [[ "$r" -gt "0" && "$r" -lt "11" ]]; then
echo "dropping 192.168.1.112"
iptables -A INPUT -d 192.168.1.112 -p tcp --destination-port 9042 -j DROP
elif [[ "$r" -gt "10" && "$r" -lt "21" ]]; then
echo "dropping 192.168.1.113"