Skip to content

Instantly share code, notes, and snippets.

View seut's full-sized avatar

Sebastian Utz seut

View GitHub Profile
@seut
seut / cratedb_mariadb_fdw_example.md
Last active March 20, 2024 15:13
CrateDB MariaDB FDW example

Setup MariaDB

Run MariaDB inside docker

% docker run --name mariadb-10.3 -e MYSQL_ROOT_PASSWORD=mypass -p 3306:3306 -d mariadb:10.3

Create database and table

@seut
seut / crate_multi_node_docker_demo.sh
Last active March 13, 2023 16:40
Crate Muli-Node Docker Demo
#!/bin/bash
NUM_NODES=3
NUM_SHARDS=20
#DIR=`dirname "$0"`
DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
NODE_NAMES=()
@seut
seut / PostgresITest.java
Created December 17, 2020 12:30
PgJDBC numeric binary test
@TestLogging("io.crate.action.sql:TRACE")
@Test
public void test_numeric_type() throws Exception {
properties.setProperty(PGProperty.BINARY_TRANSFER_ENABLE.getName(), "1700");
try (Connection conn = DriverManager.getConnection(url(RW), properties)) {
conn.createStatement().executeUpdate(
"CREATE TABLE t (" +
" l bigint" +
") " +
"WITH (number_of_replicas = 0)");
@seut
seut / InitCapBenchmark.java
Created November 21, 2018 10:05
InitCapBenchmark
/*
* Licensed to Crate under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership. Crate licenses this file
* to you 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
*
@seut
seut / crate_health_check.py
Last active July 2, 2018 16:15
crate health check script
#!/usr/bin/env python
import sys
from crate.client.connection import Connection
from crate.client.cursor import Cursor
from crate.client.exceptions import ProgrammingError
STMT_HEALTH = "select table_name, schema_name, partition_ident, routing_state," \
"\"primary\", relocating_node, count(*) from sys.shards" \
" group by 1, 2, 3, 4, 5, 6"
@seut
seut / keybase.md
Created August 3, 2016 08:32
keybase.md

Keybase proof

I hereby claim:

  • I am seut on github.
  • I am smu (https://keybase.io/smu) on keybase.
  • I have a public key whose fingerprint is DCE8 2C83 F105 37F3 24E2 4468 5AC6 F853 FE44 8BB4

To claim this, I am signing this object:

@seut
seut / disk_benchmark.sh
Last active August 29, 2015 14:21
disk benchmark script
#!/bin/bash
# taken from: http://www.amsys.co.uk/2013/blog/using-command-line-to-benchmark-disks/
# should be run as root/sudo, otherwise purge will fail
echo "---------------------"
echo "Write Test Running. Please Wait..."
write=$(dd if=/dev/zero bs=2048k of=tstfile count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
purge
echo ""
echo "Read Test Running. Please Wait..."
read=$(dd if=tstfile bs=2048k of=/dev/null count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
@seut
seut / main.go
Last active August 29, 2015 14:03
example main go script using crate go driver
/*
Prerequisites:
install go: http://golang.org/dl/
#: export GOPATH=<PATH-WHERE-TO-SAVE-GO-CODE>
#: go get github.com/fxposter/crate/sql
start a crate node
run this script:
#: go run main.go
*/
@seut
seut / gist:6992020
Created October 15, 2013 14:00
JavaCC IDEA file type, save as ~/Library/Preferences/IdeaIC12/filetypes/JavaCC\ files.xml & restart idea
<?xml version="1.0" encoding="UTF-8"?>
<filetype binary="false" default_extension="" description="JavaCC files" name="JavaCC files">
<highlighting>
<options>
<option name="LINE_COMMENT" value="//" />
<option name="COMMENT_START" value="/*" />
<option name="COMMENT_END" value="*/" />
<option name="HEX_PREFIX" value="0x" />
<option name="NUM_POSTFIXES" value="l L f F" />
<option name="HAS_BRACES" value="true" />