Skip to content

Instantly share code, notes, and snippets.

View willy-r's full-sized avatar
👋
Hello, there!

William Rodrigues willy-r

👋
Hello, there!
  • Pacujá, Ceará, Brazil
View GitHub Profile

Propostas de aulas sobre Typing

  1. Anotação de funções - PEP-3107
    • Fundamentos da anotação de tipos
    • Sintaxe
      • Parametros
      • Retornos
    • __annotations__
    • Casos de uso
  • typing
def sub_length(arr):
"""
Given an array of n integers, find the length of the longest increasing subsequence
:param arr: The array to parse
:return: the length of the longest increasing subsequence
"""
if not arr:
return 0
longest_streak = 1
@morvanabonin
morvanabonin / comandos-docker
Last active June 20, 2024 19:02
Comandos do Docker
Segue a lista de comandos docker e sua utilidade:
docker attach – Acessar dentro do container e trabalhar a partir dele.
docker build – A partir de instruções de um arquivo Dockerfile eu possa criar uma imagem.
docker commit – Cria uma imagem a partir de um container.
docker cp – Copia arquivos ou diretórios do container para o host.
docker create – Cria um novo container.
docker diff – Exibe as alterações feitas no filesystem do container.
docker events – Exibe os eventos do container em tempo real.
docker exec – Executa uma instrução dentro do container que está rodando sem precisar atachar nele.
@heitorlessa
heitorlessa / example_minio_boto3.py
Created August 30, 2016 14:18
Minio with python boto3
# Sample as to how to initialize s3 client to work with Minio API compatible - https://github.com/minio/minio
# AWS CLI counterpart - https://docs.minio.io/docs/aws-cli-with-minio
import boto3
s3 = boto3.resource('s3',
endpoint_url='http://<minio_IP>:9000',
config=boto3.session.Config(signature_version='s3v4')
)
@YuMS
YuMS / update-git.sh
Created June 29, 2016 09:28
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@luzfcb
luzfcb / configurar_pyenv.md
Last active June 11, 2024 15:17
instalar pyenv no ubuntu
@FrancesCoronel
FrancesCoronel / sampleREADME.md
Last active March 26, 2024 01:21
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@joshkehn
joshkehn / forms.py
Created June 26, 2013 17:35
Ingredient ModelForm (Django)
from django import forms
from menu.models import Ingredient, Diet, FoodPreference
class IngredientForm (forms.ModelForm):
class Meta:
model = Ingredient
exclude = ["franchise"]
def __init__ (self, *args, **kwargs):
brand = kwargs.pop("brand")
@obeattie
obeattie / db_utils.py
Created October 14, 2009 12:51
Exposes SQLAlchemy's sessions and transactions as context managers (so they will be managed automatically inside blocks), and also provides a transaction decorator, which wraps an entire function in a transaction
"""Utilities for managing database sessions."""
from __future__ import with_statement
import contextlib
import functools
@contextlib.contextmanager
def temp_session(session_cls, **kwargs):
"""Quick and dirty context manager that provides a temporary Session object
to the nested block. The session is always closed at the end of the block.