Skip to content

Instantly share code, notes, and snippets.

View unek's full-sized avatar
🤠

unek

🤠
  • Poland
  • 22:48 (UTC +02:00)
View GitHub Profile
@guest271314
guest271314 / node-wss-server.js
Last active April 3, 2025 21:03
WebSocket server using Node.js builtins and WHATWG Streams
#!/usr/bin/env -S node
// WebSocket server using Node.js builtins and WHATWG Streams
// https://gist.github.com/robertrypula/b813ffe23a9489bae1b677f1608676c8
// https://gist.github.com/guest271314/735377527389f1de6145f0ac71ca1e86
import { readFileSync } from "node:fs";
import { createServer } from "node:tls";
import { Duplex } from "node:stream";
const debugBuffer = (bufferName, buffer) => {
const length = buffer ? buffer.length : "---";
@bogeychan
bogeychan / adapter.ts
Last active April 3, 2025 21:14
Basic Bun HTTP2 Adapter for ElysiaJS
// based on https://github.com/elysiajs/elysia/blob/main/src/adapter/bun/index.ts
import type { ElysiaAdapter, MaybePromise } from "elysia";
import { BunAdapter } from "elysia/adapter/bun";
import { isNumericString } from "elysia/utils";
import { ReadStream as NodeReadStream } from "node:fs";
import {
createSecureServer,
type Http2ServerRequest,
@fabiolimace
fabiolimace / UUIDv6.sql
Last active May 11, 2025 12:04
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is