Skip to content

Instantly share code, notes, and snippets.

Emscripten as a linker for Zig and C

This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten. In both cases Emscripten is only used as a linker, that is the frontend is either zig or clang.

"Nontrivial" here means the program uses interesting Emscripten features:

  • Asyncify
  • Full GLES3 support
  • GLFW3 support
@wilsonpage
wilsonpage / swr.ts
Last active April 22, 2024 08:58
An implementation of stale-while-revalidate for Cloudflare Workers
export const CACHE_STALE_AT_HEADER = 'x-edge-cache-stale-at';
export const CACHE_STATUS_HEADER = 'x-edge-cache-status';
export const CACHE_CONTROL_HEADER = 'Cache-Control';
export const CLIENT_CACHE_CONTROL_HEADER = 'x-client-cache-control';
export const ORIGIN_CACHE_CONTROL_HEADER = 'x-edge-origin-cache-control';
enum CacheStatus {
HIT = 'HIT',
MISS = 'MISS',
REVALIDATING = 'REVALIDATING',
@syntaqx
syntaqx / cloud-init.yaml
Last active March 26, 2024 21:02
cloud init / cloud config to install Docker on Ubuntu
#cloud-config
# Option 1 - Full installation using cURL
package_update: true
package_upgrade: true
groups:
- docker
system_info:
@remorses
remorses / deploy_image.sh
Last active February 12, 2019 14:34
Docker deploy with version tag
set -ex
##################################################
REGISTRY="myregistry.com:5000" # for docker hub just put your username
IMAGE=`basename $PWD` # image name
##################################################
@AmirSoleimani
AmirSoleimani / main.go
Last active January 10, 2023 08:18
Pub/Sub Pattern Golang
package main
import (
"patternsample/mq"
"fmt"
"time"
)
func main() {
#!/usr/bin/env python
# Author: Guillermo Cespedes <dev.dertin@gmail.com>
# pip install requests http barnum
import requests
import http.cookies
import json
from barnum import gen_data
@bradtraversy
bradtraversy / ssh.md
Last active May 3, 2024 09:18
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@retspen
retspen / pf_nat
Created March 2, 2018 18:27
Enable NAT on macOS
#!/bin/bash
cat > /usr/local/etc/pf-nat.conf << EOF
nat on en0 from vnic1:network to any -> (en0)
EOF
sudo pfctl -d
sudo sysctl -w net.inet.ip.forwarding=1
sudo pfctl -f /usr/local/etc/pf-nat.conf -e
@jordanmkoncz
jordanmkoncz / .react-navigation iOS 11 Navigation Bar with Large Title
Last active May 9, 2022 16:21
react-navigation iOS 11 Navigation Bar with Large Title
#