This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save(self, *args, **kwargs): | |
if self.title.stock >= self.quantity: | |
self.title.stock -= self.quantity | |
super(Item, self).save(*args, **kwargs) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import multiprocessing | |
import os | |
import requests | |
######################################################################## | |
class MultiProcDownloader(object): | |
""" | |
Downloads urls with Python's multiprocessing module |
NewerOlder