Skip to content

Instantly share code, notes, and snippets.

View luizomf's full-sized avatar
🙃
Segue programando =)

Luiz Otávio luizomf

🙃
Segue programando =)
View GitHub Profile
@luizomf
luizomf / commands.sh
Last active May 28, 2025 11:12
Instalação Python 3.10 Ubuntu 22.04
sudo apt update -y
sudo apt upgrade -y
sudo apt install git curl build-essential -y
sudo apt install gcc make default-libmysqlclient-dev libssl-dev -y
sudo apt install python3.10-full python3.10-dev -y
@luizomf
luizomf / structural_pattern_matching.py
Created September 4, 2022 16:12
Structural Pattern Matching - Python Examples
from dataclasses import dataclass
def execute_command(command):
if command == 'ls':
print('$ listing files')
elif command == 'cd':
print('$ changing directory')
else:
print('$ command not implemented')
@luizomf
luizomf / settings.json
Last active May 28, 2025 11:28
VS Code Python and Code Runner Settings for Windows
{
"window.zoomLevel": 5,
"editor.formatOnSave": true,
"code-runner.executorMap": {
"python": "clear ; .\\venv\\Scripts\\python.exe"
},
"code-runner.runInTerminal": true,
"code-runner.clearPreviousOutput": true,
// Python
"[python]": {
@luizomf
luizomf / upscale_1080p_to_4k_using_ffmpeg.md
Last active October 31, 2025 19:42
Upscale 1080p to 4k using ffmpeg

Upscale 1080p to 4k using ffmpeg

Just use the command below:

ffmpeg -i INPUT_FILE \
  -vf scale=3840x2160:flags=lanczos \
  -c:v libx264 \
  -crf 13 \
 -c:a aac -b:a 512k \
@luizomf
luizomf / point.py
Created August 9, 2022 10:59
Implementação dos métodos mágicos para matemática em Python.
class Point:
"""
>>> p1 = Point(8, 6)
>>> p2 = Point(2, 3)
>>> p1 + p2
Point(10, 9)
>>> p1 - p2
Point(6, 3)
>>> p1 / p2
Point(4.0, 2.0)
@luizomf
luizomf / simple_metaclass.py
Last active August 7, 2022 07:54
Metaclass example in Python.
class Meta(type):
def __new__(mcs, name, bases, namespace):
namespace['adicionei'] = 'um valor'
cls = super().__new__(mcs, name, bases, namespace)
for base in bases:
for key, value in base.__dict__.items():
if getattr(value, '__is_abstract__', False):
if key not in cls.__dict__.keys():
@luizomf
luizomf / README.md
Created July 25, 2022 11:23
Python Type Annotations Examples

Type annotations em Python

Observação: estou usando o Python 3.10.

O que é Type Annotation? São partes do código usadas para indicar tipos de dados em locais como: variáveis, parâmetros e retornos de funções e métodos. Em Python isso é usado para documentação e ajuda com auto completar dos editores, visto que a linguagem não impede a execução do código mesmo se as anotações estiverem incorretas.

@luizomf
luizomf / python-iterable-iterator.py
Last active July 14, 2022 14:25
python-iterable-iterator.py
class MinhaLista:
def __init__(self):
self.__data = {}
self.__index = 0
self.__next_index = 0
def add(self, *values):
for value in values:
self.__data[self.__index] = value
self.__index += 1
@luizomf
luizomf / vite-vitest-react.md
Last active June 21, 2023 21:59
Vitest and JavaScript for React

Creating a boilerplate for React 18 in ViteJS

Editorconfig

If your are using editorconfig, this is my config:

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
@luizomf
luizomf / login.js
Created March 31, 2022 12:26
Exemplo de uso da API criada com Django Rest Framework com JavaScript.
(async function() {
console.clear();
const headers = {
'Content-Type': 'application/json',
};
const body = JSON.stringify({
"username": "joanadarc",
"password": "Abc@12345678"
});
const config = {