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
@OptIn( | |
ExperimentalStdlibApi::class, | |
ExperimentalCoroutinesApi::class, | |
ExperimentalTime::class, | |
ExperimentalUnsignedTypes::class, | |
ExperimentalTypeInference::class | |
) | |
fun <T> Flow<T>.chunked(n: UInt, t: Duration): Flow<List<T>> { | |
val maxChunkSize = n.toInt() |
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
package com.lotusflare.chmiddleman | |
import cats.effect.ExitCase.Canceled | |
import cats.effect.{ ExitCode, IO, IOApp, Resource } | |
import cats.implicits._ | |
import monix.eval.Task | |
import monix.execution.Scheduler.Implicits.global | |
import scala.concurrent.duration._ | |
object Resources extends IOApp { |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#define PATH_LEN 256 | |
int main(void) | |
{ | |
char path[PATH_LEN]; | |
FILE *pipe; |
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
// http://blog.sigfpe.com/2006/11/from-l-theorem-to-spreadsheet.html | |
import cats._ | |
import cats.implicits._ | |
object Foo { | |
def main(args: Array[String]): Unit = { | |
// loeb :: Functor f => f (f x -> x) -> f x | |
// loeb x = fmap (\a -> a (loeb x)) x |
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
cqlsh:ks> delete from collection_table where k = 1; | |
Tracing session: 58c21de0-edaa-11e8-99e2-399d8477c401 | |
activity | timestamp | source | source_elapsed | client | |
-------------------------------------------------------------------------+----------------------------+------------+----------------+------------ | |
Execute CQL3 query | 2018-11-21 18:27:32.414000 | 172.17.0.6 | 0 | 172.17.0.1 | |
Parsing delete from collection_table where k = 1; [SharedPool-Worker-1] | 2018-11-21 18:27:32.415000 | 172.17.0.6 | 1093 | 172.17.0.1 | |
Preparing statement [SharedPool-Worker-1] | 2018-11-21 18:27:32.416000 | 172.17.0.6 | 1383 | 172.17.0.1 | |
Determining replicas for mutation [SharedPool-Worker-1] | 2018-11-21 18:27:32.416000 | 172.17.0.6 | 1950 | 172.17.0.1 |
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
cqlsh:ks> CREATE TABLE collection_table( k int primary key, l list<text>, s set<text>, m map<text, int>); | |
cqlsh:ks> insert into collection_table (k, l, s, m) values (1, ['a','b','c'], {'a','b','c'}, {'a':1,'b':2,'c':3}); | |
cqlsh:ks> select * from collection_table; | |
@ Row 1 | |
---+-------------------------- | |
k | 1 | |
l | ['a', 'b', 'c'] | |
m | {'a': 1, 'b': 2, 'c': 3} | |
s | {'a', 'b', 'c'} |
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
<yandex> | |
<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> | |
<console>1</console> | |
</logger> | |
<http_port>8123</http_port> |
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
def join(queries: NonEmptyList[TopLevelQuery]): TopLevelQuery = { | |
val size: Int = queries.size | |
if (size == 1) { | |
queries.head | |
} else { | |
queries | |
.reduceRight { case (q, acc) => | |
acc.map { acc => | |
val fiels: List[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
import AstElem._ | |
class AsString extends QueryAstVisitor[String] { | |
override def visitFromTable(from: From.Table): String = { | |
s"FROM ${from.name}" | |
} | |
override def visitFromNested(from: From.NestedQueryTree): String = { | |
s"FROM (${visitTopLevelQuery(from.tree)})" |
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 scala.annotation.StaticAnnotation | |
import com.datastax.driver.core.BoundStatement | |
import shapeless._ | |
import shapeless.labelled._ | |
import shapeless.ops.hlist.Zip | |
case class ColName(v: String) extends StaticAnnotation | |
sealed trait CRow[A] { |
NewerOlder