Skip to content

Instantly share code, notes, and snippets.

@brianmhess
brianmhess / .odbc.ini
Last active June 27, 2016 21:13
ODBC Tables/Query Test
## If you did not install in the default directory, replace '/opt/datastax/cassandraodbc'
## with the correct location.
[ODBC]
Trace=no
[ODBC Data Sources]
spark64=Simba Spark ODBC Driver 64-bit
[spark64]
A. DSEFS
--------
0.1. Enable
vi /etc/default/dse
Edit to enable Spark
vi /etc/dse/dse.yaml
Edit to enable dsefs
dsefs_option:
enabled: true
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# ultrasonic_1.py
# Measure distance using an ultrasonic module
#
# Author : Matt Hawkins
# Date : 09/01/2013
@brianmhess
brianmhess / do.sh
Last active January 13, 2017 21:24
DSEFS FieldInputTransformer
#!/bin/bash
cqlsh -e "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}"
cqlsh -e "CREATE TABLE test.dtest(pkey INT, info TEXT, link TEXT, dsefs_contents TEXT, PRIMARY KEY ((pkey)))"
echo This is a test > /tmp/test1.txt
echo This is another test > /tmp/test2.txt
echo Hello World > /tmp/test3.txt
echo Thank You > /tmp/test4.txt
dse fs "mkdir /fittest"
dse fs "put /tmp/test1.txt /fittest/test1.txt"
dse fs "put /tmp/test2.txt /fittest/test2.txt"
5.1 3.5 1.4 0.2 Iris-setosa
4.9 3.0 1.4 0.2 Iris-setosa
4.7 3.2 1.3 0.2 Iris-setosa
4.6 3.1 1.5 0.2 Iris-setosa
5.0 3.6 1.4 0.2 Iris-setosa
5.4 3.9 1.7 0.4 Iris-setosa
4.6 3.4 1.4 0.3 Iris-setosa
5.0 3.4 1.5 0.2 Iris-setosa
4.4 2.9 1.4 0.2 Iris-setosa
4.9 3.1 1.5 0.1 Iris-setosa
#!/bin/bash
for i in {1..30000}; do ./survey.sh; sleep 0.2; done;
setup-disks.sh
==============
#!/bin/bash
set -vx
# Execute this file dirctly (don't source it) if you want to use the `$(dirname $0)` construct
function maybe_skip_drive {
local drive=$1
if ! [ -b $drive ]; then
@brianmhess
brianmhess / ghettoLog.java
Last active June 5, 2018 21:30
ghettoLog
private void ghettoLog(String fname, String msg) {
try {
Files.write(Paths.get("/tmp/logit"), Arrays.asList(s), StandardOpenOption.APPEND);
}
catch (Exception e) { }
}
@brianmhess
brianmhess / lww_timetravel.cql
Last active October 16, 2018 18:42
LWW and Time Travel
CREATE KEYSPACE lab WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
use lab;
CREATE OR REPLACE FUNCTION lww_accumulate(state MAP<INT,INT>, mutid INT, val INT)
CALLED ON NULL INPUT
RETURNS MAP<INT,INT>
LANGUAGE java
AS '
state.put(mutid, val);
return state;
@brianmhess
brianmhess / DeleteInsert.java
Created January 14, 2019 22:10
Delete-Insert Trigger
/*
javac -cp "/home/digger/dse/resources/cassandra/lib/*" -d target/ src/hessian/invest/DeleteInsert.java
jar cf DeleteInsert.jar -C target/ hessian
cp DeleteInsert.jar ~/dse/resources/cassandra/conf/triggers/
nodetool reloadtriggers
CREATE TRIGGER deleteInsert ON ks.tbl USING 'hessian.invest.DeleteInsert';
*/
package hessian.invest;