in source serverless.yaml file add. This account no is 111100001111
resources:
Resources:
LambdaResourcePolicy:
Type: AWS::Lambda::Permission
node: Platform built on V8 to build network applications | |
git: Distributed revision control system | |
wget: Internet file retriever | |
yarn: JavaScript package manager | |
python3: Interpreted, interactive, object-oriented programming language | |
coreutils: GNU File, Shell, and Text utilities | |
awscli: Official Amazon AWS command-line interface | |
automake: Tool for generating GNU Standards-compliant Makefiles | |
youtube-dl: Download YouTube videos from the command-line | |
readline: Library for command-line editing |
map.forEach((k, v) -> System.out.println(k + "=" + v)); | |
for (Map.Entry<?, ?> entry : m.entrySet()) { | |
System.out.println(entry.getKey() + " = " + entry.getValue()); | |
} | |
Iterator it = m.entrySet().iterator(); | |
while (it.hasNext()) { | |
Map.Entry pairs = (Map.Entry)it.next(); | |
System.out.println(pairs.getKey() + " = " + pairs.getValue()); |
/* eslint-env jest */ | |
'use strict' | |
const { read, keys } = require('../sreda') | |
const AWS = require('aws-sdk') | |
let ssm = new AWS.SSM() | |
var ssmPromise = { | |
promise: jest.fn().mockImplementation((request) => { | |
return new Promise((resolve, reject) => { |
// if you see anywhere in js file that fetch is not defined. | |
// then use following to fix | |
global.fetch = require('node-fetch') |
// The Async/Await section spreads some misinformation and bad practices. It explains that try/catch must be used whenever an await expression is used, but that is not the case. For example, this snippet: | |
function getGithubUser(username) { | |
return new Promise((resolve, reject) => { | |
fetch(`https://api.github.com/users/${username}`) | |
.then(response => { | |
const user = response.json(); | |
resolve(user); | |
}) | |
.catch(err => reject(err)); |
async getUrlInfo(url: string) { | |
const reg = new RegExp("https?://([a-z0-9]+[.])*.?ea[.]com"); | |
const reg2 = new RegExp("^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$"); | |
async function reachability() { | |
const responseReachable: any = await fetch(url, {method: 'HEAD'}).catch(() => false); | |
return responseReachable.status === 200; | |
} | |
return { |
const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(''); | |
function generatePassword(L){ | |
return Array.from({length: L}) | |
.map(i => alphabet[Math.floor(Math.random() * alphabet.length)]) | |
.join("") | |
} | |
console.log(generatePassword(14)); |
const crypto = require('crypto'); | |
const algorithm = 'aes256'; | |
const salt = '900150983cd24fb0d6963f7d28e17f72'; | |
const cryptoEncoding = 'base64'; | |
const cipher = crypto.createCipher(algorithm, salt); | |
const encryptedText = cipher.update(text, 'utf8', cryptoEncoding) + cipher.final(cryptoEncoding); | |
-- Make sure whatever _order is passed, is selected in SELECT. | |
@delimiter %%%; | |
CREATE PROCEDURE prime1(_order VARCHAR(32)) NOT DETERMINISTIC READS SQL DATA | |
BEGIN | |
SET @order = _order; | |
SELECT ID, TITLE, SUMMARY FROM articles a ORDER BY | |
CASE WHEN _order = 'SUMMARY ASC' THEN SUMMARY END ASC, | |
CASE WHEN _order = 'ID ASC' THEN ID END ASC, | |
CASE WHEN _order = 'TITLE ASC' THEN TITLE END ASC, |