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 / MP3Stream.js
Created February 18, 2024 16:32
MP3 encoder
View MP3Stream.js
/*
var url = URL.createObjectURL(new Blob([await (await fetch('https://raw.githubusercontent.com/guest271314/captureSystemAudio/master/native_messaging/capture_system_audio/lame.min.js')).text()],{
type: "text/javascript"
}));
*/
var dir = await navigator.storage.getDirectory();
var handle;
try {
handle = await dir.getFileHandle("lame.js", {
create: false,
@guest271314
guest271314 / google_ai_ad.md
Created February 14, 2024 04:55
Google advertising "A.I.". Where's TTS/STT shipped in Chromium and Chrome?
@guest271314
guest271314 / delete_deno_global_cache.js
Last active February 12, 2024 07:53
Delete Deno global cache directories
View delete_deno_global_cache.js
const decoder = new TextDecoder();
const command = new Deno.Command(Deno.execPath(), {
args: [
"info",
"--json",
],
});
const { code, stdout, stderr } = await command.output();
// https://tc39.es/ecma262/multipage/structured-data.html#sec-json.parse
// 11.b. Let rootName be the empty String.
@guest271314
guest271314 / gdm_capture_monitor_device_on_chromium.js
Created February 8, 2024 05:32
Finally possible to capture monitor devices in Chromium and Chrome on Linux
View gdm_capture_monitor_device_on_chromium.js
// Finally possible to capture speechSynthesis.speak() on Chromium and Chrome
// Enable Speech Dispatcher, PulseAudio loopback for screen capture, disable default WebRTC input volume adjustment from 100% to 8%
// chrome --enable-speech-dispatcher --enable-features=PulseaudioLoopbackForScreenShare --disable-features=WebRtcAllowInputVolumeAdjustment
// Still have to manually select share system audio in picker with systemAudio set to "include"
// https://issues.chromium.org/issues/40155218
let stream = await navigator.mediaDevices.getDisplayMedia({
// We're not going to be using the video track
video: {
width: 0,
height: 0,
@guest271314
guest271314 / buffer-bun-bundle.js
Last active January 20, 2024 04:00
feross/buffer bundled to Ecmascript Module
View buffer-bun-bundle.js
// git clone https://github.com/feross/buffer
// cd buffer
// bun install base64-js ieee754
// bun build ./index.js --target=browser --outfile=buffer.js
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
// node_modules/base64-js/index.js
var require_base64_js = __commonJS((exports) => {
var getLens = function(b64) {
@guest271314
guest271314 / compiling_standalone.md
Last active February 22, 2024 05:42
Compiling a standalone executable using modern JavaScript/TypeScript runtimes
View compiling_standalone.md

Compiling a standalone executable using modern JavaScript/TypeScript runtimes

We have the same code working using node, deno, and bun.

E.g.,

bun run index.js
@guest271314
guest271314 / of_gates_and_keys.md
Created January 7, 2024 04:02
Hopping over and tunneling under gates to get keys
View of_gates_and_keys.md

Hopping over and tunneling under gates to get keys

Chrome Apps used to have chrome.sockets. Then Chrome Apps were deprecated, along with chrome.sockets.

Along comes Direct Sockets. Revival of TCP sockets, UDP sockets, TCP socket server implementation that can be used in the browser.

Direct Sockets was initially gated behind a Progressive Web App on Chrome, then gated behind a different API, Isolated Web Apps (IWA) using Signed Web

@guest271314
guest271314 / dynamic_import_always_throws.js
Created January 3, 2024 05:26
Deno dynamic import("./exports") throws module not found for "exports.js" dynamically created in the script
View dynamic_import_always_throws.js
// Deno dynamic import("./exports") throws module not found for "exports.js" dynamically created in the script
// dynamic_import_always_throws.js
// References: https://www.reddit.com/r/Deno/comments/18unb03/comment/kfsszsw/ https://github.com/denoland/deno/issues/20945
// Usage:
// deno run -A dynamic_import_always_throws.js
// bun run dynamic_import_always_throws.js
// node --experimental-default-type=module dynamic_import_always_throws.js
import { open, unlink } from "node:fs/promises";
const runtime = navigator.userAgent;
const encoder = new TextEncoder();
@guest271314
guest271314 / reddits_search_is_horrible.md
Created January 2, 2024 01:16
Reddit's site search is horrible. Some programmer kindly help them out...
View reddits_search_is_horrible.md

So, somebody posted a question or r/javascript. In that question they used the term "Spread and Rest Operators". Now, ECMA-262 does not define spread syntax or rest element as operators. Nonetheless people have repeated that term over and over again.

At one point I asked the question about who came up with the terms "spread operator" on r/javascript.

Should be easy enough to search for and get the results I'm looking for using Reddit's search implementation... It ain't though. I tried on r/javascript using "spread operator" and author:guest271314; I tried on the site search as a whole. I tried for 10 minutes to find that post, my post, using Reddit's search implementation.

I wound up going through the pseudo-infinite scroll of my posts to locate the question I asked to ultimately find the comment where I posted the earliest usage of the term "spread operator" I could find online https://www.reddit.com/r/javascript/comments/xhhqsz/comment/iozf2ij/

@guest271314
guest271314 / README.md
Created December 31, 2023 13:18
Install repositories from GitHub to node_modules for Deno
View README.md

Deno doesn't have a way to install repositories from GitHub to the local node_modules folder.