Skip to content

Instantly share code, notes, and snippets.

View robbertvanginkel's full-sized avatar

Robbert van Ginkel robbertvanginkel

View GitHub Profile
@robbertvanginkel
robbertvanginkel / index.js
Last active November 21, 2024 00:40
gRPC on workers
// Turn on gRPC for domain using
// https://developers.cloudflare.com/support/network/understanding-cloudflare-grpc-support/#enable-grpc, then CF
// rewrites grpc requests to grpc-web (like a reverse envoy filter, see https://blog.cloudflare.com/road-to-grpc/#converting-to-http-1-1)
// which can be handled by workers. Does not work with workers.dev.
export default {
async fetch(request, env, context) {
// Use a stream so CF doesn't add content-lenght
// which would prevent grpc-web -> grpc conversion.
const { readable, writable } = new TransformStream();
let writer = writable.getWriter();
@robbertvanginkel
robbertvanginkel / quickjs-wasi.patch
Created January 4, 2023 16:41
quickjs wasi wazero
From 58e4fc1373b6ee5d3810b7e4668762de87731b2f Mon Sep 17 00:00:00 2001
From: Robbert van Ginkel <[email protected]>
Date: Wed, 4 Jan 2023 11:05:15 -0500
Subject: [PATCH] Add wazero based build script
To build the quickjs interpreter, some js files need to be transformed into
quickjs bytecode using qjsc.
---
build.sh | 36 ++++++++++++++++++++++++++++++++++++
qjs.c | 4 ++--
@robbertvanginkel
robbertvanginkel / bwotb.md
Created March 22, 2021 21:01
Understanding bazel bwotb

I've put in a bit of time understanding Bazel's caching better to see how this feature fits in. I've experimented with the following setup:

$ cat .bazelversion
1.1.0
$ cat .bazelrc
common --announce_rc
build --incompatible_strict_action_env
build --announce_rc
build --remote_download_minimal
package main
// typedef int (*intFunc) ();
//
// int
// bridge_int_func(intFunc f)
// {
// return f();
// }
//
@robbertvanginkel
robbertvanginkel / BUILD.bazel
Last active June 19, 2019 20:37
rules_go caching and stamping
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
go_binary(
name = "go",
srcs = ["main.go"],
x_defs = {"main.buildtime" : "{BUILD_TIMESTAMP}"}
)
cc_library(
name = "stamp",
linkstamp = "stamp.cc",
@robbertvanginkel
robbertvanginkel / BUILD.bazel
Last active May 24, 2019 23:10
rules_go stamping issue
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/example/project",
visibility = ["//visibility:private"],
x_defs = {
"github.com/example/project.simple": "{BUILD_USER}",
"github.com/example/project.compound": "{BUILD_USER}@{BUILD_HOST}",