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
truncate -s 0 /var/lib/docker/containers/*/*-json.log |
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
docker rmi $(docker images -f dangling=true -q) --force |
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
import fs from 'fs'; | |
import readline from 'readline'; | |
async function process() { | |
return new Promise((resolve, reject) => { | |
let stream = fs.createReadStream('/tmp/file.txt'); | |
let rl = readline.createInterface({ | |
input: stream | |
}); |
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
mongoexport --host localhost --db database -u user -p pass \ | |
--collection cdrs --query '{}' --limit 10 --out /tmp/export.json \ | |
--jsonArray --pretty |
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
import winston from 'winston'; | |
const logger = new (winston.Logger) ({ | |
'transports': [new (winston.transports.Console)({ | |
'colorize': true, | |
'prettyPrint': true, | |
'timestamp': () => moment().tz('America/Sao_Paulo').format('YYYY-MM-DD HH:mm:ss'), | |
})] | |
}); |
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 numberToMoney(fixed = 2, value) { | |
if (!value || typeof value != 'number') { | |
throw new Error("´value´ is not set"); | |
} | |
let formatted = value.toFixed(fixed).replace('.', ',').split(','); | |
let final = []; | |
if (formatted[0].length > 3) { | |
for (let i = formatted[0].length - 1; i >= 0; i--) { |
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
#!/bin/bash | |
export server="https://sms-api-pointer.pontaltech.com.br/v1/single-sms" | |
export token="$1" | |
export number="$2" | |
export message="$3" | |
export numbers=(${number//,/ }) | |
for i in "${!numbers[@]}" | |
do |
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
#!/bin/bash | |
args=("$@") | |
token=${args[0]} | |
number=${args[1]} | |
message=${args[2]} | |
numbers=(${number//,/ }) | |
for i in "${!numbers[@]}" |