Skip to content

Instantly share code, notes, and snippets.

View alexott's full-sized avatar
🏠
Working from home

Alex Ott alexott

🏠
Working from home
View GitHub Profile
@alexott
alexott / keybase.md
Last active August 29, 2015 14:16
keybase.md

Keybase proof

I hereby claim:

  • I am alexott on github.
  • I am alexott (https://keybase.io/alexott) on keybase.
  • I have a public key whose fingerprint is F44D C864 AB51 8652 21E1 51C5 5828 4E39 1698 B501

To claim this, I am signing this object:

@alexott
alexott / TestGenson.java
Created April 28, 2015 11:48
Minimal test case reproducing Genson error
package test;
import com.owlike.genson.Genson;
import com.owlike.genson.GensonBuilder;
import java.util.HashMap;
import java.util.Map;
public class TestGenson {
@alexott
alexott / build-confluent-packages.sh
Last active September 1, 2017 14:28
Rebuild C/C++ packages provided by Confluent
#!/bin/bash
# By default, Confluent provides Debian versions of their packages via APT - as result, they are linked
# to other versions of the libraries than in Ubuntu, ...
# This small script rebuilds them on Ubuntu, or Debian versions different from provided by default.
MY_BUILD_DIR="build-$$"
mkdir $MY_BUILD_DIR
cd $MY_BUILD_DIR
apt-get source librdkafka libavro-cpp-dev libavro-c-dev confluent-libserdes-dev
@alexott
alexott / cld-stat.txt
Last active July 15, 2019 09:45
Data related to language detection evaluation
# language true-positive total accuracy
af 32 34 0.94
ar 200 201 0.99
az 161 161 1.00
be 157 157 1.00
bg 195 203 0.96
bn 198 198 1.00
ca 193 193 1.00
cs 195 196 0.99
da 198 200 0.99
@alexott
alexott / App.java
Created January 10, 2018 09:29
java.util.LocalDate mapping in Cassandra
package jdtest1;
import java.util.UUID;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.MappingManager;
public class App {
@alexott
alexott / ResultSetSerializer.java
Created February 3, 2018 15:29
JSON serialization of Java's ResultSet returned by DataStax Java Driver
package com.datastax.alexott.demos.jdtest1;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
cqlsh:test> DESCRIBE table log;
CREATE TABLE test.log (
module text,
yyyymmdd text,
created timeuuid,
logmessage text,
PRIMARY KEY ((module, yyyymmdd), created)
) WITH CLUSTERING ORDER BY (created ASC)
AND bloom_filter_fp_chance = 0.01
@alexott
alexott / App.java
Last active March 10, 2018 18:31
UDT + Object mapper in DataStax Java Driver
package com.datastax.demos.alexott.product;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.CodecRegistry;
import com.datastax.driver.core.Session;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.MappingManager;
public class App {
@alexott
alexott / find-corrupted-jar.sh
Last active March 13, 2018 05:32
Snippet to find corrupted JAR in Maven repository
for i in `find ~/.m2/repository/ -name \*.jar`; do unzip -l $i 2> /dev/null > /dev/null ; RES=$?; if [ $RES -ne 0 ]; then echo "$i: $RES" ; fi ; done
@alexott
alexott / index.md
Last active June 14, 2018 12:44
Draft of documentation about Java driver's Built statements

Built statements

Built statements are generated via [QueryBuilder]'s Fluent API. Use of Fluent API allows easier build of the complex queries, comparing with hardcoding the CQL statements into the source code.

Note: The provider builders perform very little validation of the built query. There is thus no guarantee that a built query is valid, and it is definitively possible to create invalid queries.