Skip to content

Instantly share code, notes, and snippets.

View namsral's full-sized avatar

Lars Wiegman namsral

View GitHub Profile
// Source from the xnu kernel used in macOS
// source https://opensource.apple.com/source/xnu/xnu-3248.60.10/libsyscall/wrappers/mach_absolute_time.s
.globl _mach_absolute_time
_mach_absolute_time:
pushq %rbp // set up a frame for backtraces
movq %rsp,%rbp
movq $(_COMM_PAGE_TIME_DATA_START),%rsi
1:
movl _NT_GENERATION(%rsi),%r8d // get generation
testl %r8d,%r8d // if 0, data is being changed...
@namsral
namsral / ziphttpd.go
Last active October 16, 2017 10:32
Deploy and serve assets from a zip archive
package main
import (
"archive/zip"
"flag"
"log"
"net/http"
"golang.org/x/tools/godoc/vfs/httpfs"
"golang.org/x/tools/godoc/vfs/zipfs"