Skip to content

Instantly share code, notes, and snippets.

View leo-tavares's full-sized avatar
🧐

Leo Tavares leo-tavares

🧐
View GitHub Profile
# Requer PowerShell 5.1+
# Caminho para a pasta com os arquivos .mp4
$inputFolder = "F:\Downloads\musicas"
$outputFolder = "F:\Downloads\musicas\M4A"
$maxParallelJobs = 5 # Número máximo de conversões simultâneas
# Criar pasta de saída se necessário
if (-not (Test-Path -Path $outputFolder)) {
New-Item -ItemType Directory -Path $outputFolder
@leo-tavares
leo-tavares / rolldie.py
Last active December 19, 2024 23:50
Simulação da rolagem de dados utilizando seaborn com ferramente de visualização
# Based on Deiltel book
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from random import randint
roll_dice = lambda : randint(1,6)
roll_times = int(sys.argv[1])
rolls = [roll_dice() for i in range(roll_times)]
{
"cars": [
{
"brand": "Fiat",
"model": "Palio",
"year": 2010,
"engine": "1.0 Flex",
"transmission": "Manual",
"image_url": null,
"description": "O Fiat Palio é um carro popular fabricado no Brasil desde 1996. Ele se destaca pelo bom custo-benefício e pela facilidade de manutenção."
@leo-tavares
leo-tavares / GenerateCodeCoverage.ps1
Last active May 10, 2023 01:29
Powershell script to generate a code coverage
#Steps
# Limpa os arquivos gerados pelos testes anteriores
# Executa os testes unitários com coleta de cobertura de código
# Verifica se os testes foram executados com sucesso
# Usa o resultado na ferramenta ReportGenerator
# Exibe o html
# Limpa os arquivos gerados pelos testes anteriores
$testResultsPath = ".\PathTo\TestResults\*\"
$codeCoverageDirPath = ".\PathTo\CodeCoverage\"
function caesarCipher(data, shift){
let encryptedData = "";
for (let idx in data) {
debugger;
const currentCharCode = data.charCodeAt(idx);
const newCharCode = currentCharCode + shift;
encryptedData += String.fromCharCode(newCharCode);
}
@leo-tavares
leo-tavares / createButton.js
Created December 15, 2020 00:38
O ojbetivo é varrer a lista e criar botões de acordo com o itens. Só vale usar o document.write
var listDeNomes = ["João", "Mario", "John", "Jane"];
for (var index = 0; index < listDeNomes.length; index++) {
var nome = listDeNomes[index];
createButton(nome);
}
function Alert(nome) {
alert(nome);
}
@leo-tavares
leo-tavares / createProduct.spec.ts
Last active November 20, 2020 20:49
Teste do serviço de criação de produtos
import AppError from '@shared/erros/AppError';
import FakeProductsRepository from '../repositories/fakes/FakeProductsRepository';
import CreateProductService from './CreateProductService';
let fakeProductsRepository: FakeProductsRepository;
let createProductService: CreateProductService;
describe('CreateProductService', () => {
beforeEach(() => {
fakeProductsRepository = new FakeProductsRepository();
@leo-tavares
leo-tavares / countLinesAndWords.js
Last active October 31, 2020 15:24
Function para contar numero de linhas e palavras - com readline do nodeJs
const fs = require("fs");
const readline = require("readline");
const { logError } = require("../../utils/error");
const countWordsAndLines = (pathToFile) => {
try {
const readableStream = fs.createReadStream(pathToFile, {
highWaterMark: 1, // 'limite' do buffer em bytes
});
const rl = readline.createInterface(readableStream);
@leo-tavares
leo-tavares / semantic-commit-messages.md
Last active November 21, 2020 00:21 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

{
"type": "postgres",
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "docker",
"database": "gostack_gobarber",
"migrations": ["./src/databse/migrations/*.ts"],
"cli": {
"migrationsDir": "./src/database/migrations"