% bun run index.ts
Inserting items: 6e340b9cffb37a98, 4bf5122f344554c5, dbc1b4c900ffe48d, 084fed08b978af4d, e52d9c508c502347, e77b9a9ae9e30b0d, 67586e98fad27da0, ca358758f6d27e6c
Are all items in the map? true
Ascending order: 084fed08b978af4d, 4bf5122f344554c5, 67586e98fad27da0, 6e340b9cffb37a98, ca358758f6d27e6c, dbc1b4c900ffe48d, e52d9c508c502347, e77b9a9ae9e30b0d
Descending order: e77b9a9ae9e30b0d, e52d9c508c502347, dbc1b4c900ffe48d, ca358758f6d27e6c, 6e340b9cffb37a98, 67586e98fad27da0, 4bf5122f344554c5, 084fed08b978af4d
Deleting item: ca358758f6d27e6c
Was the item found and deleted? true
Ascending order: 084fed08b978af4d, 4bf5122f344554c5, 67586e98fad27da0, 6e340b9cffb37a98, dbc1b4c900ffe48d, e52d9c508c502347, e77b9a9ae9e30b0d
This file contains 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
# syntax = docker/dockerfile:1 | |
# Adjust BUN_VERSION as desired | |
ARG BUN_VERSION=1.1.1 | |
FROM oven/bun:${BUN_VERSION}-slim as base | |
LABEL fly_launch_runtime="Next.js" | |
# Next.js app lives here | |
WORKDIR /app |
- A listening socket blocked on accept() can be unblocked by calling shutdown(socket_fd, SHUT_RD) on Linux. On Mac, calling shutdown(socket_fd, SHUT_RD) on a listening socket that is blocked on accept() will return an error ENOTCONN. To unblock a listening socket blocked on accept() on Mac requires calling close(socket_fd), which will cause the blocking accept() call to return an error EBADF.
Therefore, in order to unblock a socket on accept() on both Mac/Linux, shutdown() should not be relied on. Rather, an async cancellation scheme (such as cancellation tokens in .NET) should be used instead to unblock the call to accept().
- When a socket is instantiated and subsequently registered to epoll, or when a socket is shut down (via. shutdown() or setsockopt(SO_LINGER)) on Linux, epoll will be notified with EPOLLHUP on the socket. On Mac, kqueue will only notify when a socket is shut down (via. shutdown() or setsockopt(SO_LINGER)) by sending a EV_EOF notification on filters EVFILT_READ, and EVFILT_WRITE.
Thi
This file contains 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
pub const B = struct { | |
const Self = @This(); | |
data: []const u8, | |
pub fn getParent(self: *Self) *A { | |
return @fieldParentPtr(A, "child", self); | |
} | |
}; |
This file contains 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 std = @import("std"); | |
const os = std.os; | |
const net = std.net; | |
const mem = std.mem; | |
const log = std.log.scoped(.server); | |
const assert = std.debug.assert; | |
pub const io_mode = .evented; |
This file contains 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 { z } from "zod"; | |
import { fromZodError } from "zod-validation-error"; | |
export function procedure<TSchema extends z.ZodTypeAny = z.ZodNever>(inputSchema?: TSchema) { | |
type InputArgs = TSchema extends z.ZodNever ? [] : [z.output<TSchema>] | |
type TransformedArgs = TSchema extends z.ZodNever ? [] : [z.input<TSchema>] | |
return { | |
// eslint-disable-next-line no-unused-vars | |
do<TOutput>(fn: (...input: InputArgs) => TOutput) { |
This file contains 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 std = @import("std"); | |
pub fn LexicographicHashMap(comptime V: type, comptime capacity: u32) type { | |
const shift = @bitSizeOf(u64) - 1 - std.math.log2_int(u64, capacity) + 1; | |
const overflow = capacity / 10 + (@bitSizeOf(u64) - 1 - shift + 1) << 1; | |
const num_entries = capacity + overflow; | |
return struct { | |
pub const Entry = packed struct { | |
key: u32 = 0, |
This file contains 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
pub mod oneshot_broadcast { | |
use std::{ | |
cell::UnsafeCell, | |
pin::Pin, | |
task::{Context, Poll, Waker}, | |
}; | |
use futures_lite::Future; | |
use pin_list::PinList; | |
use pin_project_lite::pin_project; |
This file contains 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
// deno run -A --unstable main.ts | |
export const classToValue = { | |
request: 0x0000, | |
indication: 0x0010, | |
success: 0x0100, | |
failure: 0x0110, | |
}; | |
export const methodToValue = { |
This file contains 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] | |
name = "quic-holepunching" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
anyhow = "1.0.71" | |
bitflags = "2.2.1" |
NewerOlder