This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::cell::UnsafeCell; | |
| use std::mem::MaybeUninit; | |
| use std::sync::atomic::AtomicUsize; | |
| #[repr(align(64))] | |
| struct Cell<T> { | |
| // Monotonically increasing sequence to synchronize producers and consumer | |
| sequence: AtomicUsize, | |
| // The actual storage slot for the message, using UnsafeCell to allow interior mutability | |
| value: UnsafeCell<MaybeUninit<T>>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fastify = require('fastify')({ logger: false }); | |
| const crypto = require('crypto'); | |
| const fs = require('fs').promises; | |
| const path = require('path'); | |
| // Simulate a database verification using scrypt | |
| const verifyPassword = (password, salt) => { | |
| return new Promise((resolve, reject) => { | |
| // This executes on the libuv thread pool | |
| crypto.scrypt(password, salt, 64, (err, derivedKey) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace telemetry; | |
| table SensorReading { | |
| sensor_id: uint64; | |
| timestamp: int64; | |
| temperature: double; | |
| humidity: double; | |
| firmware_version: string; | |
| raw_payload: [ubyte]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # build_eif.sh | |
| set -euo pipefail | |
| echo "[*] Building statically linked Go application..." | |
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ | |
| -ldflags="-w -s -extldflags '-static'" \ | |
| -o bootstrap_app ./cmd/bootstrap | |
| echo "[*] Generating container definition..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| "strings" | |
| ) | |
| // Compiler handles the conversion of Go structs into GBNF (GGML Backus-Naur Form) grammars. | |
| type Compiler struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.performance.cache; | |
| import java.lang.foreign.Arena; | |
| import java.lang.foreign.MemorySegment; | |
| import java.lang.foreign.ValueLayout; | |
| /** | |
| * Demonstrates the cache-friendly layout pattern. | |
| * Compares standard pointer-chasing node traversal against a contiguous, | |
| * cache-prefetcher-friendly off-heap array layout. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package spiffeclient | |
| import ( | |
| "context" | |
| "crypto/x509" | |
| "fmt" | |
| "time" | |
| "github.com/spiffe/go-spiffe/v2/spiffeid" | |
| "github.com/spiffe/go-spiffe/v2/workloadapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package hpack | |
| // AppendVarint encodes an integer 'i' with an 'n'-bit prefix and appends it to 'dst'. | |
| // This implementation requires zero heap allocations and operates directly on the destination slice. | |
| func AppendVarint(dst []byte, i uint64, n uint8) []byte { | |
| if n < 1 || n > 8 { | |
| panic("invalid prefix size") | |
| } | |
| maxPrefixVal := uint64((1 << n) - 1) | |
| if i < maxPrefixVal { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.mycompany.observability; | |
| import jdk.jfr.Configuration; | |
| import jdk.jfr.Recording; | |
| import java.io.IOException; | |
| import java.nio.file.Paths; | |
| import java.text.ParseException; | |
| import java.time.Duration; | |
| public class JfrSafepointProfiler { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // +build ignore | |
| #include <vmlinux.h> | |
| #include <bpf/bpf_helpers.h> | |
| #include <bpf/bpf_tracing.h> | |
| char LICENSE[] SEC("license") = "Dual BSD/GPL"; | |
| // Map to temporarily store callerpc between newproc1 and runqput on the same thread | |
| struct { |