Skip to content

Instantly share code, notes, and snippets.

View rjurney's full-sized avatar

Russell Jurney rjurney

View GitHub Profile
@rjurney
rjurney / CLAUDE.md
Created June 16, 2025 15:03
Example of a `CLAUDE.md` file to tune Claude Code's performance. Refer to it to create your own `CLAUDE.md`

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Commands

  • Install Dependencies: poetry install
  • Run CLI: poetry run abzu
  • Build/Generate abzu/baml_client code: baml-cli generate
  • Test baml_src code: baml-cli test, poetry run pytest tests/
@rjurney
rjurney / loss.py
Created June 13, 2025 02:05
We all contrastive experience loss at some point in our lives, but which one for your problem and with what hyperparameters?
# This will effectively train the embedding model. MultipleNegativesRankingLoss did not work.
loss: losses.ContrastiveLoss = losses.ContrastiveLoss(model=sbert_model)
# These are default arguments for OnlineContrastiveLoss
loss: losses.OnlineContrastiveLoss = losses.OnlineContrastiveLoss(
model=sbert_model,
margin=0.5, # Margin for contrastive loss
distance_metric=SiameseDistanceMetric.COSINE_DISTANCE,
)
@rjurney
rjurney / CLAUDE.md
Created June 3, 2025 16:22
My `CLAUDE.md`, command and allows-tools setup - note that everything has a CLI :) Why not?

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Commands

  • Install Dependencies: poetry install
  • Run CLI: poetry run abzu
  • Build/Generate abzu/baml_client code: baml-cli generate
  • Test baml_src code: baml-cli test, poetry run pytest tests/
@rjurney
rjurney / technical_analysis.md
Created June 1, 2025 04:51
Claude 4 Opus created a technical analysis agent given a DataFrame of tick data for an equity

I'll show you how to structure data and prompts for effective technical analysis with LLMs. Here's a comprehensive approach:

1. Data Preparation Structure

import pandas as pd
import numpy as np
from typing import Dict, List, Tuple

def prepare_ta_data(df: pd.DataFrame) -> pd.DataFrame:
@rjurney
rjurney / click_conversion_guide.md
Created May 14, 2025 21:29
Click code conversion guide Markdown for Claude Code to use in making CLIs

Click Conversion Guide for Abzu CLI

This document serves as a guide for converting the existing argparse-based CLI to use Click.

Key Click Features to Leverage

  1. Decorator-based Command Pattern
    • Use @click.command() and @click.group() decorators
    • Replace manual subparser creation with nested command groups
@rjurney
rjurney / .claude_slash_settings.json
Created May 13, 2025 21:08
Current Claude Code Configuration
{
"permissions": {
"allow": [
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)",
"Bash(git add:*)",
"Bash(git grep:*)",
"Bash(poetry update:*)",
"Bash(pip show:*)",
@rjurney
rjurney / .claude_slash_settings.json
Last active May 8, 2025 17:05
My current CLAUDE.md file, always a work in progress...
{
"permissions": {
"allow": [
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)",
"Bash(poetry update:*)",
"Bash(pip show:*)",
"Bash(pip freeze:*)",
"Bash(pip list:*)",
@rjurney
rjurney / parse.py
Created April 23, 2025 05:25
Parse JSONIsh brackets
class Solution:
openers = ["(", "{", "["]
closers = [")", "}", "]"]
valid = openers + closers
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append(x)
@rjurney
rjurney / substr.py
Created April 23, 2025 04:54
Find the longest common sub-string among a set of strings...
from collections import defaultdict
from pprint import pprint
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
str_count = len(strs)
min_len = min([len(s) for s in strs])
print(f"Minimum string length: {min_len:,}")
@rjurney
rjurney / pregel.py
Created March 25, 2025 17:10
GraphFrames Pregel API - sum the ages of a node's neighbors
from graphframes.lib import AggregateMessages as AM
from graphframes.examples import Graphs
from pyspark.sql.functions import sum as sqlsum
g = Graphs(spark).friends() # Get example graph
# For each user, sum the ages of the adjacent users
msgToSrc = AM.dst["age"]
msgToDst = AM.src["age"]