Skip to content

Instantly share code, notes, and snippets.

View rhenter's full-sized avatar

Rafael Henter rhenter

View GitHub Profile
@rhenter
rhenter / base_print.html
Last active August 8, 2020 10:48
Imprimir para PDF
{% load i18n %}
{% load l10n %}
{% load static %}
{% load app_utils %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
@rhenter
rhenter / mixins.py
Last active September 18, 2020 21:28
Mixins de Busca e Filtros e exemplo de como fazer uma buscar e um filtro pegando da URL usando Django
import operator
from functools import reduce
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import models
from django.views.generic import ListView
from django.views.generic.base import ContextMixin
from django_stuff.utils import remove_special_characters
from quotation_project.utils import clean_url
@rhenter
rhenter / form_paginate_by.html
Created September 18, 2020 21:23
Includes de Paginação e busca para Django usando Bootstrap
{% load i18n %}
<div class="card-tools">
<form class="form-inline" action="." method="GET">
<div class="input-group input-group-sm" style="margin-left: 20px;">
<label for="id_paginate" style="margin-right: 5px;">{% trans "Show" %}</label>
<select class="form-control" name="paginate_by" id="id_paginate" onchange="this.form.submit()">
{% for pages in range_pagination %}
{% if paginate_by == pages %}
<option selected="selected">{{ pages }}</option>
@rhenter
rhenter / .env.example
Last active April 6, 2025 14:32
Creating a Simple Chatbot using OpenAI API using Python
# Rename this file to .env and replace the value below with your actual API key
OPENAI_API_KEY="your-api-key-here"
import os
from pathlib import Path
from typing import Union, Dict, List
from concurrent.futures import ThreadPoolExecutor
class PDFCrawler:
def __init__(self, source: Union[str, Path, Dict[str, Union[str, Path]]], max_workers_per_folder: int = 4):
self.source_paths: List[Path] = self._parse_source(source)
self.max_workers_per_folder = max_workers_per_folder