Skip to content

Instantly share code, notes, and snippets.

2 nodes up, t2 created with 0 replicas:
cr> select sys.nodes.name, * from sys.shards where table_name = 't2';
+----------------+-------------+------------+----+-----------------+----------+---------+-----------------+------+---------+
| sys.nodes.name | schema_name | table_name | id | partition_ident | num_docs | primary | relocating_node | size | state |
+----------------+-------------+------------+----+-----------------+----------+---------+-----------------+------+---------+
| Interloper | doc | t2 | 0 | _arthur | 0 | TRUE | NULL | 99 | STARTED |
| Interloper | doc | t2 | 8 | _arthur | 0 | TRUE | NULL | 99 | STARTED |
| Interloper | doc | t2 | 2 | _arthur | 1 | TRUE | NULL | 2027 | STARTED |
| Interloper | doc | t2 | 4 | _arthur | 0 | TRUE | NULL | 99 | STARTED |
@mfelsche
mfelsche / .profile
Created May 5, 2014 14:03
java7 and java8 side by side on OSX
# JAVA7
export JAVA_HOME="`/usr/libexec/java_home -v '1.7.*'`"
# JAVA 8
# create aliases suffixed with 8 for every java8 executable
export JAVA8_HOME=`/usr/libexec/java_home -v'1.8.*'`
for JAVA8_BIN in `ls ${JAVA8_HOME}/bin/*`
do
alias `basename ${JAVA8_BIN}`8=${JAVA8_BIN}
done
@mfelsche
mfelsche / jdbc_clients.rst
Last active August 29, 2015 14:08
graphical JDBC Clients

SQuirreL SQL

SQL Workbench

-- users
DROP TABLE users;
CREATE TABLE users (
username STRING PRIMARY KEY,
name STRING,
address STRING INDEX USING FULLTEXT,
date_of_birth TIMESTAMP,
date_joined TIMESTAMP,
month_partition STRING PRIMARY KEY
) CLUSTERED INTO 4 shards
@mfelsche
mfelsche / demo.sql
Last active August 29, 2015 14:13
CRATE.io demo queries
-- count all steps records
SELECT count(*) FROM steps;
-- count all steps
SELECT sum(num_steps) FROM steps;
-- count all steps for a specific user
SELECT sum(num_steps) AS steps_for_user FROM steps WHERE username = 'gosinski';
-- count all steps for a specific user on a specific month
@mfelsche
mfelsche / mix.exs
Created January 28, 2015 23:45
example mix file for failing craterl compilation
defmodule Cratex.Mixfile do
use Mix.Project
def project do
[app: :cratex,
version: "0.0.1",
elixir: "~> 1.0",
deps: deps]
end
$ mix deps.compile
==> idna (compile)
Compiled src/idna.erl
Compiled src/idna_ucs.erl
Compiled src/idna_unicode.erl
Compiled src/punycode.erl
Compiled src/idna_unicode_data.erl
==> ssl_verify_hostname (compile)
Compiled src/ssl_verify_hostname.erl
==> jsx (compile)
@mfelsche
mfelsche / amplab_tables.sql
Created January 29, 2015 11:13
amplab tables
create table rankings (
"pageURL" string primary key,
"pageRank" int,
"avgDuration" int
) clustered into 48 shards with (number_of_replicas=0, refresh_interval=0);
create table uservisits (
"sourceIP" string,
"destinationURL" string,
"visitDate" timestamp,
@mfelsche
mfelsche / bar_graph_deviation_potsdam.r
Last active August 29, 2015 14:24
simple bar graph
library(ggplot2)
# deviation_potsdam.csv has been created using crash:
# bin/crash --format=csv -c "SELECT format('%tY', date) AS year, AVG(temp) - 8.659611756762368 as deviation FROM german_climate_denormalized WHERE temp IS NOT NULL AND station_name = 'Potsdam' and date < '2015-01-01' GROUP BY 1 ORDER BY 1 ASC" > deviation_potsdam.csv
frame <- read.table('deviation_potsam.csv', header=TRUE, sep=",")
negative <- frame$deviation < 0
# create the png
png("deviation_potsdam.png", width=900, height=480)
print(
ggplot(
@mfelsche
mfelsche / ga.patch
Last active September 1, 2015 19:18
diff --git a/plugins/crate-admin/_site/index.html b/plugins/crate-admin/_site/index.html.new
index 3b55c74..35f7cff 100644
--- a/app/index.html
+++ b/app/index.html
@@ -96,5 +96,28 @@
</div>
</div>
+ <!-- Begin Analytics-->
+ <!-- Google Analytics Start -->