Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍

André Girol girol

🐍
View GitHub Profile
View utils.api.exception_handler.py
from functools import wraps
from marshmallow import ValidationError
from mensageria.backends.exceptions import BackendException
from mensageria.core.exceptions import (
BackendNotFoundException,
ConfigurationNotFoundException,
)
View dec.py
from decimal import *
PLACES = Decimal(10) ** -6
option1 = Decimal("1000.1111")
option2 = Decimal("300.2222")
option3 = Decimal("500.3333")
total = option1 - option2 - option3
View gols.py
jogos = range(1,6)
total_1t = total_2t = 0
for j in jogos:
gols_1t = int(input(f"Quantos gols no jogo {j} no primeiro tempo? >>> "))
gols_2t = int(input(f"Quantos gols no jogo {j} no segundo tempo? >>> "))
total_1t += gols_1t
total_2t += gols_2t
media_1t = total_1t/5
@girol
girol / python.json
Created Feb 9, 2022
vscode_python_snippets
View python.json
{
"if": {
"prefix": "if",
"body": [
"if ${1:expression}:",
"\t${2:pass}"
],
"description": "Code snippet for an if statement"
},
"if/else": {
@girol
girol / Dockerfile
Created Jan 23, 2022
sample-docker
View Dockerfile
FROM nginx:alpine
COPY index.html /usr/share/nginx/html
@girol
girol / app.py
Last active Mar 10, 2020
Python script SystemD example
View app.py
from time import sleep
import os
hi = os.environ.get('HELLO')
seconds = 1
while(True):
sleep(1)
print("logging...", seconds, "Env Var: ", hi)
@girol
girol / term_colors
Created Sep 11, 2018
Terminal Colors
View term_colors
default="\033[39m"
black="\033[30m"
red="\033[0;31m"
green="\033[32m"
yellow="\033[33m"
blue="\033[34m"
magenta="\033[35m"
cyan="\033[36m"
gray="\033[90m"
@girol
girol / post-receive
Created Apr 20, 2018
Git Hook Composer Autoloader
View post-receive
#/bin/bash
export GIT_WORK_TREE=/folder/to/my/app # like /var/www
#export GIT_DIR=/my/repo.git
git checkout -f master
cd $GIT_WORK_TREE
composer dump-autoload
@girol
girol / .bashrc_ps1
Last active Aug 18, 2018
Custom Bash PS1
View .bashrc_ps1
# Hostname hardcoded for weird hosting names
# Generates a nice hostname for use in hosting services that creates random users and random nameservers
#
# Helps to track whare you are logged in when using ssh
#
# Generated with: http://ezprompt.net/
export PS1="\[\e[36m\]hostname\[\e[m\]:\W\[\e[34m\] \$\[\e[m\] "
View vscode_settings.json
{
"workbench.colorTheme": "Hackerman",
"files.trimTrailingWhitespace": true,
"workbench.colorCustomizations": {
"editor.background": "#000",
"editorRuler.foreground": "#08ae6e95",
"statusBar.background": "#000",
},
"terminal.integrated.fontSize": 14,
"window.zoomLevel": 1,