Skip to content

Instantly share code, notes, and snippets.

View fchevitarese's full-sized avatar

Frederico Rodrigues Chevitarese fchevitarese

  • Vila Velha
  • 18:35 (UTC -03:00)
View GitHub Profile
medida = int(input('Digite a medida (em metros): '))
if medida <= 0:
print(f'Esta medida {str(medida)} é inválida', end='')
else:
mt = 'metro'
cm = 'centimetro'
mil = 'milimetro'
if medida > 1:
Id_Externo Nome_do_Produto Quantidade_Venda_Acumulada Preco_Praticado Preco_Calculado
20.4010.00325 LAV CONS. CWH11A 11KG 110V BR 3
20.2010.00586 TV LG LED 43LK5750PSA SMART FULL HD HDMI USB 3
20.2010.00583 TV SEMP LED 32S3900S SMART WI-FI HDMI USB 10
11.1010.00716 CJ ORTOBOM UNION NEW DREAM ORTOP. 138X188 BLACK 25
20.3010.00383 RF CONS. CRD46A 2PT 415L 110V C.DEFROST 0
20.2010.00582 TV TCL LED 43S6500FS SMART FULL HD WI-FI HDMI USB 3
10.4030.00954 SF HELLEN BENETON 3X2LUGS SUEDE CASTOR AMASS 0
20.4010.00293 LAV SUGGAR LAVAMAX ECO 10KG BR 59
11.1010.00863 COL E ORTOBOM LIGTH D33 88X188X14 BRANCO 44
@fchevitarese
fchevitarese / autoexec.cfg
Created January 30, 2019 12:56 — forked from oswaldoacauan/autoexec.cfg
CS:GO - Useful binds
// Some useful binds for CS:GO
// ===================
// Launch Options: -console -novid -high -tickrate 128 -freq 144 +exec autoexec.cfg
// by Lamarkz
// Show damage given in the console
// ===================
developer "1"
con_filter_text "Damage given"
con_filter_text_out "Player:"
@fchevitarese
fchevitarese / boto_dynamodb_methods.py
Created May 25, 2018 02:50 — forked from martinapugliese/boto_dynamodb_methods.py
Some wrapper methods to deal with DynamoDB databases in Python, using boto3.
# Copyright (C) 2016 Martina Pugliese
from boto3 import resource
from boto3.dynamodb.conditions import Key
# The boto3 dynamoDB resource
dynamodb_resource = resource('dynamodb')
def get_table_metadata(table_name):
@fchevitarese
fchevitarese / mongodb-s3-backup.sh
Created March 29, 2018 15:36 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@fchevitarese
fchevitarese / docker_mint18.sh
Created March 17, 2018 02:31 — forked from mcmaur/docker_mint18.sh
Install Docker on Linux Mint 18 Sylvia
#remove old
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
def save(self, *args, **kwargs):
if self.title.stock >= self.quantity:
self.title.stock -= self.quantity
super(Item, self).save(*args, **kwargs)
def email(request):
form = EmailForm(request.POST or None)
if form.is_valid():
email = form.cleaned_data.get("email")
created, perfil = Perfil.objects.get_or_create(email=email)
if created:
print('novo usuário')
return redirect('/cadastro/cadastro') # Está muito estranha essa url.
else:
from bs4 import BeautifulSoup
import requests
resp = requests.get(url)
soup = BeautifulSoup(resp.text, 'lxml') # Usa ele porque é mais rápido
for name in soup.findAll('td', {'class': 'label'}):
print(name.text) # Printa o texto
print(name.get_text()) # Printa também
@fchevitarese
fchevitarese / multiprocessing.py
Created March 2, 2017 15:07 — forked from rcaldwel/multiprocessing.py
python: multiprocessing example
#!/usr/bin/env python
import multiprocessing
import os
import requests
########################################################################
class MultiProcDownloader(object):
"""
Downloads urls with Python's multiprocessing module