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 http from "http"; | |
import { once } from "events"; | |
import NatUpnp from "./nat-upnp.js"; | |
const mapping = { | |
public: 8081, | |
private: 8080, | |
protocol: "TCP", | |
description: "Node.js server", | |
ttl: 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
#!/usr/bin/env node | |
const fs = require("fs"); | |
const path = require("path"); | |
const vm = require("vm"); | |
const util = require("util"); | |
const { OpenAI } = require("openai"); | |
const [inputFile, attemptsArg, model = "deepseek-reasoner"] = process.argv.slice(2); | |
const maxAttempts = parseInt(attemptsArg) || 5; | |
const maxTokens = 8000; |
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
/** | |
SMILES Rules: | |
Atoms: | |
Represented by their atomic symbols. | |
Common organic elements (B, C, N, O, P, S, F, Cl, Br, I) can be written without brackets if they have no formal charge and the number of attached hydrogens is implied by typical valence. | |
Atoms outside this set or with explicit hydrogens, charges, or isotopes are enclosed in brackets, e.g., [Fe], [OH2], [13C]. | |
Bonds: |
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
/** | |
* Retrieves byte ranges from a URL using the Fetch API. | |
* Uses ASCII encoding for direct byte<->text position mapping. | |
* | |
* @param {Object} options | |
* @param {string} options.url - Source URL | |
* @param {(number[]|null)[]} options.ranges - Array of [start, end] pairs (end is exclusive) | |
* @param {RequestInit} options.requestInit - Fetch API configuration | |
* @param {boolean} [options.trustContentType=false] - Whether to trust multipart boundary from content-type header | |
*/ |
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
function sleep(ms) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
async function insertDynamoDBItems(documentClient, tableName, items) { | |
if (!items.length) return; | |
let responses = []; | |
let response = await documentClient | |
.batchWrite({ |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<h1>PLCO QQ Plot</h1> | |
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
/** | |
* A parser which handles any rfc4180 compliant csv file | |
* Configuration takes the following properties | |
* delimiter: specifies the field delimiter (default: ",") | |
* escape: specifies the escape character (default: ") | |
* skipLines: specifies the number of lines to skip (default: 0) | |
* transformRow: transform sthe default ouput from an array of strings to your custom format (eg: an array of objects) | |
* transformValue: transforms individual values (eg: for custom typecasting logic) | |
*/ |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<input id="height" placeholder="Height"> | |
<input id="width" placeholder="Width"> |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<input id="height" placeholder="Height"> | |
<input id="width" placeholder="Width"> |
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
/** | |
* A simple quadtree for rapidly fetching spatial data | |
* @param {number} xMin | |
* @param {number} xMax | |
* @param {number} yMin | |
* @param {number} yMax | |
*/ | |
function QuadTree(xMin, xMax, yMin, yMax) { | |
// swap xMin/xMax and yMin/yMax if needed | |
if (xMin > xMax) [xMin, xMax] = [xMax, xMin]; |
NewerOlder