Skip to content

Instantly share code, notes, and snippets.

View AshanthaLahiru's full-sized avatar
🎯
Focusing

Ashantha Lahiru AshanthaLahiru

🎯
Focusing
View GitHub Profile
com.amazonaws.auth.AWSCredentials credentials_tSQSConnection_1 = new com.amazonaws.auth.BasicAWSCredentials("abcdefghijklmnopqrst",decryptedPassword_tSQSConnection_1);
#include <stdlib.h>
#include <stdio.h>
#include "mpi.h"
#include <time.h>
#include <sys/time.h>
/*
In here 'process o' which distribute the workload to other processes is considered
as Root (Master) process and other processes which do the computation is considered
as Slave task processes.
@AshanthaLahiru
AshanthaLahiru / handler.js
Last active May 3, 2018 01:08
Simple Lambda function that displays `Hello, ${name}`
'use strict';
module.exports.hello = (event, context, callback) => {
let user = 'User';
if(event.queryStringParameters.name) {
user = event.queryStringParameters.name
}
const response = {
@AshanthaLahiru
AshanthaLahiru / serverless.yml
Created May 3, 2018 01:00
Simple REST API configurations
service: HelloService
provider:
name: aws
runtime: nodejs6.10
functions:
hello:
handler: handler.hello
events:
- http:
path: hello/welcome
@AshanthaLahiru
AshanthaLahiru / async_performance3.js
Last active April 29, 2018 12:00
Async performance
let tryAsync = async () => {
let msgs = await Promise.all([promise(1000), promise(2000), promise(3000)])
msgs.forEach(msg => {
console.log(msg)
});
console.log(`End of Promise.all(..)`)
}
tryAsync()
//Result
@AshanthaLahiru
AshanthaLahiru / async_performance2.js
Last active April 29, 2018 11:58
Async performance
let tryAsync = async () => {
console.log(await promise(1000)) // |-----|
console.log(await promise(2000)) // |-----|-----|
console.log(await promise(3000)) // |-----|-----|-----|
}
tryAsync()
//Result
/*
@AshanthaLahiru
AshanthaLahiru / async_performance1.js
Last active April 29, 2018 11:57
Async performance
let tryAsync = async () => {
let p1 = promise(1000) // |-----|
let p2 = promise(2000) // |-----|-----|
let p3 = promise(3000) // |-----|-----|-----|
console.log(await p1)
console.log(await p2)
console.log(await p3)
}
@AshanthaLahiru
AshanthaLahiru / promise_performance3.js
Last active April 29, 2018 11:56
Promise performance
Promise.all([promise(1000), promise(2000), promise(3000)])
.then((msgs) => {
msgs.forEach(msg => {
console.log(msg)
});
console.log(`End of Promise.all(..)`)
})
//Result
/*
@AshanthaLahiru
AshanthaLahiru / promise_performance2.js
Last active April 29, 2018 11:53
Promise performance
promise(1000) // |-----|
.then((msg) => {
console.log(msg)
return promise(2000) // |-----|-----|
})
.then((msg) => {
console.log(msg)
return promise(3000) // |-----|-----|-----|
})
.then((msg) => {
@AshanthaLahiru
AshanthaLahiru / promise_performance1.js
Last active April 29, 2018 11:50
Performance of promise
promise(1000) // |-----|
.then(msg => {
console.log(msg)
})
promise(2000) // |-----|-----|
.then(msg => {
console.log(msg)
})
promise(3000) // |-----|-----|-----|
.then(msg => {