Skip to content

Instantly share code, notes, and snippets.

function reducer(state = {books: []}, action) {
switch (action.type) {
case "SET_RECOMMENDED":
return {books: action.payload};
default:
state;
}
}
function mapStateToPros(state) {
@inv2004
inv2004 / main.rs
Created March 14, 2018 04:23
test soa lifetimes
#[macro_use] extern crate soa_derive;
// lib
trait MyTrait:Sized {
type V;
type S;
fn new() -> Pl<Self::V>;
fn new_slice(s: Self::S) -> Pl<Self::S>;
#![feature(specialization)]
use std::marker::PhantomData;
pub trait PHash<T> {
fn new() -> T;
}
// pub trait PHashFun<K,V> {
// fn
#![feature(duration_as_u128)]
#[macro_use]
extern crate bson;
extern crate mongodb;
use std::time::Instant;
use mongodb::db::ThreadedDatabase;
use mongodb::ThreadedClient;
//use mongodb::common::WriteConcern;
package main
import (
"time"
"github.com/globalsign/mgo"
"time"
"github.com/globalsign/mgo"
)
create table t1 (k String, v UInt64) ENGINE MergeTree() partition by tuple() ORDER BY k
insert into t1 select 'a' as k, number as v from system.numbers limit 5
insert into t1 select 'b' as k, number as v from system.numbers limit 10
select k, arrayCumSum(groupArray(v)) as g from t1 group by k
select * from (select k, v, arrayCumSum(groupArray(v) as v) as g from t1 group by k) array join v, g
@inv2004
inv2004 / docker-compose.yml
Created August 10, 2019 01:58
docker-compose.yml
# clone graphite-clickhouse-tldr
version: '2.0'
services:
zoo1:
image: zookeeper
restart: always
hostname: zoo1
ports:
<test>
<!-- clickhouse performance-test --lite --input-file simple_insert.xml -->
<name>simple_insert</name>
<type>loop</type>
<stop_conditions>
<all_of>
<total_time_ms>30000</total_time_ms>
</all_of>
@inv2004
inv2004 / test.xml
Last active September 9, 2019 04:13
<test>
<!-- clickhouse performance-test --lite --input-file test.xml -->
<name>test</name>
<type>loop</type>
<stop_conditions>
<all_of>
<total_time_ms>30000</total_time_ms>
</all_of>
<test>
<name>test</name>
<type>loop</type>
<stop_conditions>
<all_of>
<total_time_ms>30000</total_time_ms>
</all_of>
<any_of>