Skip to content

Instantly share code, notes, and snippets.

View jjesusfilho's full-sized avatar
🏠
Working from home

José de Jesus Filho jjesusfilho

🏠
Working from home
View GitHub Profile
@jjesusfilho
jjesusfilho / llm-wiki.md
Created April 27, 2026 08:51 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@jjesusfilho
jjesusfilho / ds-project-organization.md
Created August 12, 2025 08:24 — forked from ericmjl/ds-project-organization.md
How to organize your Python data science project

UPDATE: I have baked the ideas in this file inside a Python CLI tool called pyds-cli. Please find it here: https://github.com/ericmjl/pyds-cli

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!

@jjesusfilho
jjesusfilho / .lintr
Created December 3, 2024 16:28 — forked from strengejacke/.lintr
VS Code setup for R
// save to windows-user directory
linters: with_defaults(object_name_linter = NULL,
object_length_linter(50),
commented_code_linter = NULL,
object_usage_linter = NULL,
line_length_linter(120),
cyclocomp_linter = cyclocomp_linter(50))
@jjesusfilho
jjesusfilho / sql_dump.R
Last active September 23, 2024 13:03
Faz dump de tabela SQL aos poucos.
#' Faz dump de uma tabela em arquivos rds
#'
#' @param conn Connexão
#' @param schema Schema
#' @param table Tabela
#' @param n Número de linhas arquivo
#' @param diretorio Diretório onde os arquivos serão salvos
#'
#' @details Esta função é particularmente útil para fazer dump de tabelas muito grandes
#'
@jjesusfilho
jjesusfilho / github_commits.R
Created August 19, 2024 01:15
Obtêm tabela de commits com data e autor.
#' Extrai tabela de commits realizados em repositório.
#'
#' @param owner Proprietário
#' @param repo Repositório
#' @param since data inicial no formato "yyyy-mm-dd". Padrão "1970-01-01"
#' @param until data final no formato "yyyy-mm-dd". Padrão data atual.
#' @param limit Número máximo de commits. Padrão para Inf.
#' @param ... Outros argumentos passados para `gh::gh`
#'
#' @return tibble
@jjesusfilho
jjesusfilho / dir_size.R
Created May 1, 2024 07:42
Retorna o tamanho dos diretórios
dir_size <- function(x){
purrr::map_dfr(x, purrr::possibly(~{
system(glue::glue("du -s {.x}"), intern = T) |>
stringr::str_split_1("\\s+") |>
setNames(c("tamanho","diretorio"))
},NULL)) |>
dplyr::mutate(tamanho = as.numeric(tamanho))
ibge_ftp <- paste0("https://ftp.ibge.gov.br/Trabalho_e_Rendimento/",
"Pesquisa_Nacional_por_Amostra_de_Domicilios_anual/",
"microdados/")
r1 <- ibge_ftp |>
httr2::request() |>
httr2::req_perform() |>
httr2::resp_body_html()
@jjesusfilho
jjesusfilho / compatibilizar_chromever.R
Last active January 26, 2024 20:54
Compatibiliza o chromdriver com o google chrome
#' Baixa e atualiza versão do chromedriver com a versão do chrome.
#'
#' @return OK!
#' @export
#'
compatibilizar_chromever <- function(){
driver <- binman::list_versions("chromedriver") |>
unlist() |>
utils::tail(1) |>
@jjesusfilho
jjesusfilho / openai_contar_tokens.R
Created January 10, 2024 17:16
Chama o tiktoken do python para contar os tokens.
#' Conta tokens de textos com base em modelos da OPENAI
#'
#' @param x Vetor de textos
#' @param modelo Modelo a ser utilizado.
#'
#' @details Para usar esta função você tem de ter instalado o pacote
#' tiktoken do Python, o qual será chamado via reticulate.
#'
#' @return Vetor com quantidade de tokens em cada texto.
#' @export
@jjesusfilho
jjesusfilho / msql_colacao.R
Last active December 18, 2023 20:28
Aplica colação ao SQL server para ignorar acentuação e caixa #'
msql_colacao <- function(conn, schema = NULL, table = NULL, ...){
dots <- rlang::ensyms(...) |>
purrr::map_chr(rlang::as_string)
### Verifica se as colunas existem
q <- glue::glue_sql("select top 0 * from {`schema`}.{`table`}", .con = conn)