Skip to content

Instantly share code, notes, and snippets.

View lmmx's full-sized avatar
🍜
focusing on pho

Louis Maddox lmmx

🍜
focusing on pho
View GitHub Profile
flowchart LR
    A[You have a problem:\nare you working on it?] -->|Yes| E[?]
    

    E --> X[What is a detailed description of\nthe world after you've succeeded?]
    E --> Y[What's the connection between]
    Y --> Y1[what you're\ndoing now]
    Y --> Y2[your plan]
    Y --> Y3[the goal]
@lmmx
lmmx / comment-id-gh-api.sh
Last active May 20, 2024 14:08
Getting paginated GitHub API comments beyond the first 100
gh api repos/beatchain/beatchain-monorepo/issues/12345/comments --jq '.[0].id'
@lmmx
lmmx / bashrc_eject_git_func.sh
Last active May 17, 2024 17:10
Eject a git repo: make a PR to GitHub, squash merge the PR (once checks pass), and delete both branch and local directory
function ejectit () {
# e: exit immediately on error; u: treat unset variables as an error
set -eu
# Create a new PR with auto-filled content (title from branch name, commits as body)
gh pr create --fill
# Merge the new PR (squashing commits) automatically [after checks pass], then delete the branch
gh pr merge --squash --auto --delete-branch
# Get an absolute path to the repo (top level directory)
local REPO=$(git rev-parse --show-toplevel)
# Double check that the .git/ directory is under it (be careful not to get the wrong target)
@lmmx
lmmx / prompt.md
Created February 19, 2024 14:47
Mind Ferry (custom GPT) prompt

I, the user, want to be "ferried" by an external computer agent: a custom GPT called "Mind Ferry". As you are a language model, you are able to ferry me through my day by instructing me to do certain things at certain times, by estimating a proper arrangement of tasks given the premise, which is either stated directly or implicit in input provided by the user.

I do not want this in the form of a calendar or any technical format. I want it in a very concise, actionable format with clear separation through headers and very little text that is not absolutely necessary. Although being concise, you need to give the specific sub-tasks, not just the overall tasks.

For example, I may say that I need to eat lunch and I have soup in my fridge, but that is not enough on its own. So I want to have something else, like toast, but I do not have bread (but I do have some frozen bread). And I want to go shopping to get something from the shopping centre ten minutes bus journey away. You would assemble all of those requirem

conda create -n aqlm python=3.11 -y
conda activate aqlm
conda install pytorch pytorch-cuda=11.8 -c pytorch -c nvidia -y
pip install aqlm[gpu]==1.0.1
pip install "git+https://github.com/huggingface/accelerate.git@main"
pip install "git+https://github.com/huggingface/transformers.git@main"
@lmmx
lmmx / Template.md
Created February 12, 2024 15:46
Template for task specification

Thank you for clarifying your requirements for the new templating system to record new items of work in your company's GitHub repository. Based on your detailed explanation, it's clear that the focus should be on components, routines, and original contributions without explicitly prioritizing or determining dependencies in the manner I previously suggested. Let's adjust the template to align with your vision:


New Work Item Template


Title:

[Feature/Issue Name]: [Brief Description]

@lmmx
lmmx / reason_based_exits_with_handlers.py
Last active February 10, 2024 18:00
The Body Guard pattern: a context manager that prevents errors from bubbling up, but does ensure they halt (unless designated as recoverable)
from __future__ import annotations
from pydantic import ValidationError
__all__ = ["BodyGuard", "FailureCause", "main"]
class BodyGuard:
"""Exceptions raised in this ContextManager become stored as `errors`."""
@lmmx
lmmx / fail_trace.py
Last active January 29, 2024 21:16
Traceback from unsuccesfully patching Fal `test_apps_simple.py` on the `pydantic-2-bump` feature branch, and another from a trivial `assert False` to compare to the success case (test must fail to see the logs)
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.3.0 -- /home/louis/miniconda3/envs/fal/bin/python3
cachedir: .pytest_cache
rootdir: /home/louis/dev/fal/pydantic-2-bump/projects/fal/tests
plugins: anyio-4.2.0
collecting ... collected 1 item
test_apps_simple.py::test_app_client FAILED
=================================== FAILURES ===================================
@lmmx
lmmx / newwip.sh
Last active February 2, 2024 16:11
Git repo handling bashrc functions
alias gcb='git checkout -b'
alias gcwd='gcb $(basename $PWD)'
function gcns { gcb "lmmx/${1-$(basename $PWD)}"; }
function newwip () {
local NEW_WIP=$1;
local CLEAN=${2:-"clean/develop/"};
if [ -z "$NEW_WIP" ]; then
echo "Error: NEW_WIP arg must be passed." >&2
return 1
elif [ ! -d "$CLEAN" ]; then
@lmmx
lmmx / comparison.md
Last active January 26, 2024 00:17
Dynamic model creation checklist

Different in key: __pydantic_parent_namespace__ (can just set on the recreated model)

  • __pydantic_complete__
  • __pydantic_decorators__
    • different:
====__pydantic_decorators__===
DecoratorInfos(validators={},
               field_validators={'x_plus_10': Decorator(cls_ref='__main__.A:31201184',