Skip to content

Instantly share code, notes, and snippets.

View guest271314's full-sized avatar
💭
Fix WontFix

guest271314

💭
Fix WontFix
View GitHub Profile
@guest271314
guest271314 / how-to-curate.md
Created April 15, 2025 02:43
"curate", or not!

The workflow for salvaging a question

I still want answers, I do not want to just post my question again.

-24

I still want answers, I do not want to just post my I would just ask the question, again.

And ask the question in venues other than StackExchange. >

@guest271314
guest271314 / fetch-google-chrome-stable.sh
Last active April 6, 2025 01:30
Get, extract Google Chrome Stable from .deb
wget --show-progress --progress=bar https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# https://askubuntu.com/a/1512766/92739
dpkg --fsys-tarfile google-chrome-stable_current_amd64.deb | tar -xv --strip-components=3 ./opt/google/chrome
rm -rf google-chrome-stable_current_amd64.deb
@guest271314
guest271314 / quickjs-ng-latest-releases.md
Created April 5, 2025 22:51
QuickJS NG Latest Releases
@guest271314
guest271314 / deno-wt-server.js
Last active March 11, 2025 03:07
Deno HTTP/3 WebTransport server
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// https://raw.githubusercontent.com/denoland/deno/dce204af32e4b56681be4f9a034256d979a3ce4b/tests/specs/run/webtransport/main.ts
const cert = Deno.readTextFileSync("./certificate.pem");
const key = Deno.readTextFileSync("./certificate.key");
const certBase64 = cert.split("\n").slice(1, -2).join("");
const certBytes =
await (await fetch(`data:application/octet-stream;base64,${certBase64}`))
.bytes();
const certHash = await crypto.subtle.digest("SHA-256", certBytes);
@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 : "---";
@guest271314
guest271314 / node-http2-server.js
Last active March 11, 2025 02:24
HTTP/2 server using Node.js builtins and WHATWG Streams
import { createSecureServer } from "node:http2";
import { createWriteStream, readFileSync } from "node:fs";
import { open, stat } from "node:fs/promises";
import { Readable, Writable } from "node:stream";
import process from "node:process";
const stdout = Writable.toWeb(process.stdout);
const encoder = new TextEncoder();
const headers = {
"Cache-Control": "no-cache",
"Content-Type": "text/plain; charset=UTF-8",
@guest271314
guest271314 / file-system-access-write.md
Created February 15, 2025 05:32
Write files with File System Access API without creating orphan .crswap files

The reason for using

await readable.pipeTo(writable)

is the .crswap file is automatically removed when the Promise fulfills.

Here's one way to write arbitrary volumes of data to the same file, without generating a bunch of orphan .crswap files.

The gist is

@guest271314
guest271314 / assemblyscript-deno-bun-node-js.md
Last active February 28, 2025 03:26
Executing AssemblyScript directly, and compiling to JavaScript with tsc, Deno, and Bun (and executing WASM directly with bun)

Executing AssemblyScript directly, and compiling to JavaScript with tsc, Deno, and Bun (and executing WASM directly with bun)

Installing

bun install typescript@next assemblyscript @types/node
bun add v1.2.1-canary.15 (5633ec43)

installed [email protected] with binaries:
 - tsc
@guest271314
guest271314 / bench.js
Last active January 20, 2025 12:39
TypeScript .ts file execution benchmarks for Deno, Bun, Node.js
Deno.bench("Deno, Bun, Node.js TypeScript Benchmarks", async (b) => {
// Open a file that we will act upon.
// using file = await Deno.open("a_big_data_file.txt");
// Tell the benchmarking tool that this is the only section you want
// to measure.
b.start();
// Now let's measure how long it takes to read all of the data from the file.
// await new Response(file.readable).arrayBuffer();
@guest271314
guest271314 / no-monopoly.md
Last active January 12, 2025 00:06
How to set a user-defined default search engine (and custom new tab page) in Chromium browser

In Chromium or Chrome browsers navigate to chrome://settings/searchEngines. The page looks something like this. Here I'm showing what Chromium Version 134.0.6949.0 (Developer Build) (64-bit). On Linux.

Screenshot_2025-01-11_14-45-55

Notice that ".(Default)".