Skip to content

Instantly share code, notes, and snippets.

@park-brian
park-brian / index.html
Created January 15, 2026 19:17
AI Chat
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AWS Bedrock Chat</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1/font/bootstrap-icons.min.css" />
<style>
:root {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Angular 21</title>
<script type="importmap">
{
"imports": {
"@angular/core": "https://cdn.jsdelivr.net/npm/@angular/core@21/fesm2022/core.mjs",
"@angular/core/primitives/signals": "https://cdn.jsdelivr.net/npm/@angular/core@21/fesm2022/primitives-signals.mjs",
@park-brian
park-brian / bootstrap-uswds.css
Created September 4, 2025 03:58
bootstrap-uswds.css
/*!
* Bootstrap–USWDS Theme
*/
/* -------------------------------------------------------------------------- */
/* 1) Curated USWDS System Tokens */
/* -------------------------------------------------------------------------- */
:root {
/* --- Primary Action (Blue) --- */
@park-brian
park-brian / AdvancedWindowSnap.ahk
Last active June 2, 2025 18:33 — forked from Katorthoma/AdvancedWindowSnap.ahk
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap
* Snaps the active window to a position within a user-defined grid.
*
* @author Andrew Moore <andrew+github@awmoore.com>
* @contributor jballi
* @contributor park-brian
* @contributor shinywong
* @version 1.2
*/
@park-brian
park-brian / index.js
Last active February 21, 2025 05:04
UPNP in Node.js
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,
@park-brian
park-brian / complete.js
Last active January 22, 2025 18:38
complete.js
#!/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;
@park-brian
park-brian / substructure-search.js
Created January 22, 2025 01:46
substructure-search.js
/**
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:
@park-brian
park-brian / getBytesFromRanges.js
Last active December 8, 2024 09:49
getBytesFromRanges (eg: sliceMany for remote files)
/**
* 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
*/
@park-brian
park-brian / index.html
Last active August 11, 2021 19:00
RWS Editor Test Latest
<!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">
@park-brian
park-brian / importDynamoDBTable.js
Last active July 19, 2021 23:49
Uses parallel batchWrite requests to quickly load data into DynamoDB.
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({