Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Splits a given table into n evenly-spaced shards.
# call with ./split-table <tablename> <numshards>
table=$1
shards=$2
cluster="localhost:29015"
splits=`seq 0 $((16**4/$shards)) $((16**4+1)) \
@danielmewes
danielmewes / life-faster.js
Last active August 23, 2016 16:39
Conway's Game of Life in ReQL
// This version precomputes neighbors in order to be more efficient
var initial = [
"........................O...........",
"......................O.O...........",
"............OO......OO............OO",
"...........O...O....OO............OO",
"OO........O.....O...OO..............",
"OO........O...O.OO....O.O...........",
"..........O.....O.......O...........",
@danielmewes
danielmewes / turing example.js
Created August 23, 2016 16:44
Turing machine in ReQL example
var machine = {
blank_symbol: 0,
transitions: [
{
from_state: "A",
read_symbol: 0,
to_state: "A",
write_symbol: 0,
move_head: "R"
},
@danielmewes
danielmewes / rewrite.md
Created August 23, 2016 16:48
Aggregation changefeed `fold` rewrite

Given a changefeed of the form:

stream.reduce(f).changes({includeInitial: <II>, includeStates: <IS>})

Assume that for the given f, we know the following properties:

  • <f_BASE> the initial accumulator for f
  • <f_APPLY> a function from the accumulator and an element in the input table to a new accumulator
  • <f_UNAPPLY> the inverse of <f_APPLY> in the accumulator