Skip to content

Instantly share code, notes, and snippets.

View juliangruber's full-sized avatar

Julian Gruber juliangruber

View GitHub Profile
const dgram = require('node:dgram')
const util = require('node:util')
const glossy = require('glossy')
const syslogProducer = new glossy.Produce()
const socket = dgram.createSocket('udp4')
const streams = {
stdout: process.stdout.write.bind(process.stdout),
stderr: process.stderr.write.bind(process.stderr)
@juliangruber
juliangruber / fw.sh
Created March 2, 2023 15:58
l1-firewall
#!/usr/bin/env bash
ipv4ranges=(
10.0.0.0/8
100.64.0.0/10
169.254.0.0/16
172.16.0.0/12
192.0.0.0/24
192.0.2.0/24
192.168.0.0/16

Current Saturn topology, with multi-peer retrieval (TBD) between L1<>L2:

flowchart TB
HttpClient <--> DNS[L1 DNS]
DNS <--> L1'
subgraph L1s[L1s deployed to data centers]
  L1
  L1'
 L1''
$ npm run build
> libp2p@0.38.0 build
> aegir build
[08:47:41] tsc [started]
src/circuit/auto-relay.ts:54:80 - error TS2345: Argument of type '(evt: CustomEvent<Connection>) => void' is not assignable to parameter of type 'EventHandler<CustomEvent<Connection>> | null'.
Type '(evt: CustomEvent<Connection>) => void' is not assignable to type 'EventCallback<CustomEvent<Connection>>'.
Types of parameters 'evt' and 'evt' are incompatible.
Type 'CustomEvent<import("/Users/julian/dev/libp2p/js-libp2p/node_modules/@libp2p/interface-connection-manager/node_modules/@libp2p/interface-connection/dist/src/index").Connection>' is not assignable to type 'CustomEvent<import("/Users/julian/dev/libp2p/js-libp2p/node_modules/@libp2p/interface-connection/dist/src/index").Connection>'.

L1<>L2 architecture

Conventions

  • Naming
    • L1: L1 machine
    • l1: Individual l1 worker process
  • The overview graph lists all involved components. In future graphs irrelevant components are omitted for readability, which doesn't mean they have been removed

Problems to solve

@juliangruber
juliangruber / 1.md
Last active November 21, 2021 21:13
@juliangruber
juliangruber / gist:7356251
Last active May 5, 2021 17:53
localhost subdomains on osx

First, install dnsmasq using brew:

$ brew update
$ brew install dnsmasq

Then create your configuration

@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
@juliangruber
juliangruber / gist:3160726
Created July 22, 2012 19:06
Pubsub in Dart
class Pubsub {
Map channels;
Pubsub() {
channels = new Map();
}
subscribe(String channel, Function cb) {
if (channels[channel] == null) {
channels[channel] = new List<Function>();
@juliangruber
juliangruber / extend.plist
Last active August 23, 2020 18:48
Here is how to accept files dropped on an @electronjs app's icon in osx. For this to work you need to properly package the app into a `.app`, and to place the CFBundleDocumentTypes spec into it's Info.plist. Here we're using electron-packager.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>All Files</string>
<key>LSHandlerRank</key>