Skip to content

Instantly share code, notes, and snippets.

View r0x0d's full-sized avatar
:shipit:
Working from home

Rodolfo Olivieri r0x0d

:shipit:
Working from home
View GitHub Profile
FROM registry.access.redhat.com/ubi10/ubi:latest AS base
ENV DNF_DEFAULT_OPTS -y --nodocs --setopt=keepcache=0 --setopt=tsflags=nodocs
RUN dnf install ${DNF_DEFAULT_OPTS} \
python3.12 \
python3.12-pip
FROM base as build
@r0x0d
r0x0d / new-argparse.diff
Last active June 5, 2025 17:15
claude 4 re-thought how our commands module should look like
diff --git a/command_line_assistant/commands/README.md b/command_line_assistant/commands/README.md
new file mode 100644
index 0000000..240428f
--- /dev/null
+++ b/command_line_assistant/commands/README.md
@@ -0,0 +1,345 @@
+# Simplified Command Structure
+
+This directory contains a simplified, elegant command structure inspired by typer/click but using argparse. The new structure eliminates complex class hierarchies, factories, and operations in favor of a clean decorator-based approach with two powerful patterns: **action handlers** and **subcommands**.
+
@r0x0d
r0x0d / client.py
Created June 2, 2025 19:22
Server and client example from dasbus lib
#
# Reply to a message in the chat room.
# Start the server, start the listener and run the client.
#
import threading
from dasbus.loop import EventLoop
from common import CHAT
event_stop = threading.Event()
@r0x0d
r0x0d / threaded-query-submission.diff
Last active June 3, 2025 11:18
Turn our query submission to work with threads and signaling
diff --git a/command_line_assistant/commands/chat.py b/command_line_assistant/commands/chat.py
index f50a7c0..d54c618 100644
--- a/command_line_assistant/commands/chat.py
+++ b/command_line_assistant/commands/chat.py
@@ -6,6 +6,7 @@ import platform
from argparse import Namespace
from enum import auto
from io import TextIOWrapper
+import threading
from typing import ClassVar, Optional
@r0x0d
r0x0d / terminal_reader.py
Created February 11, 2025 15:16
terminal reader with pty spawn
# Correct and working version
import argparse
import json
import os
import pty
import sys
class ScriptRecorder:
@r0x0d
r0x0d / post.md
Created January 8, 2025 01:12 — forked from vinicius73/post.md
["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

#["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

Se preparem que o texto é longo.

Várias vezes chegam novatos aqui perguntando como começar, e a galera diz "estuda lógica primeiro, depois vai pra linguagem X". Vivo dizendo que é bobagem. Ontem, em particular, falei isso, e vieram várias pessoas por inbox me perguntar porquê (e uma pra me xingar, achando que falei por arrogância).

Pra facilitar, eu vou escrever uma boa explicação de porquê "lógica de programação" é furada, doa a quem doer, e postar na APDA e no fórum da EnergyLabs (para futuras referências, porque esse assunto vai voltar, ctz).

import shutil
import time
from pathlib import Path
from typing import List, Tuple
from command_line_assistant.rendering.decorators.colors import ColorDecorator
from command_line_assistant.rendering.decorators.style import StyleDecorator
from command_line_assistant.rendering.decorators.text import (
EmojiDecorator,
TextWrapDecorator,
@r0x0d
r0x0d / t.py
Last active December 11, 2024 15:17
Small rendering library code call
import time
from command_line_assistant.rendering.decorators.colors import ColorDecorator
from command_line_assistant.rendering.decorators.text import (
EmojiDecorator,
TextWrapDecorator,
WriteOnceDecorator,
)
from command_line_assistant.rendering.renders.spinner import SpinnerRenderer
from command_line_assistant.rendering.renders.text import (
@r0x0d
r0x0d / gist:aeeedaeae1fe28782df7c62befd57ad7
Last active October 28, 2024 17:09
full list of dependencies + size
5.8G total
2.7G .venv/lib/python3.11/site-packages/nvidia
1.6G .venv/lib/python3.11/site-packages/torch
554M .venv/lib/python3.11/site-packages/triton
110M .venv/lib/python3.11/site-packages/faiss
91M .venv/lib/python3.11/site-packages/scipy
56M .venv/lib/python3.11/site-packages/gradio
53M .venv/lib/python3.11/site-packages/llama_index
51M .venv/lib/python3.11/site-packages/pandas
49M .venv/lib/python3.11/site-packages/transformers
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index fe80fba..894323b 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -44,6 +44,7 @@ android {
}
buildFeatures {
compose = true
+ viewBinding = true
}