Skip to content

Instantly share code, notes, and snippets.

@samouss
samouss / citus_cheatsheet.sql
Created August 27, 2020 17:38 — forked from sfriquet/citus_cheatsheet.sql
Citus Cheatsheet
-- Set number of shard
ALTER DATABASE citus SET citus.shard_count = 64;
-- Explain across all shards
SET citus.explain_all_tasks TO true;
-- Size of all distributed tables excluding indexes but including TOAST, free space map, and visibility map
SELECT logicalrelid::text tablename, pg_size_pretty(citus_table_size(logicalrelid::text)) size FROM pg_dist_partition group by tablename;
-- Size of all distributed tables including all indexes and TOAST data
@samouss
samouss / CustomWidget.jsx
Last active June 7, 2018 10:10
Custom widget with React
const CustomWidget = createWidget({
widget: {
render({ state, helper }) {
const refine = () => {
const next = state.query === "" ? "Apple" : "";
helper.setQuery(next).search();
};
return {
// With multiple package
import {
connectHits,
connectRefinementList
} from "react-instantsearch-connectors";
import {
InstantSearch,
Configure,
SearchBox
<template>
<select @change="handleChange($event)">
<option
v-for="facet in facetValues"
:key="facet.name"
:value="facet.path"
>
{{facet.name}} ({{facet.count}})
</option>
</select>
@samouss
samouss / stream.scala
Created August 24, 2017 21:22
Scala Stream
class e1_bonus_stream extends HandsOnSuite {
sealed trait Stream[+A] {
def map[B](fonction:A => B):Stream[B]
def flatMap[B](fonction:A => Stream[B]):Stream[B]
def filter(fonction:A => Boolean):Stream[A]