Skip to content

Instantly share code, notes, and snippets.

@iedsilva
iedsilva / gist:aff0cb134d82bfda857017f65c0159eb
Created November 12, 2024 17:44
Exemplo requisição criar clientes
curl --location 'https://mide-sandbox.smartprop.club/api/v1/clients/multiple' \
--header 'Content-Type: application/json' \
--header 'authorization: Bearer {{api key}}' \
--data-raw '{
"data" : [
{
"NOME": "Rebeca Nunes",
"DATA" : "01/01/2024",
"DATA NASCIMENTO": "27/03/1981",
"CPF/CNPJ": "03.892.764/0001-27",
@iedsilva
iedsilva / validarRenavam.js
Last active March 18, 2020 16:54 — forked from cagartner/validarRenavam.js
Função para validar Renavam, Valida Renavam, Verifica Renavam
var Renavam = Renavam || {};
/**
* Função para validar sequencia de digitos de Renavam
*
* Função baseada em uma classe java retirada desse link
* @link http://blog.victorjabur.com/2010/05/28/renavam_veiculos_java/
* @link http://www.denatran.gov.br/download/Portarias/2013/PORTARIA%20%2027%20-%2013.pdf
* @param {String|int} renavam Sequencia de digitos do renavam
* @return {Boolean}
@iedsilva
iedsilva / gist:7ee793f14231ee7706b9fe229e381b7f
Last active October 3, 2019 14:14
Monitoramento de disco e memória AWS
sudo su
yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
cd /opt
unzip CloudWatchMonitoringScripts-1.2.2.zip && \
rm CloudWatchMonitoringScripts-1.2.2.zip && \
cd aws-scripts-mon
@iedsilva
iedsilva / encrypt-decrypt.js
Created September 4, 2019 20:39
Encryption and decryption with AES-256-cbc in node.js
var crypto = require('crypto')
, key = 'your secret key here'
, plaintext = 'Text to be encrypted'
, cipher = crypto.createCipher('aes-256-cbc', key)
, decipher = crypto.createDecipher('aes-256-cbc', key);
var encryptedPassword = cipher.update(plaintext, 'utf8', 'base64');
encryptedPassword += cipher.final('base64')
var decryptedPassword = decipher.update(encryptedPassword, 'base64', 'utf8');
@iedsilva
iedsilva / onesignal-node.js
Created July 12, 2019 22:14 — forked from mulhoon/onesignal-node.js
Send a push notification in node with OneSignal
var request = require('request');
var sendMessage = function(device, message){
var restKey = '****';
var appID = '****';
request(
{
method:'POST',
uri:'https://onesignal.com/api/v1/notifications',
headers: {
@iedsilva
iedsilva / webstoemp-gulpfile.js
Created May 23, 2019 22:16 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@iedsilva
iedsilva / Instalar NPM
Last active June 8, 2018 00:49 — forked from nghuuphuoc/gist:7398312
Install npm, nodejs on Centos 6
# Enable Fedora Extra Packages for Enterprise Linux (EPEL) repos
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# Install npm from the epel repos
$ sudo yum install npm --enablerepo=epel
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@iedsilva
iedsilva / gist:b5abae8313a02f2965d0cfd602fefe9a
Last active April 9, 2018 13:37
Configuração S3 + Express + Nginx para upload de arquivos
#S3
var s3 = new AWS.S3({
httpOptions: {
timeout: 200000000
}
});
#express
apiRoutes.post('/files', function (req, res) {
req.setTimeout(0);
var AWS = require('aws-sdk');
AWS.config.region = 'your aws region';
AWS.config.update({
accessKeyId: "your access id",
secretAccessKey: "your secret access key",
});
var sns = new AWS.SNS();
var params = {
@iedsilva
iedsilva / send_sms.js
Created April 5, 2018 17:00 — forked from bachvtuan/send_sms.js
Send SMS Amazon SNS Nodejs
/**
* @Author: bachvtuan@gmail.com
* to_number: String : user phone number
* message: String : sms message
* func_callback: function : callback function( status )
* Reference links :
* https://gist.github.com/stuartmyles/8099723
* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#deleteTopic-property
*/