Skip to content

Instantly share code, notes, and snippets.

View nflaig's full-sized avatar

Nico Flaig nflaig

View GitHub Profile
import bls from "@chainsafe/bls";
import { deriveKeyFromMnemonic, deriveEth2ValidatorKeys } from "@chainsafe/bls-keygen";
import { fromHexString, toHexString } from "@chainsafe/ssz";
import { computeDomain, computeSigningRoot, ZERO_HASH } from "@lodestar/state-transition";
import { DOMAIN_DEPOSIT } from "@lodestar/params";
import { mainnetChainConfig } from "@lodestar/config/networks";
import { ssz } from "@lodestar/types/phase0";
const masterSK = deriveKeyFromMnemonic("your mnemonic phrase goes here");
@nflaig
nflaig / docker-compose-net-docker.patch
Last active March 26, 2023 11:48
docker-compose.yml for comprehensive guide v3
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 40c5d9c8ad..c5366bd908 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -2,38 +2,49 @@ version: "3.4"
services:
geth_docker:
image: ethereum/client-go:stable
- restart: always
+ restart: unless-stopped
const { Octokit } = require("@octokit/rest");
const { parse } = require('issue-parser');
// Replace with your GitHub access token
const accessToken = 'YOUR_ACCESS_TOKEN';
// Replace with your GitHub repository owner and name
const owner = 'REPOSITORY_OWNER';
const repo = 'REPOSITORY_NAME';
@nflaig
nflaig / measure-approximate-db-size-git-diff.md
Last active February 21, 2023 23:19
Add console.time to measure approximate db size (git diff)
diff --git a/packages/db/src/controller/level.ts b/packages/db/src/controller/level.ts
index fe326ceb7d..98e0fba985 100644
--- a/packages/db/src/controller/level.ts
+++ b/packages/db/src/controller/level.ts
@@ -157,7 +157,10 @@ export class LevelDbController implements DatabaseController<Uint8Array, Uint8Ar
    * The result might not include recently written data.
    */
   approximateSize(start: Uint8Array, end: Uint8Array): Promise<number> {
-    return (this.db as LevelNodeJS).approximateSize(start, end);
@nflaig
nflaig / security.spec-enhancer.ts
Created January 24, 2021 10:39
Interface to allow strategies to specify security spec and enhance openapi spec based on authentication metadata
import {
Application,
bind,
ControllerClass,
CoreBindings,
extensions,
Getter,
inject
} from "@loopback/core";
import {
import { bind } from "@loopback/core";
import {
asSpecEnhancer,
mergeOpenAPISpec,
OASEnhancer,
OpenApiSpec,
OpenAPIObject
} from "@loopback/rest";
const authServerUrl = process.env.AUTH_SERVER_URL;
#! /bin/bash
# Script has to be run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
domain_name=
app_name=

Keybase proof

I hereby claim:

  • I am nflaig on github.
  • I am nflaig (https://keybase.io/nflaig) on keybase.
  • I have a public key ASAbNbPklgaJtSNkeZVPf-vDjo4TvRKrJqpzcBAML7p31wo

To claim this, I am signing this object: