Skip to content

Instantly share code, notes, and snippets.

TL;DR

Filesystem Time Size
SquashFS 5m53.945s 17G
EroFS 5m26.367s 41G
EroFS (lz4hc) - dnf

Test inputs

@polynomialspace
polynomialspace / logtrace.go
Created November 19, 2022 18:23
An example of mild log tracing capabilities with x/exp/slog; https://go.dev/play/p/U-R1tFhuI13
package main
import (
"fmt"
"os"
"runtime"
log "golang.org/x/exp/slog"
)
// You can edit this code!
// Click here and start typing.
package byteunits
const (
_ = iota
KB = 1 << (10 * iota)
MB
GB
@polynomialspace
polynomialspace / main.go
Created January 7, 2022 10:41
`ip a` but only the parts you care about
package main
import (
"fmt"
"net"
"os"
"text/tabwriter"
)
func main() {
package main
import (
"fmt"
"runtime"
)
func trace() func() {
pc, file, line, _ := runtime.Caller(1)
fmt.Printf("%s:%d enter %s\n", file, line, runtime.FuncForPC(pc).Name())
@polynomialspace
polynomialspace / main.go
Created December 14, 2021 18:33
go1.18 mailboxes demo
package main
import (
"context"
"fmt"
"time"
)
type Mailbox[T0, T1 any] struct {
ctx context.Context
@polynomialspace
polynomialspace / darwin-configuration.nix
Last active December 9, 2021 09:23
darwin-configuration.nix
{ config, pkgs, nixpkgs, ... }:
{
# These don't exist : (
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Clicking" = true;
# system.defaults.NSGlobalDomain."com.apple.AppleMultitouchTrackpad.Dragging" = true;
system.defaults.NSGlobalDomain = {
NSAutomaticCapitalizationEnabled = false;
NSAutomaticDashSubstitutionEnabled = false;
@polynomialspace
polynomialspace / v3hsaddr.go
Created July 15, 2021 05:04
quick and dirty go impl of tor hsv3 onion address generation
package main
import (
"crypto/ed25519"
"encoding/base32"
"encoding/hex"
"fmt"
"strings"
"golang.org/x/crypto/sha3"
# WARNING: this file is generated from the nix.* options in
# your NixOS configuration, typically
# /etc/nixos/configuration.nix. Do not edit it!
max-jobs = auto
cores = 0
sandbox = false
substituters = https://cache.nixos.org/
trusted-substituters =
// go get "inet.af/netaddr"
// echo '[ "208.80.44.0/22", "208.80.44.0/23", "208.80.44.0/24", "208.80.45.0/24", "208.80.46.0/23", "208.80.46.0/24", "208.80.47.0/24" ]' | go run main.go -json -
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io"