Skip to content

Instantly share code, notes, and snippets.

@weshoke
weshoke / codebase-analyzer.py
Created February 8, 2026 21:34
dspy.RLM analyzing a code base with a rules file
#!/usr/bin/env python3
"""
Codebase analyzer using Recursive Language Models (RLM) via DSPy.
Based on: https://kmad.ai/Recursive-Language-Models-Security-Audit
Usage:
python analyze-codebase.py --mode security --output report.md
python analyze-codebase.py --mode documentation --exclude tests,vendor
python analyze-codebase.py --mode quality --max-iterations 50
$ vagrant up --debug
INFO global: Vagrant version: 2.2.7
INFO global: Ruby version: 2.4.9
INFO global: RubyGems version: 2.6.14.4
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.7/gems/vagrant-2.2.7/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_LOG="debug"
WARN global: resolv replacement has not been enabled!
@weshoke
weshoke / CutCircularArc.json
Last active September 21, 2018 15:46 — forked from mrivlin/CutCircularArc.json
Plethora Computational Geometry Technical Exercise
{
"Edges": {
"53330552": {
"Type": "LineSegment",
"Vertices": [
10212927,
43495525
]
},
"24807479": {
@weshoke
weshoke / hexadecimal.parse.lua
Created October 21, 2013 02:06
Parsing hexadecimal numbers with LPEG
-- Match a hexadecimal digit (lower- or upper-case)
local hexdigit = digit + R("af", "AF")
local hexadecimal = P"0x" * hexdigit^1 * P(-1)
print(hexadecimal:match"0x01") --> '5', match successful
print(hexadecimal:match"0xfa") --> '5', match successful
print(hexadecimal:match"0fa") --> 'nil', match unsuccessful
print(hexadecimal:match"0xfg") --> 'nil', match unsuccessful
@weshoke
weshoke / integer.parse.lua
Created October 21, 2013 01:55
Parsing integers with LPEG in Lua
local lpeg = require"lpeg"
local P, R, S = lpeg.P, lpeg.R, lpeg.S
-- Any non-zero digit: (R stands for Range)
local nonzero = R"19"
-- Only zero: (P stands for Pattern)
local zero = P"0"
-- Any digit:
local digit = R"09"
-- Match a sqeuence of one or more numbers not starting with zero (aka positive numbers)
@weshoke
weshoke / README.md
Last active December 16, 2015 05:58 — forked from syntagmatic/README.md