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
| #include <atomic> | |
| #include <vector> | |
| #include <thread> | |
| #include <mutex> | |
| #include <algorithm> | |
| #include <limits> | |
| struct Node { | |
| Node* next{nullptr}; | |
| virtual ~Node() = default; |
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 | |
| set -euo pipefail | |
| # Enable IP forwarding and disable reverse path filtering hazards | |
| echo "Optimizing network sysctl for WireGuard gateway..." | |
| sudo sysctl -w net.ipv4.ip_forward=1 | |
| sudo sysctl -w net.ipv4.conf.all.forwarding=1 | |
| sudo sysctl -w net.ipv4.conf.all.rp_filter=2 | |
| sudo sysctl -w net.ipv4.conf.default.rp_filter=2 |
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
| #include <vmlinux.h> | |
| #include <bpf/bpf_helpers.h> | |
| #include <bpf/bpf_tracing.h> | |
| #include <bpf/bpf_endian.h> | |
| char LICENSE[] SEC("license") = "GPL"; | |
| struct event { | |
| __u32 pid; | |
| __u64 duration_ns; |
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
| from fastapi import Request, HTTPException | |
| from typing import Dict, Any | |
| import jwt | |
| # Secret key used for decoding JWT headers passed by the API Gateway | |
| JWT_SECRET = "production_super_secret_key_rotation_99" | |
| class TenantContextMiddleware: | |
| async def __call__(self, request: Request, call_next): | |
| # Extract JWT from Authorization header |
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
| #include <atomic> | |
| #include <cstdint> | |
| struct alignas(64) LogSlot { | |
| std::atomic<uint32_t> status; // 0 = Empty, 1 = Writing, 2 = Ready | |
| uint32_t length; | |
| char payload[248]; // 256 bytes total slot size (perfectly fits 4 cache lines) | |
| }; | |
| struct alignas(64) LogControlBlock { |
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
| # Envoy HTTP filter configuration for OPA external authorization | |
| http_filters: | |
| - name: envoy.filters.http.ext_authz | |
| typed_config: | |
| "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz | |
| grpc_service: | |
| envoy_grpc: | |
| cluster_name: ext-authz-opa | |
| timeout: 0.15s | |
| transport_api_version: V3 |
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::convert::TryInto; | |
| use std::slice; | |
| #[repr(C, align(8))] | |
| #[derive(Debug, Copy, Clone)] | |
| pub struct FrameHeader { | |
| pub magic: [u8; 4], // Must be b"TNSR" | |
| pub msg_type: u8, // 1: Token IDs (prefill), 2: Activations, 3: Logits, 4: Error | |
| pub shape_rank: u8, | |
| pub padding: [u8; 2], // Structural padding to align to 8-byte boundary |
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
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: high-throughput-service | |
| namespace: production | |
| spec: | |
| replicas: 10 | |
| template: | |
| metadata: | |
| labels: |
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 | |
| # Production initialization script for configuring RoCEv2 lossless network interfaces (Mellanox ConnectX) | |
| set -euo pipefail | |
| INTERFACE="eth0" | |
| # RoCEv2 uses DSCP value 26 (CS3) or 46 (EF) commonly. We will map traffic class to DSCP 26. | |
| PRIORITY=3 | |
| DSCP=26 | |
| echo "=== Configuring sysctl parameters for high-performance RDMA ===" |
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
| apiVersion: security-profiles-operator.x-k8s.io/v1alpha1 | |
| kind: ProfileRecording | |
| metadata: | |
| name: payment-service-recorder | |
| namespace: core-payments | |
| spec: | |
| kind: SeccompProfile | |
| recorder: bpf | |
| podSelector: | |
| matchLabels: |
NewerOlder