Skip to content

Instantly share code, notes, and snippets.

const puppeteer = require("puppeteer");
(async () => {
console.log("starting....");
const browser = await puppeteer.launch({
headless: true,
args: ["--no-sandbox"],
});
FROM node:20@sha256:cb7cd40ba6483f37f791e1aace576df449fc5f75332c19ff59e2c6064797160e
ENV LANG en_US.UTF-8
RUN apt-get update \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
&& sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
service: vpc-access-demo
provider:
name: aws
runtime: nodejs16.x
region: us-west-1
iam:
role:
statements:
- Effect: Allow
import { SFNClient, StartSyncExecutionCommand } from "@aws-sdk/client-sfn";
const region = process.env.AWS_REGION;
const stateMachineArn = process.env.STATE_MACHINE_ARN;
const client = new SFNClient({ region });
export const handler = async (event) => {
const params = {
stateMachineArn,
import https from 'https';
// Function to make an HTTPS GET request
const makeGetRequest = async () => {
return new Promise((resolve, reject) => {
const options = {
hostname: '<prefix>.execute-api.<region>.amazonaws.com',
path: '/dev/pets',
method: 'GET',
};
@mjzone
mjzone / getProductsById.js
Last active August 8, 2023 10:44
AWS Lambda Monitoring - Synchronous
"use strict";
const products = [
{ id: "1", name: "Product 1", description: "This is an amazing product 1", price: 99 },
{ id: "2", name: "Product 2", description: "This is an amazing product 2", price: 199 },
{ id: "3", name: "Product 3", description: "This is an amazing product 3", price: 299 },
{ id: "4", name: "Product 4", description: "This is an amazing product 4", price: 399 },
{ id: "5", name: "Product 5", description: "This is an amazing product 5", price: 499 },
];
#Cache policy
RestAPICachePolicy:
Type: AWS::CloudFront::CachePolicy
Properties:
CachePolicyConfig:
DefaultTTL: 300
MaxTTL: 31536000
MinTTL: 60
Name: RestAPICachePolicy
ParametersInCacheKeyAndForwardedToOrigin:
@mjzone
mjzone / 10_weeks_challenge.html
Last active June 21, 2021 16:08
10 weeks challenge
Week 01 - Learn HTML by building your first website: https://www.youtube.com/watch?v=pQN-pnXPaVg
Week 02 - Learn CSS: https://www.youtube.com/watch?v=ieTHC78giGQ
Week 03 - Learn JavaScript: https://www.youtube.com/watch?v=PkZNo7MFNFg
Week 04 - Learn Java programming language: https://www.youtube.com/watch?v=GoXwIVyNvX0
Week 05 - Learn NodeJS https://www.youtube.com/watch?v=TlB_eWDSMt4
Week 06 - Learn MongoDB https://www.youtube.com/watch?v=pWbMrx5rVBE
Week 07 - Build a REST API with NodeJS + MongoDB https://www.youtube.com/watch?v=vjf774RKrLc
Week 08 - Learn ReactJS - https://www.youtube.com/watch?v=Ke90Tje7VS0
import * as cdk from '@aws-cdk/core';
import { FargateDemoStack } from '../lib/fargate';
import { CloudfrontDemoStack } from '../lib/cloudfront';
const app = new cdk.App();
// FargateDemoStack
new FargateDemoStack(app, "FargateDemoStack", {
env: { account: "123456789", region: "eu-central-1" },
});
import * as cdk from "@aws-cdk/core";
import { Bucket } from "@aws-cdk/aws-s3";
import { BucketDeployment, Source } from "@aws-cdk/aws-s3-deployment";
import * as origins from "@aws-cdk/aws-cloudfront-origins";
import * as acm from "@aws-cdk/aws-certificatemanager";
import {
OriginAccessIdentity,
AllowedMethods,
ViewerProtocolPolicy,
OriginProtocolPolicy,