001 Notes
AI Wrote Everything Except This
Exploiting $100 worth of Codex
Necromancing My Incomplete Projects
Codex & Projects
Optimized Python Backtester
- Performance loop: write -> benchmark -> hotspot -> rewrite -> benchmark.
- Do 1-2 passes by default; continue only while gains are material or target performance is unmet.
- Stop if complexity outweighs benefit, gains fall below ~10-15%, or bottleneck is outside touched code.
- For huge jobs, benchmark and optimize one representative case before scaling out.
- Document benchmarks, bottlenecks, optimizations, and remaining gaps.
GUI for Projects Listed Here
## Layout baseline
Treat `1920x1080` as the baseline contract.
At baseline resolution:
- primary navigation must remain visible
- key operational content must fit without obvious breakage
- headers, toolbars, and margins must stay compact
- layout must look intentionally designed, not barely surviving
For larger displays:
- reveal more structure, more columns, more panes, more metadata
- do not merely enlarge padding or center a narrow layout in empty space
For smaller windows:
- degrade gracefully using splitters, scroll areas, collapsible panes, tab folding, and hidden secondary metadata
- preserve the main workflow first
Use layouts, stretch, min/max/preferred sizing, and splitters deliberately.
Do not rely on fixed geometry hacks.
## UI design rules
Prefer:
- flat or GTK-like visual language
- compact spacing
- restrained borders
- subtle pane grouping
- dense but readable presentation
- thin toolbars and compact controls
- semantic color only when meaning exists
Avoid:
- mobile-style spacing
- oversized cards
- giant headers
- decorative whitespace
- loud gradients
- glassmorphism
- shadow-heavy floating panels
If cards are used:
- keep them flat or lightly separated
- keep border radius modest
- group by function, not decoration
## State visibility
The UI should always make state obvious.
Expose clearly:
- current page/section/context
- active workspace, account, project, or mode
- selected filters and scope
- stale vs live state
- loading / ready / failed state
- backend execution mode when relevant, such as GPU vs CPU
- AI backend status when AI features exist
Prefer:
- compact context strips
- breadcrumb-like state bars
- pane headers with inline state
- small visible status indicators close to where the work happens
Performance of GUI
### Main thread discipline
Never perform heavy work on the main UI thread.
Move off the main thread:
- file I/O
- network I/O
- long database work
- parsing
- expensive transformations
- chart recomputation
- image processing
- AI inference
- repeated bulk model rebuilds
The main UI thread should focus on:
- input handling
- layout
- paint
- lightweight state application
Do not put expensive work in:
- `paintEvent`
- resize handlers
- high-frequency timers
- repeated filter/search callbacks
- full-page refresh loops
Other Nuances: GUI
Code
## Code
- Prefer small, focused functions and explicit names.
- Naming should follow project or language conventions; if not defined locally, use `PascalCase` for classes, `camelCase` for methods/functions, and `snake_case` for variables.
- Prefer vertical alignment for grouped declarations/assignments using `:`, `=`, or similar separators when it improves readability and matches local style.
- Do not reformat unrelated code only to enforce alignment.
- Do not add dependencies or abstractions unless necessary.
- Do not introduce pattern-heavy indirection such as providers, factories, DI containers, or service locators unless clearly justified by real complexity.
- Do not create abstractions for hypothetical future use.
- Do not create interfaces, base classes, wrappers, or generic utilities unless there is a clear current need.
- Do not swallow errors silently.
- Add actionable logging at failure-prone boundaries.
Codex & Blog
I want you to explain the mental model with this as base:
- You are at a place in world. That is your state.
- Based on certain condition, you can take several actions in this state
- Based on other condition, you can choose to go other state, where you going to do the same action.
Draw visual diagrams.
Give examples, like a Matrix is the world, then cell is your state. Now given condition that you can move in X or Y direction, your next state will going in that certain direction.
Extend the example to trees, arrays etc.
Comments