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
| import ipaddress | |
| import random | |
| def generate_random_ula_prefix(prefix_length: int, L: int = 1) -> ipaddress.IPv6Network: | |
| return ipaddress.IPv6Network((((0xfc|L)<<120)|(random.getrandbits(prefix_length-8)<<(128-prefix_length)), prefix_length)) | |
| for prefix_length in range(8, 129): | |
| print(generate_random_ula_prefix(prefix_length)) |
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 python3 | |
| from typing import Optional | |
| import argparse | |
| import ctypes | |
| import datetime | |
| import mmap | |
| import sys | |
| import time |
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
| import ctypes | |
| import mmap | |
| # https://stackoverflow.com/a/34096544 | |
| def fake_readwrite_buffer(obj: object) -> memoryview: | |
| address = ctypes.c_void_p() | |
| length = ctypes.c_ssize_t() | |
| ctypes.pythonapi.PyObject_AsReadBuffer(ctypes.py_object(obj), ctypes.byref(address), ctypes.byref(length)) | |
| return ctypes.memoryview_at(address.value, length, readonly=False) |
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 "iter" | |
| func Cycle[T any](items []T) func(func(T) bool) { | |
| return func(yield func(T) bool) { | |
| for { | |
| for _, item := range items { | |
| if !yield(item) { | |
| return |
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 python3 | |
| from typing import Optional, TypeAlias | |
| import dbparse | |
| import enum | |
| class Flags(enum.IntFlag): | |
| NO_OFDM = 1<<0 | |
| NO_CCK = 1<<1 | |
| NO_INDOOR = 1<<2 | |
| NO_OUTDOOR = 1<<3 |
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
| #!/bin/bash | |
| # Note on hybrid CPUs (P-cores/E-cores): | |
| # Linux /proc/cpuinfo reports only features common to ALL cores. | |
| # This script will correctly detect the lowest ISA level supported | |
| # across all core types, which matches glibc's behavior. | |
| get_x86_64_abi_version() { | |
| local FLAGS | |
| local DETECTED_LEVEL |
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
| import "github.com/mattn/go-isatty" | |
| func init() { | |
| if isatty.IsTerminal(os.Stdout.Fd()) { | |
| slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, nil))) | |
| } | |
| } |
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
| #!/bin/bash | |
| shopt -s nullglob | |
| cd /sys/class/nvme | |
| for CTRL in *; do | |
| echo "removing ${CTRL}" | |
| echo 1 >"${CTRL}/device/remove" | |
| done |
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
| @media -moz-pref("sidebar.verticalTabs") { | |
| :root { | |
| --tab-block-margin: 0 !important; | |
| --tab-min-height: 24px !important; | |
| } | |
| } | |
| #tabbrowser-tabs[orient="vertical"] { | |
| .tabbrowser-tab { | |
| padding-block: 0 !important; |
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
| #!/bin/bash | |
| echo -n 'Size: ' | |
| if [[ $OSTYPE == darwin* ]]; then | |
| stat -f %z "$1" | |
| else | |
| stat -c %s "$1" | |
| fi | |
| (tee < "$1" > /dev/null \ |
NewerOlder