Skip to content

Instantly share code, notes, and snippets.

View CGamesPlay's full-sized avatar
:bowtie:

Ryan Patterson CGamesPlay

:bowtie:
View GitHub Profile
@CGamesPlay
CGamesPlay / decorator.py
Created July 12, 2024 12:50
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. When combining the decorator with staticmethod
and classmethod, it's important to put the decorator directly before the
staticmethod of classmethod.
This example uses a few heuristics which are not 100% accurate to type
staticmethod and classmethod. Specifically, if the first argument to a method
is a type object, the decorator always assumes that the method is a
classmethod; and if the first argument to a method is an instance of the class
@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 / 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 / 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 / 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import { Methods, Context } from "./.hathora/methods";
import { Response } from "../api/base";
import {
UserId,
PlayerState,
IJoinGameRequest,
IChooseGestureRequest,
INextRoundRequest,
Gesture,
} from "../api/types";
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({
@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 { 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 {