Skip to content

Instantly share code, notes, and snippets.

lutter /
Last active Apr 16, 2020
Subgraph composition

GraphQL schema

type _Schema_
    types: ["Address", { name: "Account", as: "EthAccount" }],
    from: { id: "Qmsubgraph" })

A string entry in types is shorthand for { name: STRING, as: STRING }

lutter /
Last active Apr 16, 2020
JSON digests

Digesting JSON data

This is a description of how we can compute a Digest of the subset of JSON data that we care about.

The JSON subset puts the following restrictions on JSON values:

  • the names of object properties must be printable ASCII characters (i.e., UTF-8 code points 0x20 ' ' through 0x7e '~')
  • JSON numbers must be representable as 32 bit signed integers
lutter / views.sql
Last active Mar 14, 2019
Useful `graph-node` views
View views.sql
-- subgraphs schema
drop schema if exists meta cascade;
create schema meta;
create view meta.subgraphs as
select id,
data->'name'->>'data' as name,
(data->'createdAt'->>'data')::int as created_at,
lutter / Cargo.toml
Last active Feb 27, 2019
serde_json regression from 1.0.25 to 1.0.38
View Cargo.toml
name = "json"
version = "0.1.0"
authors = ["David Lutterkort <>"]
edition = "2018"
serde_json = { version = "=1.0.38", features = ["arbitrary_precision"] }
#serde_json = { version = "=1.0.25", features = ["arbitrary_precision"] }
serde_derive = "1.0.88"
lutter /
Created Jan 24, 2019
Installation instructions for Graph CLI
#! /bin/bash
# Run these as root or sprinkle sudo in here as appropriate
dnf install -y gcc-c++ make libsecret-devel git
curl --silent --location | bash -
curl --silent --location | tee /etc/yum.repos.d/yarn.repo
dnf install -y yarn
yarn global add @graphprotocol/graph-cli
View .gitignore
lutter / Dockerfile
Created Oct 17, 2018
HAProxy container for loadbalancing between Puppet masters/compilers
View Dockerfile
FROM haproxy:latest
# HAProxy management port
# Puppetserver
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
#! /bin/bash
# Use as ' /some/file'
# The file we want to manipulate
# The line we are looking for (including quotes !)
line="'Include $1'"
View gist:916731a5503fd5967da7124eb344267b
for typ in $(puppet resource -t); do echo $typ; puppet resource $typ > /dev/null; done
Error: Could not run: Provider augeas has not defined the 'instances' class method
Error: Could not run: Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc
lutter / test.yaml
Last active Mar 31, 2017
Provider testing
View test.yaml
# Test the behavior of a specific provider.
# The tests will generally be destructive; there's no good way to mock what
# external providers do (we could try and intercept execve and/or open, but
# that would still leave lots of ways in which providers can alter a
# system)
desc: check sysv provider
# The name of the provider to test