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 / no-npm.md
Created November 28, 2023 02:00
Install Nodes.js packages and run Node.js scripts without npm or node - with Bun

I've been testing and experimenting over the past week or so with installing Node.js-specific packages - without using npm because somebody claimed Can this be used to create/download npm as a standalone executable? #3237

npm can’t be eliminated from the equation when you’re dealing with JavaScript ¯_(ツ)_/¯

Well, let's see about that...

First I had to get all of the dependencies from package.json and/or package-lock.json file. Turns out different packages can depend on different versions of the same named module. Ever hear about "callback hell"? Well, Node.js module dependency system can be dependency hell.

Fortunately for me, due to personal reasons I am evil now (TM) (Rebel Circus). So I fit right in in hell, hell I thrive in chaos.

@guest271314
guest271314 / a_modest_proposal_for_imperfect_software.md
Created November 24, 2023 00:37
A modest proposal for imperfect software

If you maintain software, it's perfect. Guaranteed. Copyrighted. Patented. Your compilers and frameworks and libraries have been downloaded billions of times.

If I asked some wild question about your software it's just that I might have some trivial use case that is not intended to make money, or some use case that is explicitly outside of your specification, or implementation. It's me. Your software is perfect, always will be. How dare me to use your perfect software in an imperfect manner outside of your clear and unambiguous mandates in your README. Where are my manners?

@guest271314
guest271314 / javascript_stdio_unspecified.md
Last active November 16, 2023 06:22
JavaScript Standard Input/Output: Unspecified

JavaScript Standard Input/Output: Unspecified

Some definitions. One important point is stdin, stdout, stderr do not have to originate from a keyboard, or a TTY.

Let's hear what IBM has to say Understanding standard input, standard output, and standard error

Once a command begins running, it has access to three files:

  1. It reads from its standard input file. By default, standard input is the keyboard.
@guest271314
guest271314 / deno_half_duplex_relay_server.js
Last active November 12, 2023 06:09
Half-duplex + Half-duplex !== Full-duplex
const responseInit = {
headers: {
"Cache-Control": "no-cache",
"Content-Type": "text/plain; charset=UTF-8",
"Cross-Origin-Opener-Policy": "unsafe-none",
"Cross-Origin-Embedder-Policy": "unsafe-none",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Private-Network": "true",
"Access-Control-Allow-Headers": "Access-Control-Request-Private-Network",
"Access-Control-Allow-Methods": "OPTIONS,POST,GET,HEAD,QUERY",
@guest271314
guest271314 / unzip.js
Last active November 5, 2023 15:24 — forked from gildas-lormeau/unzip
Basic unzip implementation based on zip.js and Deno (Fetch and unzip Chrome-For-Testing Canary Channel)
// Fetch and unzip Chrome-For-Testing Canary Channel
// deno run -A unzip.js
/* eslint-disable no-console */
/* global Deno, Intl */
"use strict";
// import { parse } from "https://deno.land/std/flags/mod.ts";
import { exists } from "https://deno.land/std/fs/mod.ts";
import { basename, dirname } from "https://deno.land/std/path/mod.ts";
@guest271314
guest271314 / download_extract_chrome_for_testing.js
Last active October 31, 2023 08:12
Get the URL of latest Chrome-For-Testing, download ZIP, extract ZIP, write folders and files to filesystem
// Caveat: Executable permissions are not preserved
var text = await (await fetch(
"https://raw.githubusercontent.com/Stuk/jszip/main/dist/jszip.min.js",
)).blob();
await import(URL.createObjectURL(
new Blob([text], {
type: "text/javascript",
}),
));
@guest271314
guest271314 / builtins.js
Created October 22, 2023 16:53
node built-in modules
console.log((await import("node:module")).builtinModules);
@guest271314
guest271314 / remove_my_extensions_web_store_links.js
Created October 20, 2023 05:18
Remove My extensions Chrome Web Store links from chrome://extensions
@guest271314
guest271314 / free.md
Created October 17, 2023 06:55
Do not pay to learn a FREE library. Read the documentation, write and test your code

This dropping half of my savings on a React course ? is insane.

Is this the state of the art?

People so entranced by the hype of React, or some other FREE library that they would actually consider spending half of their savings to learn a FREE library?

Learn how to write HTML, CSS, manipulate the DOM, and use Web API's. That's all any library that renders Web content in a modern browser does.

Perhaps this is evidence of peak React (library, framework, "AI") hype, and from here people will snap out of it and actually start reading documentation of HTML, CSS, DOM, Web API's and begin writing and testing code by hand.

@guest271314
guest271314 / open_current_process_stdout.mjs
Created October 14, 2023 21:34
[Node.js] Write to stdout of current process pid
import { open } from "node:fs/promises";
const stdout = await open(`/proc/${process.pid}/fd/1`, "w");
await stdout.write(new TextEncoder().encode(`${process.pid}`));
await stdout.close();