Skip to content

Instantly share code, notes, and snippets.

View wilsonfreitas's full-sized avatar

Wilson Freitas wilsonfreitas

View GitHub Profile
@wilsonfreitas
wilsonfreitas / Oktoberfest.md
Created April 27, 2026 11:59
Resumo completo — Oktoberfest

📄 📌 Resumo completo — Oktoberfest (Munique)

Você pode copiar tudo abaixo 👇


🍺 Como funciona a Oktoberfest

  • A entrada é gratuita (não precisa de ingresso)
  • O que se reserva é mesa dentro de uma tenda
@wilsonfreitas
wilsonfreitas / llm-wiki.md
Created April 15, 2026 23:17 — 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.

@wilsonfreitas
wilsonfreitas / as.data.frame.R
Created September 26, 2025 08:40
newsletter #1
df <- as.data.frame(ds)
head(df)
#> # A tibble: 13,038 × 8
#> refdate symbol commodity maturity_code previous_price price price_change
#> <date> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 2023-01-04 ABEVOF… ABEVO F23 14.3 1.43e1 0.07
#> 2 2023-01-04 ABEVOG… ABEVO G23 14.4 1.45e1 0.08
#> 3 2023-01-04 AFSG23 AFS G23 17056 1.70e4 -101.
#> 4 2023-01-04 AFSH23 AFS H23 17093. 1.70e4 -101.
#> 5 2023-01-04 AFSJ23 AFS J23 17142. 1.70e4 -105.
@wilsonfreitas
wilsonfreitas / README.md
Created January 14, 2024 08:43
Download de curvas da B3 utilizando os códigos de curvas

Download de curvas da B3

library(rb3)

fname <- download_marketdata("TaxasReferenciais",
                             refdate = as.Date("2024-01-12"),
                             curve_name = "TR")
df &lt;- read_marketdata(fname, "TaxasReferenciais", TRUE)
class B3FilesURLDownloader(SingleDownloader):
calendar = bizdays.Calendar.load('ANBIMA.cal')
def download(self, refdate=None):
filename = self.attrs.get('filename')
refdate = refdate or self.get_refdate()
logging.info('refdate %s', refdate)
date = refdate.strftime('%Y-%m-%d')
url = f'https://arquivos.b3.com.br/api/download/requestname?fileName={filename}&date={date}&recaptchaToken='
res = requests.get(url)
msg = 'status_code = {} url = {}'.format(res.status_code, url)
@wilsonfreitas
wilsonfreitas / lru_cache.py
Created September 20, 2022 13:25 — forked from hughdbrown/lru_cache.py
Minimal lru_cache implementation for python 2.7
from functools import wraps
try:
from functools import lru_cache
except ImportError:
def lru_cache(user_function):
cache = {}
@wraps(user_function)
def wrapper(*args):
key = tuple(args)
@wilsonfreitas
wilsonfreitas / ft_gif.R
Created August 7, 2022 21:47 — forked from Athospd/ft_gif.R
Como gerar GIF com animação com R
f <- function(x) cos(x*20)
expi <- function(x) cos(x) + sin(x)*1i
par(mfrow = c(1,2))
L <- 40
medias_Re <- c()
fs <- c()
as <- seq(0.01, 1, l = 140)
animation::saveGIF({
for(a in as) {
@wilsonfreitas
wilsonfreitas / rb3-indexes-donuts.R
Created May 30, 2022 10:47
Indexes Composition in a Donuts Plot
library(rb3)
library(tidyverse)
top_weight <- function(.data, n = 10) {
top_10 <- .data |>
arrange(desc(weight)) |>
slice_head(n = n) |>
select(symbol, weight)
total_weight <- sum(top_10$weight)
others <- tibble(
@wilsonfreitas
wilsonfreitas / forwardrate-example.md
Created May 29, 2022 10:04
ForwardRate example - fixedincome package

forwardrate method, for a SpotRateCurve and with arguments t1 and t2, computes the forward rate between two future terms that exist in the term structure.

library(rb3)
library(fixedincome)

df_yc <- yc_get("2022-05-20")

crv &lt;- spotratecurve(
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled0.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyNsy4RaWWJJXRN8opuCmESy",
"include_colab_link": true