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
| // ./clatter/examples/hybrid_wire_format.rs | |
| //! Wire format analysis for hybrid (X25519 + ML-KEM) Noise handshake patterns. | |
| //! | |
| //! This example captures the raw bytes of each handshake message to show | |
| //! the on-wire field layout for `hybridNNpsk0`, demonstrating that the | |
| //! responder's ML-KEM public key is omitted when the KEM ephemeral exchange | |
| //! is already complete. | |
| //! | |
| //! Run with: | |
| //! cargo run --example hybrid_wire_format |
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/sh | |
| # | |
| # netifd proto for a CLAT-style Jool SIIT instance in its own network namespace. | |
| JOOL_CLAT_STATE_DIR="/var/run/jool-clat-proto" | |
| # Fixed defaults keep the proto stateless; users can still override both sides. | |
| JOOL_DEFAULT_HOST_V4="192.0.2.0/31" | |
| JOOL_DEFAULT_NS_V4="192.0.2.1/31" | |
| [ -n "$INCLUDE_ONLY" ] || { |
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 | |
| import sys | |
| from PIL import Image, ImageDraw, ImageFont | |
| from PIL.ExifTags import TAGS, GPSTAGS | |
| from datetime import date, datetime, timezone | |
| def calculate_crop_dimensions(image, ratio=3/2): | |
| width, height = image.size | |
| l = width > height # is landscape | |
| if not l: |
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 WOW_TOKEN = "W0w!" | |
| async function handleRequest(request) { | |
| const upgradeHeader = request.headers.get('Upgrade'); | |
| const token = request.headers.get('X-WOW-TOKEN'); | |
| const addr = request.headers.get('X-WOW-ADDR'); | |
| if (token !== WOW_TOKEN) { | |
| return new Response('Forbidden', { status: 403 }); | |
| } | |
| if (!upgradeHeader || upgradeHeader !== 'websocket') { |
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/sh | |
| parted /dev/vda -- mklabel gpt | |
| parted /dev/vda -- mkpart esp 1MiB 100MiB | |
| parted /dev/vda -- mkpart primary 100MiB 100% | |
| parted /dev/vda -- set 1 boot on | |
| mkfs.ext4 -L nixos /dev/vda2 # btrfs not working? | |
| mkfs.vfat -F32 -n boot /dev/vda1 | |
| mkdir -p /mnt | |
| mount /dev/vda2 /mnt | |
| mkdir -p /mnt/boot |
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 python | |
| # -*- coding: utf-8 -*- | |
| # Backup 2017-01-07. | |
| from uuid import uuid4 | |
| from telegram import InlineQueryResultArticle, ParseMode, \ | |
| InputTextMessageContent | |
| from telegram.ext import Updater, InlineQueryHandler, CommandHandler |
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/sh | |
| set -eux | |
| cd /tmp | |
| filename=$(opkg update && opkg info telegraf | grep "Filename:" | cut -d' ' -f2) | |
| repo=$(cat /etc/opkg/distfeeds.conf | grep "openwrt_packages" | cut -d' ' -f3) | |
| url="$repo/$filename" | |
| wget -q $url |
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/sh | |
| set -u | |
| WGIF="winnie" | |
| STEP=3600 | |
| PSTART=5500 | |
| PEND=5999 | |
| CONFFILE="/etc/wireguard/$WGIF.conf" | |
| PLEN=$((PEND-PSTART+1)) |
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 | |
| # filter disinct connections by 4-tuples from tcpdump output | |
| pairs = set() | |
| while (line := input()): | |
| time, family, orig, _, dest, remaining = line.split(maxsplit=5) | |
| dest = dest[:-1] | |
| if (orig, dest) not in pairs: | |
| print(f"{orig} > {dest}, {time}, {remaining}") | |
| pairs.add((orig, dest)) |
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
| # -*- coding: utf8 -*- | |
| # To be deployed to Tecent SCF | |
| # https://console.cloud.tencent.com/scf/ | |
| import json | |
| def main_handler(event, context): | |
| srcip = event['requestContext']['sourceIp'] | |
| dest_url = "https://water-meter.bamboo.workers.dev/callback?ip=" + srcip | |
| resp = { | |
| "isBase64Encoded": False, |
NewerOlder