Skip to content

Instantly share code, notes, and snippets.

View mpenick's full-sized avatar
🍵

Michael Penick mpenick

🍵
View GitHub Profile
-- To run:
-- # cd <some-path>/lua-cassandra
-- # LUA_PATH="lib/?/init.lua;lib/?.lua" resty --errlog-level info --shdict 'cassandra 1m' cloud.lua
local Cluster = require 'resty.cassandra.cluster'
local Auth = require 'cassandra.auth'
local Socket = require 'cassandra.socket'
-- Use luasocket
Socket.force_luasocket("timer", true)
CREATE KEYSPACE IF NOT EXISTS test WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'};
CREATE TYPE IF NOT EXISTS test.mytype(a int, b text);
CREATE TABLE IF NOT EXISTS test.table_nulls (key text, s set<int>, m map<text, int>, l list<text>, t tuple<int, text>, u mytype, PRIMARY KEY(key));
// set
INSERT INTO test.table_nulls (key, s) VALUES ('set_null', {null}) ;
// list
INSERT INTO test.table_nulls (key, l) VALUES ('list_null', {null}) ;
build
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h> /* FIXME: Remove header */
#include <string.h> /* FIXME: Remove header */
#define CASS_INET_V6_LENGTH 16
#define CASS_VALUE_TYPE_MAPPING(XX) \
XX(CASS_VALUE_TYPE_CUSTOM, 0x0000, "", "") \
/*
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 / ca.conf
Last active August 28, 2019 20:13
A basic script for setting up SSL on Casasndra or DSE
# gen_rootCa_cert.conf
[ req ]
distinguished_name = req_distinguished_name
prompt = no
output_password = password
default_bits = 2048
[ req_distinguished_name ]
C = US
O = Datastax
#include <exception>
#include <functional>
#include <future>
namespace datastax {
class StringRef {
public:
StringRef(const char* str) {}
};
/*
Copyright (c) DataStax, Inc.
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
#include <iostream>
#include <memory>
#include <tuple>
class Allocated {};
class Callback : public Allocated {
public:
virtual ~Callback() {}
virtual void run() = 0;
#pragma clang diagnostic ignored "-Wold-style-cast"