Skip to content

Instantly share code, notes, and snippets.

View s-macke's full-sized avatar

Sebastian Macke s-macke

View GitHub Profile
@s-macke
s-macke / http3.go
Last active April 6, 2022 21:12
QUIC HTTP/3 Parsing of the Initial Packet
/*
The HTTP/3 protocol is on the rise and brings huge improvements in terms of speed and security.
One of them is, that the so called "Server Name Identification" or SNI is mandatory and is sent
in the first packet by the client.
https://en.wikipedia.org/wiki/Server_Name_Indication
Parsing and retrieving the SNI should be easy, right?
Well, here is a complete code example to retrieve the SNI and other information from the
initial QUIC packet. The first packet is encrypted and protected. But the encryption keys
@s-macke
s-macke / main.go
Last active January 8, 2020 14:42
ASCIICinema: Show movie files on the console via "curl --compressed localhost:12345"
package main
import "C"
import (
"fmt"
"github.com/giorgisio/goav/avcodec"
"github.com/giorgisio/goav/avutil"
"github.com/giorgisio/goav/swscale"
"strconv"
"strings"
@s-macke
s-macke / hello.c
Last active September 21, 2024 12:08
Hello world example by using an headerless implementation of the WASI interface version 0.1 . The only dependency is clang.
/*
* This code is a headerless implementation of the WASI interface version 0.1 in C and prints "Hello World!.
* You only need clang.
*
* compile with
* clang -Os -nostdlib --target=wasm32 hello.c -o hello.wasm
*
* run with
* https://runno.dev/wasi
* Just upload hello.wasm
@s-macke
s-macke / fbdemo.asm.js
Last active March 7, 2018 20:31
OpenRISC ELF Executable fbdemo recompiled to asm.js
function (global, env, heap) {
"use asm";
var Exception = env.Exception;
var r = new global.Int32Array(heap);
var h = new global.Int32Array(heap);
var b = new global.Uint8Array(heap);
var w = new global.Uint16Array(heap);
/*
@s-macke
s-macke / riscv.dts
Last active November 2, 2024 15:21
Sample dts file for the RISCV-architecture for bbl with PLIC, CLINT, UART and VIRTIO. Boots from 9p Filesystem via virtio
/dts-v1/;
/ {
#address-cells = <2>;
#size-cells = <2>;
compatible = "ucbbar,spike-bare-dev";
model = "ucbbar,spike-bare";
chosen {
bootargs = "root=host rootfstype=9p rootflags=trans=virtio";