https://wiki.python.org.br/CookBook
This file contains hidden or 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
function calcularJurosCompostos(capitalInicial, taxaJuros, numeroPeriodos, valorAporte) { | |
let valorFuturo = capitalInicial; | |
for (let i = 0; i < numeroPeriodos; i++) { | |
valorFuturo = valorFuturo * (1 + taxaJuros) + valorAporte; | |
} | |
return valorFuturo; | |
} |
This file contains hidden or 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
/* | |
Script para ler todas as imagens desse diretório e criar um arquivo XML igual ao config.xml usado no jogo Football Manager 2024. Acredito que funcione para outras versões do jogo. | |
Exemplo de uso: | |
Copie a imagem para esse diretório e renomeie o arquivo para o id do jogador. | |
Execute o script com o comando: | |
node app.js |
This file contains hidden or 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
<?php | |
$pastaUpload = '/c:/wamp64-3.3.0-20230516/www/aps/uploads/'; | |
$endereco = 'http://localhost/aps/uploads/'; | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') { | |
// Check if file was uploaded without errors | |
if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) { | |
$uploadDir = $pastaUpload; // Directory to save uploaded files | |
This file contains hidden or 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
<html> | |
<head> | |
<title>Título do site</title> | |
</head> | |
<body> | |
<?php echo $conteudo; ?> | |
</body> | |
</html> |
This file contains hidden or 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
""" | |
ExecutionTime | |
This class is used for timing execution of code. | |
For example: | |
timer = ExecutionTime() | |
print 'Hello world!' | |
print 'Finished in {} seconds.'.format(timer.duration()) | |
""" | |
This file contains hidden or 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 peewee import * | |
import datetime | |
db = SqliteDatabase('banco_dados.sqlite') | |
class BaseModel(Model): | |
class Meta: | |
database = db | |
class Cotacao(BaseModel): |
This file contains hidden or 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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package bovespa; | |
import java.text.DateFormat; | |
import java.text.ParseException; | |
import java.text.SimpleDateFormat; |
This file contains hidden or 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 urllib.request import urlopen | |
import xml.etree.ElementTree as ET | |
link_xml = 'http://imgur.com/r/cosplay/top/day.xml'; | |
arq_xml = urlopen(link_xml) | |
xml = ET.parse(arq_xml) | |
items = [] | |
for item_xml in xml.findall('item'): | |
lista = { |
This file contains hidden or 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
<?php | |
function extract_link_from_text($text) | |
{ | |
//The Regular Expression filter | |
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(\/\S*)?/"; | |
// Check if there is a url in the text | |
if(preg_match($reg_exUrl, $text, $url)) { | |
return $url[0]; | |
} else { |
NewerOlder