Skip to content

Instantly share code, notes, and snippets.

View zackiles's full-sized avatar

Zachary Iles zackiles

View GitHub Profile
@zackiles
zackiles / bind_hack.js
Created November 26, 2015 00:10 — forked from tralamazza/bind_hack.js
node.js bind() hack
/*
* Author: Daniel Tralamazza <tralamazza@gmail.com>
*
* Patch Socket for a before connect event.
* Important! You must require this module before anything else.
*
* Usage:
*
* var patch = require('./bind_hack');
* var bind_f = process.binding('net').bind;
@zackiles
zackiles / gnu-unified-diff-prompt.json
Created November 3, 2024 02:43
Token-Efficient and Consistent AI Code Generation Through GNU Unified Diff (JSON)
{
"OUTPUT_FORMAT": {
"type": "JSON",
"encoding": "UTF-8",
"structure": {
"target_file": "string (relative path with forward slashes)",
"diff": "string (unified diff with \\n line breaks)",
"error": "string (optional, only present for errors)"
}
},
@zackiles
zackiles / gnu-unified-diff-prompt.xml
Created November 3, 2024 02:43
Token-Efficient and Consistent AI Code Generation Through GNU Unified Diff (XML)
<output>
<OUTPUT_FORMAT>
<type>JSON</type>
<encoding>UTF-8</encoding>
<structure>
<target_file>string (relative path with forward slashes)</target_file>
<diff>string (unified diff with \n line breaks)</diff>
<error>string (optional, only present for errors)</error>
</structure>
</OUTPUT_FORMAT>
@zackiles
zackiles / patch-command.js
Created November 3, 2024 02:45
Virtualized Patch Command in Javascript
import fs from 'node:fs/promises';
import path from 'node:path';
/**
* Applies a unified diff to a file system, emulating the Unix 'patch' command.
* @param {string} jsonString - The JSON string containing 'target_file' and 'diff'.
* @param {Object} [fsModule] - Optional file system module (e.g., memfs) for virtual file systems.
*/
async function applyPatch(jsonString, fsModule = fs) {
try {
@zackiles
zackiles / prompt-context-javascript-styleguide.xml
Last active November 3, 2024 06:56
Prompt-Context: Style guide for code generators writing modern Javascript & Typescript (XML)
<StyleGuide>
<Title>JavaScript and TypeScript Coding Style Guide</Title>
<Introduction>
This style guide outlines the best practices for writing modern, idiomatic, and maintainable JavaScript and TypeScript code, leveraging the latest ECMAScript features (ES2022 and above). It is designed to ensure code consistency, readability, and adherence to industry standards.
</Introduction>
<Section number="1" title="Code Formatting">
<Rules>
<Rule>Indentation: Use **2 spaces** for indentation.</Rule>
<Rule>Semicolons: **Omit semicolons** unless absolutely necessary (e.g., to avoid ASI pitfalls).</Rule>
@zackiles
zackiles / prompt-context-javascript-styleguide.json
Last active November 3, 2024 06:55
Prompt-Context: Style guide for code generators writing modern Javascript & Typescript (JSON)
{
"StyleGuide": {
"Title": "JavaScript and TypeScript Coding Style Guide",
"Introduction": "This style guide outlines the best practices for writing modern, idiomatic, and maintainable JavaScript and TypeScript code, leveraging the latest ECMAScript features (ES2022 and above). It is designed to ensure code consistency, readability, and adherence to industry standards.",
"Sections": [
{
"Number": "1",
"Title": "Code Formatting",
"Rules": [
"Indentation: Use **2 spaces** for indentation.",
const pw = require('playwright');
const UserAgent = require('user-agents');
const uuid = require('uuid');
const tmp = require('tmp-promise');
const UINT32_MAX = (2 ** 32) - 1;
const WEBGL_RENDERERS = ['ANGLE (NVIDIA Quadro 2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (NVIDIA Quadro K420 Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro 2000M Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (NVIDIA Quadro K2000M Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (ATI Radeon HD 3800 Series Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics 4000 Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)', 'ANGLE (Intel(R) HD Graphics Family Direct3D
@zackiles
zackiles / gpu-rental-financial-model-appscript.js
Created January 11, 2025 08:08
Appscript for Google Sheets that build a comprehensive and interactive financial model for a GPU rental business on a decentralized rental network
/*****************************************************
* Google Apps Script for a Comprehensive
* GPU Rental Business Financial Model in Google Sheets
*
* This script:
* 1. Creates/clears four sheets:
* - "Inputs"
* - "Calculations"
* - "Dashboard"
* - "Scenario Results"
@zackiles
zackiles / X-deno.md
Created February 28, 2025 01:46 — forked from ruvnet/X-deno.md
This implementation follows the official MCP specification, including proper message framing, transport layer implementation, and complete protocol lifecycle management. It provides a foundation for building federated MCP systems that can scale across multiple servers while maintaining security and standardization requirements.

Deno Nodejs version

complete implementation using both Deno and Node.js. Let's start with the project structure:

federated-mcp/
├── packages/
│   ├── core/               # Shared core functionality
│   ├── server/            # MCP Server implementation
│   ├── client/            # MCP Client implementation
│   └── proxy/             # Federation proxy
@zackiles
zackiles / capabilities.txt
Created March 10, 2025 00:04 — forked from jlia0/agent loop
Manus tools and prompts
# Manus AI Assistant Capabilities
## Overview
I am an AI assistant designed to help users with a wide range of tasks using various tools and capabilities. This document provides a more detailed overview of what I can do while respecting proprietary information boundaries.
## General Capabilities
### Information Processing
- Answering questions on diverse topics using available information
- Conducting research through web searches and data analysis