$ node ./removeDuplicateFilesCli.js
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
/** | |
* @param {number} num | |
* @returns {string} | |
*/ | |
function formatMoney(num) { | |
return `R$ ${num | |
.toFixed(2) | |
.replace('.', ',') | |
.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$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
const fs = require("fs"); | |
const path = require("path"); | |
const crypto = require("crypto"); | |
const stream = require("stream/promises"); | |
const readline = require("readline"); | |
const { totalmem } = require("os"); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, |
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
const SALARIO_MINIMO_MENSAL = 1320; | |
/** | |
* @param {number} valor | |
* @param {number} casaDecimais (para o valor `10.2345678`, usar 0 => 10, 1 => 10.2, 2 => 10.23, 3 => 10.235) | |
*/ | |
function arredondar(valor, casasDecimais) { | |
const multiplicador = Math.pow(10, casasDecimais); | |
return Math.round(valor * multiplicador) / multiplicador; | |
} |
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
import java.awt.Color | |
/** | |
* Got from https://play.kotlinlang.org/#eyJ2ZXJzaW9uIjoiMS44LjEwIiwicGxhdGZvcm0iOiJqYXZhIiwiYXJncyI6IiIsIm5vbmVNYXJrZXJzIjp0cnVlLCJ0aGVtZSI6ImlkZWEiLCJjb2RlIjoiaW1wb3J0IGphdmEuYXd0LkNvbG9yXG4vKipcbiAqIFlvdSBjYW4gZWRpdCwgcnVuLCBhbmQgc2hhcmUgdGhpcyBjb2RlLlxuICogcGxheS5rb3RsaW5sYW5nLm9yZ1xuICovXG5mdW4gbWFpbigpIHtcbiAgICB2YWwgcmdiOiBJbnQgPSAweDFmOGI1NFxuICAgIFxuICAgIHZhbCByZ2JSZWRDb2xvcjogSW50ID0gKHJnYiBzaHIgMTYpIGFuZCAweEZGXG4gICAgdmFsIHJnYkdyZWVuQ29sb3I6IEludCA9IChyZ2Igc2hyIDgpIGFuZCAweEZGXG4gICAgdmFsIHJnYkJsdWVDb2xvcjogSW50ID0gcmdiIGFuZCAweEZGXG4gICAgXG4gICAgdmFsIGdiclJlZENvbG9yOiBJbnQgPSByZ2IgYW5kIDB4RkZcbiAgICB2YWwgZ2JyR3JlZW5Db2xvcjogSW50ID0gKHJnYiBzaHIgOCkgYW5kIDB4RkZcbiAgICB2YWwgZ2JyQmx1ZUNvbG9yOiBJbnQgPSAocmdiIHNociAxNikgYW5kIDB4RkZcbiAgICBcbiAgICB2YWwgZ2JyOiBJbnQgPSAocmdiUmVkQ29sb3IgYW5kIDB4RkYpIG9yICgocmdiR3JlZW5Db2xvciBhbmQgMHhGRikgc2hsIDgpIG9yICgocmdiQmx1ZUNvbG9yIGFuZCAweEZGKSBzaGwgMTYpXG4gICAgXG5cdHByaW50bG4oXCJSR0IgIyR7cmdiLnRvU3RyaW5nKDE2KX0sICRyZ2IgKFtyOiAkcmdiUmVkQ29sb |
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
const toCurrency = num => num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$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
/** | |
* | |
* @param {string} str | |
*/ | |
function base64(str) { | |
const base64Characters = [ | |
"A", | |
"B", | |
"C", | |
"D", |
Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma
You can get the list of supported formats with:
ffmpeg -formats
Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:
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
/** | |
* If you want to use it, you first need to install | |
* Deno at https://deno.land and run: | |
* deno https://gist.github.com/uqmessias/66f3de0da2f60419b39f26ca243f3e2a/raw 222 | |
*/ | |
function throwError(wrongArgument = null) { | |
const argumentError = | |
wrongArgument === null | |
? "" | |
: `"${wrongArgument}" is not a valid argument!\n\n`; |
NewerOlder