Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
# Use as 'lines.sh /some/file'
# The file we want to manipulate
src=/tmp/lines.txt
# The line we are looking for (including quotes !)
line="'Include $1'"
@lutter
lutter / Dockerfile
Created October 17, 2018 20:58
HAProxy container for loadbalancing between Puppet masters/compilers
FROM haproxy:latest
# HAProxy management port
EXPOSE 8765
# Puppetserver
EXPOSE 8140
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
COPY docker-entrypoint.sh /
@lutter
lutter / .gitignore
Last active January 22, 2019 19:09
issue-680
node_modules/
yarn.lock
@lutter
lutter / fedora.sh
Created January 24, 2019 19:19
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 https://rpm.nodesource.com/setup_11.x | bash -
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
dnf install -y yarn
yarn global add @graphprotocol/graph-cli
@lutter
lutter / Cargo.toml
Last active February 27, 2019 23:49
serde_json regression from 1.0.25 to 1.0.38
[package]
name = "json"
version = "0.1.0"
authors = ["David Lutterkort <lutter@watzmann.net>"]
edition = "2018"
[dependencies]
serde_json = { version = "=1.0.38", features = ["arbitrary_precision"] }
#serde_json = { version = "=1.0.25", features = ["arbitrary_precision"] }
serde_derive = "1.0.88"
@lutter
lutter / views.sql
Last active March 14, 2019 21:14
Useful `graph-node` views
--
-- 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
lutter / 00-digest.md
Last active April 16, 2020 18:12
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
lutter / composition.org
Last active April 16, 2020 18:11
Subgraph composition

GraphQL schema

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

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