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
{ | |
"body" : $input.json('$'), | |
"headers": { | |
#foreach($header in $input.params().header.keySet()) | |
"$header": "$util.escapeJavaScript($input.params().header.get($header))" #if($foreach.hasNext),#end | |
#end | |
}, | |
"method": "$context.httpMethod", | |
"params": { | |
#foreach($param in $input.params().path.keySet()) |
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
git reset <commit id> | |
git reset --soft HEAD@{1} | |
git commit -m "Revert to <commit id>" | |
git reset --hard |
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
var dns = require('dns'); | |
function getMxRecords(domain){ | |
return new Promise(function(resolve, reject) { | |
dns.resolveMx(domain, function (err, addresses) { | |
if (err) { | |
//console.log(err, err.stack) | |
resolve(null); | |
} |
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 json | |
import urllib | |
import re | |
def lambda_handler(event, context): | |
if 'cnpj' in event and _regex(event['cnpj']): | |
return json.loads(urllib.request.urlopen(_getUrlApi(event['cnpj'])).read()) | |
return json.loads("{\"status\": \"error\", \"message\": \"Formato incorreto\"}") |
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
var aws = require('aws-sdk'); | |
exports.handler = (event, context, callback) => { | |
var _returnMessage = ""; | |
var _destinationAddress, _sourceAddress = '[email protected]'; | |
var _defaultSubject = '[Subject]'; | |
var _defaultMessageData = '[Empty Message]'; | |
//params SES |
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
var aws = require('aws-sdk'); | |
var s3 = new aws.S3(); | |
exports.handler = (event, context, callback) => { | |
//Verifica se o objeto existe (chamada através de evento no S3) | |
if ((event) && (event.Records) && (event.Records[0]) && (event.Records[0].s3) && (event.Records[0].s3.bucket) && (event.Records[0].s3.object)){ | |
//Recupera informações de bucket e do objeto | |
var _bucket = event.Records[0].s3.bucket.name; |
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
//Using SDK | |
var aws = require('aws-sdk'); | |
var s3 = new aws.S3(); | |
//Define quais extensões serão aceitas no bucket | |
var _extensionsAllowed = ["txt", "csv"]; | |
//Define tamanho máximo e mínimo que serão aceitos (em bytes) | |
var _minFileSize = 20; var _maxFileSize = (1024*1024*2); |
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 boto3 | |
import re | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
if 'Records' in event: | |
bucket_object = event['Records'][0]['s3']['bucket']['name'] |
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 json | |
import urllib | |
import re | |
def lambda_handler(event, context): | |
if 'cep' in event and _regex(event['cep']): | |
return json.loads(urllib.request.urlopen(_get_url_api(event['cep'])).read()) | |
return json.loads("{\"erro\": true, \"mensagem\": \"Formato incorreto\"}") |
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
from typing import Dict | |
from requests import Session | |
from requests.exceptions import RequestException | |
class BaseApiClient: | |
__slots__ = ['uri', 'timeout', 'headers', 'session'] | |
uri: str | |
timeout: int |
OlderNewer