Skip to content

Instantly share code, notes, and snippets.

@pfussell
pfussell / reader.go
Created February 9, 2021 22:07 — forked from jedy/reader.go
processes communicate with shared memory in golang
package main
// #include <stdlib.h>
// #include "wrapper.c"
import "C"
import "unsafe"
import "fmt"
func read(filename string) string {
f := C.CString(filename)
@pfussell
pfussell / scratch_server.go
Created February 9, 2021 19:34 — forked from jschaf/scratch_server.go
A Go web server from scratch using syscalls
package main
// Simple, single-threaded server using system calls instead of the net library.
//
// Omitted features from the go net package:
//
// - TLS
// - Most error checking
// - Only supports bodies that close, no persistent or chunked connections
// - Redirects
#!/bin/bash
clear
if [[ $EUID -ne 0 ]]; then
echo "You must be root" 2>&1
exit 1
fi
ARCH=$(uname -m)