Skip to content

Instantly share code, notes, and snippets.

View prenaissance's full-sized avatar
😎
B)

Alex prenaissance

😎
B)
View GitHub Profile
@prenaissance
prenaissance / Dockerfile
Created December 14, 2025 21:07
Rust performant cross-architecture Dockerfile
# Replace all <____> placeholders with values matching your project
FROM --platform=$BUILDPLATFORM rust:<version>-alpine AS builder
# This will be set automatically by docker buildx
ARG TARGETPLATFORM
WORKDIR /app
# Add any system dependencies here
RUN apk update && apk add --no-cache protobuf-dev postgresql-dev
# Map $TARGETPLATFORM to $RUST_TARGET used by cargo. Add any other desired architectures
RUN case "${TARGETPLATFORM}" in \
@prenaissance
prenaissance / spanner_emulator_pg_on_m4.md
Created February 17, 2025 16:00
Spanner Emulator PG Adapter on M4 Macs

JVM containers are crashing on M4 Macbooks. This causes the PG Adapter for Cloud Spanner to crash and makes running the proxy impossible on ARM64. This gist explores how to overcome this by emulating x86 using Rosetta.

Pre-requisites:

  1. Enable Rosetta 2
softwareupdate --install-rosetta

The output logs should end with the line

@prenaissance
prenaissance / main.ts
Created November 13, 2024 12:03
BlueSky check handle availability
import { promisify } from "node:util";
const BATCH_SIZE = 1;
const TIMEOUT = 2000;
const verifyHandle = async (handle: string) => {
const url = `https://bsky.social/xrpc/com.atproto.server.createAccount`;
const response = await fetch(url, {
method: "POST",