Skip to content

Instantly share code, notes, and snippets.

View CGamesPlay's full-sized avatar
:bowtie:

Ryan Patterson CGamesPlay

:bowtie:
View GitHub Profile
import { Conn, Transport, Message, RPCMessage, Client } from "capnp-ts";
class AsyncQueue<T> {
waitingData: T[] = [];
waitingReaders: ((m: T) => void)[] = [];
push(val: T) {
if (this.waitingReaders.length > 0) {
this.waitingReaders.shift()!(val);
} else {
@CGamesPlay
CGamesPlay / main.go
Created May 20, 2021 23:40
Capnp-go web sockets server
package main
import (
"fmt"
"io"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"github.com/spf13/afero"
import { z, UserId, Response, Engine } from "./util";
const Gesture = z.enum(["ROCK", "PAPER", "SCISSORS"]);
type Gesture = z.infer<typeof Gesture>;
const PlayerInfo = z.object({
id: UserId,
score: z.number(),
gesture: Gesture.nullable(),
});
const PlayerState = z.object({
import { Methods, Context } from "./.hathora/methods";
import { Response } from "../api/base";
import {
UserId,
PlayerState,
IJoinGameRequest,
IChooseGestureRequest,
INextRoundRequest,
Gesture,
} from "../api/types";
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CGamesPlay
CGamesPlay / user-script.js
Created October 4, 2023 22:58
Convert em media queries to px
// ==UserScript==
// @name px-media-queries
// @description Convert all media queries to use px instead of em.
// @match *://*/*
// @exclude https://github.com/*
// @exclude https://developer.mozilla.org/*
// @exclude http://localhost:*/*
// ==/UserScript==
// Breaks Dark mode on Github for some reason.
@CGamesPlay
CGamesPlay / AHRS.ipynb
Last active February 6, 2024 23:34
AHRS
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CGamesPlay
CGamesPlay / ARCHITECTURE.md
Created April 4, 2024 10:31
Plandex LLM Usage

Based on analyzing the code, here is a high-level overview of the main prompts used in this project and how they fit into the overall flow:

The core prompts are defined in the model/prompts package:

  1. SysCreate (create.go) - This is the main system prompt that defines the AI's identity as Plandex, an AI programming assistant. It provides detailed instructions on how to collaboratively create a 'plan' with the user to complete a programming task. The prompt covers things like assessing if there is a clear task, breaking down large tasks into subtasks, generating code blocks, using open source libraries, and ending responses.

  2. ListReplacementsFn (build.go) - Used when building code files from a plan. It analyzes proposed code updates and produces a structured list of changes to make.

  3. SysDescribe (describe.go) - Used to generate a commit message summarizing the changes made in a plan.

@CGamesPlay
CGamesPlay / bench.py
Created July 1, 2024 02:17
MappingProxyType performance
import timeit
import types
def create_benchmark(test_dict):
def benchmark():
for key in range(100):
if key in test_dict:
value = test_dict[key]
return benchmark
@CGamesPlay
CGamesPlay / decorator.py
Last active July 17, 2024 07:25
Fully-typed Python decorator for functions, methods, staticmethods, and classmethods.
"""
Showcase a fully-typed decorator that can be applied to functions, methods,
staticmethods, and classmethods.
This example has some limitations due to the limited expressiveness of the
Python type system:
1. When applying the decorator to a function whose first argument is an
optional type object, the returned function's first argument is shown as
required.