Skip to content

Instantly share code, notes, and snippets.

View tensojka's full-sized avatar

Ondřej Sojka tensojka

  • Carmine Finance
  • Brno, Czech Republic
View GitHub Profile
@tensojka
tensojka / codemerger.py
Created March 13, 2024 13:29
This script merges files in a specific directory into one file, prefixing each with its name and separating the files with ---. The purpose is to be able to then feed a nearly whole codebase to a LLM easily.
import os
import sys
import argparse
import re
import pathspec
import subprocess
def load_gitignore(root_dir):
gitignore = os.path.join(root_dir, '.gitignore')
try:
@tensojka
tensojka / pack-git-for-llm.py
Created July 15, 2023 21:49
This script concats all of a git repository into one .txt file, perfect for supplying as context to Claude or for integration with other LLMs.
import os
import sys
import pathspec
def load_gitignore(root_dir):
gitignore = os.path.join(root_dir, '.gitignore')
if os.path.exists(gitignore):
with open(gitignore, 'r') as file:
spec = pathspec.PathSpec.from_lines('gitwildmatch', file)
else: