Skip to content

Instantly share code, notes, and snippets.

Brian Hess brianmhess

Block or report user

Report or block brianmhess

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brianmhess
brianmhess / DeleteInsert.java
Created Jan 14, 2019
Delete-Insert Trigger
View DeleteInsert.java
/*
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;
@brianmhess
brianmhess / lww_timetravel.cql
Last active Oct 16, 2018
LWW and Time Travel
View lww_timetravel.cql
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;
View __Data Samples
Here are some data samples for demonstrating loading.
CQL for tables:
cqlsh -e "CREATE KEYSPACE dsbulkblog WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};"
cqlsh -e "CREATE TABLE dsbulkblog.iris_with_id (id int PRIMARY KEY, petal_length double, petal_width double, sepal_length double, sepal_width double, species text)"
cqlsh -e "CREATE TABLE dsbulkblog.categories_set(category TEXT PRIMARY KEY, examples SET<TEXT>);"
cqlsh -e "CREATE TABLE dsbulkblog.categories_list(category TEXT PRIMARY KEY, examples LIST<TEXT>);"
cqlsh -e "CREATE TABLE dsbulkblog.president_birthdates(president TEXT PRIMARY KEY, birthdate_string TEXT, birthdate DATE);"
Examples:
View ghettoLog.java
private void ghettoLog(String fname, String msg) {
try {
Files.write(Paths.get("/tmp/logit"), Arrays.asList(s), StandardOpenOption.APPEND);
}
catch (Exception e) { }
}
View setup-disks.sh
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
View dosurvey.sh
#!/bin/bash
for i in {1..30000}; do ./survey.sh; sleep 0.2; done;
View iris.csv
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
@brianmhess
brianmhess / do.sh
Last active Jan 13, 2017
DSEFS FieldInputTransformer
View do.sh
#!/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"
View readings.py
#!/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
View DSEFS Exercise
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
You can’t perform that action at this time.