Skip to content

Instantly share code, notes, and snippets.

View RenanMatias's full-sized avatar
🖖

Renan Matias RenanMatias

🖖
  • TOTVS
  • Rio de Janeiro
View GitHub Profile
@RenanMatias
RenanMatias / how_to_get_key_file_CGP.md
Created September 19, 2022 22:29
Create a Google Cloud Platform Service Account Key

Create a new key file

To access service account with Google Cloud console.

  1. In the Google Cloud console, go to the Service accounts page.
  2. Select a project.
  3. On the Service accounts page, click the email address of the service account whose keys you want to list.
  4. Click Keys. The Google Cloud console displays a list of keys for the service account.

Criando App no Sharepoint para capturar o Access Token

Passo 1 - Registrar um Aplicativo

  • Acessar a URL https://{site_url}/sites/[TENANT-NAME]/_layouts/15/appregnew.aspx
    • [TENANT-NAME] - é nome do site, podendo conter o subsite
  • Em ID do Cliente, clicar em Gerar/Generate;
  • Copiar o ID gerado e salvar em algum lugar seguro;
  • Em Segredo do Cliente, clicar em Gerar/Generate;
  • Copiar o Segredo gerado e salvar em algum lugar seguro;
  • Em Título, inserir um nome de identificação. Atualmente estou colocando Performance CSC;
  • Em Domínio do Aplicativo, pode inserir qualquer site, não faz diferença. Atualmente estou colocando google.com
@RenanMatias
RenanMatias / README.md
Created July 30, 2022 12:10
Python Type Annotations Examples - By luizomf

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.

@RenanMatias
RenanMatias / SUPORTE.md
Last active February 15, 2023 17:22
CONFIGURA TUDO

Key Generator

python -c "import string as s; from random import SystemRandom as sr; print(''.join(sr().choices(s.ascii_letters + s.punctuation, k=64)))"
@RenanMatias
RenanMatias / Ambiente Virtual.md
Last active May 3, 2022 17:21
Django - Configurações Iniciais

Iniciando um projeto Django

Criando um ambiente virtual no Ubuntu 20.04

  1. Pelo temrinal, acesso a pasta do projeto;
  2. Execute o comando, utilizando a versão do python desejada:
python3.10 -m venv venv
  1. Ative o ambiente virtual:
. venv/bin/activate

Se você usa MacOS

O macOs roda sobre Darwin OS (kernel XNU), que é um sistema UNIX-like. Então, todos os comandos abaixo também funcionam normalmente no MacOS. Recomendo utilizar o gerenciador de pacotes homebrew caso necessário instalar algo. Se quiser o mesmo terminal que eu (ZSH com Oh My ZSH), utilize este vídeo para configurar https://youtu.be/bs1-Wxb_KIc

Se você usa Windows

No Windows é possível utilizar o wsl2 e instalar uma versão do linux para acompanhar. Eu fiz alguns vídeos para você usar o Linux no Windows.

NGINX HTTPS

Reference

https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/

Replaces

  • ____REPLACE_ME_WITH_YOUR_OWN_DOMAIN____ = Replace with your domain
  • __PROJECT_FOLDER__ = Replace with the path to the folder for the project
  • __STATIC_FOLDER_PATH__ = Replace with the path to the folder for static files
  • __MEDIA_FOLDER_PATH__ = Replace with the path to the folder for media files
  • __SOCKET_NAME__ = Replace with your unix socket name
@RenanMatias
RenanMatias / nginx-http.md
Last active April 16, 2022 00:18
Configuração do NGINX HTTP

NGINX HTTP

Reference

https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/

Replaces

  • ____REPLACE_ME_WITH_YOUR_OWN_DOMAIN____ = Replace with your domain
  • __PROJECT_FOLDER__ = Replace with the path to the folder for the project
  • __STATIC_FOLDER_PATH__ = Replace with the path to the folder for static files
  • __MEDIA_FOLDER_PATH__ = Replace with the path to the folder for media files
  • __SOCKET_NAME__ = Replace with your unix socket name

Gunicorn

Replace

  • ___GUNICORN_FILE_NAME___ to the name of the gunicorn file you want
  • __YOUR_USER__ to your user name
  • __PROJECT_FOLDER__ to the folder name of your project
  • __WSGI_FOLDER__ to the folder name where you find a file called wsgi.py

Criando o arquivo GUNICORN_FILE_NAME.socket

Deploy

Aqui estão os dados de referência para deploy de uma aplicação Django, de acordo com as aulas do meu curso de Django na Udemy.

Criando um servidor

Como vamos usar um servidor na nuvem (cloud server), é interessante que você utilize algum serviço gratuito para isso. Recomendo a Google Cloud Platform.