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 / dnsresolver.go
Last active January 26, 2024 13:56
Top-Down iterative DNS resolver to understand DNS
package main
import (
"fmt"
"github.com/miekg/dns"
"log"
"net/http"
)
const rootdnsv4 = "198.41.0.4"
@s-macke
s-macke / darmstadt_links.md
Last active June 4, 2023 13:31
Darmstadt Vorlesung - Vom Code zum Copiloten: Ein Blick auf das Neueste in der KI-Softwareentwicklung
@s-macke
s-macke / gpt-4-tokens.txt
Last active February 23, 2024 17:58
All 100k GPT-4 Tokens. New lines are replaced with \n and carriage returns with \r. The index of the token is (index=line-1). The list is extracted using https://github.com/openai/tiktoken
!
"
#
$
%
&
'
(
)
*
@s-macke
s-macke / Sparks_of_Copilot.html
Last active May 29, 2023 14:50
Playground to test performance of GPT-4 for code handling such as reviews and refactorings. You need an API key for testing.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sparks of Copilot X</title>
<meta charset="utf-8">
<meta name="author" content="Sebastian Macke">
<meta name="description" content="GPT-4 Coding Experiments">
<link href=" https://cdn.jsdelivr.net/npm/ace-builds@1.16.0/css/ace.min.css " rel="stylesheet">
<style>
@s-macke
s-macke / sleepserver.go
Last active September 16, 2022 11:22
Sleep Server in Go. It just sleeps for a given time for any request. Useful for easy mock of backends.
package main
import (
"flag"
"fmt"
"net/http"
"time"
)
var defaultSleepTimeMs *int
@s-macke
s-macke / cloud.wgsl
Created July 19, 2022 19:44
Protean Clouds Shader
/*
Ported shader Protean Clouds
https://www.shadertoy.com/view/3l23Rh
to WGSL
*/
// Protean clouds by nimitz (twitter: @stormoid)
// https://www.shadertoy.com/view/3l23Rh
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// Contact the author for other licensing options
@s-macke
s-macke / contextperf.c
Last active May 9, 2022 19:40
The code measures the direct and indirect cost (L2 cache misses) of context switches
// compile with
// 'gcc -O2 main.c -o contextperf.c' -lpthread
#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <pthread.h>
#include <sched.h>
#include <unistd.h>
@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 August 28, 2023 06:30
Hello world example by using an headerless implementation of the WASI interface. The only dependency is clang
/*
* This code is a headerless implementation of the WASI interface in C and prints "Hello World!.
* You only need clang and the llvm linker.
*
* compile with
* clang -Os -nostdlib --target=wasm32 -Wl,--allow-undefined hello.c -o hello.wasm
*
* run with
* https://runno.dev/wasi
* Just upload hello.wasm