This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream.eval(Task(new InetSocketAddress(InetAddress.getByName(null), 8123))).flatMap { ia => | |
Stream.resource(tcp.client[Task](ia)).flatMap { sock => | |
Stream | |
.chunk(Chunk.bytes("hello\n".getBytes)) | |
.to(sock.writes()) | |
.drain | |
.onFinalize(sock.endOfOutput) ++ | |
sock | |
.reads(128, Some(15.seconds)) | |
.chunks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2017 Bryan Keller (https://github.com/widget-) | |
Licensed 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 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018.09.22 03:46:25.789787 [ 43 ] {5402eaba-269f-467a-b8ba-2a31fe7f2adb} <Debug> executeQuery: (from 172.17.0.1:46684) select d from (select d from dstr all inner join (select d from sharded) using d) | |
2018.09.22 03:46:25.790062 [ 43 ] {5402eaba-269f-467a-b8ba-2a31fe7f2adb} <Debug> MemoryTracker: Peak memory usage (total): 47.00 B. | |
2018.09.22 03:46:25.851345 [ 43 ] {5402eaba-269f-467a-b8ba-2a31fe7f2adb} <Error> executeQuery: Code: 60, e.displayText() = DB::Exception: Table default.sharded doesn't exist., e.what() = DB::Exception (from 172.17.0.1:46684) (in query: select d from (select d from dstr all inner join (select d from sharded) using d)), Stack trace: | |
0. /usr/bin/clickhouse-server(StackTrace::StackTrace()+0x16) [0x9467606] | |
1. /usr/bin/clickhouse-server(DB::Exception::Exception(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)+0x22) [0x2fff8e2] | |
2. /usr/bin/clickhouse-server(DB::Context::getTableImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<lotusflare> | |
<logger> | |
<level>debug</level> | |
<log>/var/log/clickhouse-server/clickhouse-server.log</log> | |
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog> | |
<size>1000M</size> | |
<count>10</count> | |
</logger> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
curl clickhouse0:8123 -d "CREATE TABLE shard_1.foo_replicated(day Date, id String, x UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/1/foo_replicated', 'node1', day, (id), 8192)" | |
curl clickhouse0:8123 -d "CREATE TABLE shard_2.foo_replicated(day Date, id String, x UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/2/foo_replicated', 'node1', day, (id), 8192)" | |
curl clickhouse1:8123 -d "CREATE TABLE shard_0.foo_replicated(day Date, id String, x UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/foo_replicated', 'node2', day, (id), 8192)" | |
curl clickhouse1:8123 -d "CREATE TABLE shard_2.foo_replicated(day Date, id String, x UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/2/foo_replicated', 'node2', day, (id), 8192)" | |
curl clickhouse2:8123 -d "CREATE TABLE shard_0.foo_replicated(day Date, id String, x UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/foo_replicated', 'node0', day, (id), 8192)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// before: | |
// A is some domain object, | |
// Typeclasses/behavior: | |
// Codec is for JSON <->, | |
// DbWriter is to write to DB | |
// maybe some other | |
case class Foo(x: Int, s: String) | |
object Foo { | |
implicit val codec: Codec[A] = ??? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object TravFil { | |
def main(args: Array[String]): Unit = { | |
// source data | |
val xs: List[Int] = List(2, 4, 6, 8, 10) | |
// ============================== | |
// Problem: given a list of ints, | |
// if there is an odd number (or more) - | |
// return Left(s"$FIRST_ODD_NUMBER is odd") | |
// if all the numbers are even: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// given: Seq[(Int, Int)] = value -> weight | |
// and W = max weight | |
// find max value | |
object Main { | |
type Weight = Int | |
type Value = Int | |
type Item = (Value, Weight) | |
def solveRec(items: Seq[Item], maxWt: Weight): Weight = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
object Typeclasses { | |
// 3 proto messages | |
case class A(x: Int) | |
case class B(s: String) | |
case class C(x: Int, s: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enablePlugins(JmhPlugin) |