This page documents my local/private OpenCode setup, including the LLM request path, memory integration, web crawling, and web search capabilities.
flowchart LR
OC["OpenCode"]| /* source: https://andy-bell.co.uk/a-more-modern-css-reset/ */ | |
| /* Box sizing rules */ | |
| *, | |
| *::before, | |
| *::after { | |
| box-sizing: border-box; | |
| } | |
| /* Prevent font size inflation */ |
| #!/bin/bash | |
| # PREREQUISITES: | |
| # - Homebrew | |
| # - Zsh | |
| # - oh-my-zsh | |
| # - Node.js with the following global packages installed: | |
| # - npm-check-updates | |
| # - n | |
| # - Docker |
| import { Configuration, OpenAIApi } from 'openai'; | |
| import dotenv from 'dotenv'; | |
| import { gptGetEmoji } from './helpers.js'; | |
| dotenv.config(); | |
| const { OPEN_AI_API_KEY } = process.env; | |
| const configuration = new Configuration({ |
| // WeatherKit REST API documentation lists `conditionCode` as a property returned for | |
| // various DataSets and says it's an enumeration value | |
| // (e.g. https://developer.apple.com/documentation/weatherkitrestapi/currentweather/currentweatherdata) | |
| // but never says what the possible return values could be anywhere in the REST API docs | |
| // | |
| // The following was created from info in the Swift documentation: https://developer.apple.com/documentation/weatherkit/weathercondition | |
| export interface ConditionCode { | |
| code: string; | |
| description: string; |
feat: new featurefix(scope): bug in scopefeat!: breaking change / feat(scope)!: rework APIchore(deps): update dependenciesbuild: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries| const { hrtime } = process; | |
| (async () => { | |
| const debugStartTime = hrtime(); | |
| // do stuff | |
| const debugEndTime = hrtime(debugStartTime); | |
| console.log( | |
| `Execution time: ${debugEndTime[0] * 1000 + debugEndTime[1] / 1000000}ms`, |
| import puppeteer from 'puppeteer' | |
| const wordleUrl = 'https://www.nytimes.com/games/wordle/index.html'; | |
| const wordleLocalStorageKey = 'nyt-wordle-state'; | |
| const defaultTimezone = 'America/New_York'; | |
| (async () => { | |
| const browser = await puppeteer.launch({ | |
| args: [ | |
| '--no-sandbox', |
| *, html, html *, body, body * { | |
| -webkit-font-smoothing: antialiased !important; | |
| -moz-osx-font-smoothing: grayscale !important; | |
| text-rendering: geometricPrecision !important; | |
| } | |
| body { | |
| word-spacing: -1px; | |
| -webkit-font-smoothing: auto; | |
| } |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Color gradient</title> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono:400,700" rel="stylesheet"> | |
| <link rel="stylesheet" href="/style.css"> | |
| <script src="/script.js" defer></script> |