This file contains hidden or 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
| async autoScroll(page: Page) { | |
| await page.evaluate(async () => { | |
| await new Promise((resolve, reject) => { | |
| let totalHeight = 0; | |
| const distance = 500; | |
| const timer = setInterval(() => { | |
| const scrollHeight = document.body.scrollHeight; | |
| window.scrollBy(0, distance); | |
| totalHeight += distance; |
This file contains hidden or 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
| async renderPageToHtml(page: Page): Promise<string> { | |
| const iframes = await page.$$("iframe"); | |
| for (const iframe of iframes) { | |
| const frame = await iframe.contentFrame(); | |
| if (!frame) continue; | |
| const context = await frame.executionContext(); | |
| const res = await context.evaluate(() => { | |
| const el = document.querySelector("*"); | |
| if (el) return el.outerHTML; | |
| }); |
This file contains hidden or 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
| image: amaysim/serverless:1.71.1 | |
| variables: | |
| DOCKER_HOST: tcp://docker:2375 | |
| DOCKER_TLS_CERTDIR: "" | |
| DOCKER_DRIVER: overlay | |
| services: | |
| - docker:19.03.5-dind | |
This file contains hidden or 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
| .deploy: | |
| stage: Deployment | |
| only: | |
| - master | |
| script: | |
| - export CHANGES=$(git diff-tree --no-commit-id --compact-summary --name-only -r $CI_COMMIT_SHORT_SHA | grep -oE "^\\w+" | sort | uniq) | |
| - export MATCH=$(echo "$CHANGES" | grep -e "^$CURRENT_PROJECT") | |
| - | | |
| if [[ ! -z "$MATCH" ]] | |
| then |
This file contains hidden or 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
| image: amaysim/serverless:1.71.1 | |
| services: | |
| - docker:19.03.5-dind | |
| stages: | |
| - Deploy | |
| deploy_aws_lambda: | |
| stage: Deploy |
This file contains hidden or 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
| image: amaysim/serverless:1.71.1 | |
| stages: | |
| - Deploy | |
| deploy_aws_lambda: | |
| stage: Deploy | |
| script: | |
| - apk add --no-cache curl python3 py3-pip | |
| - curl -Ls https://cli.doppler.com/install.sh | sh |
This file contains hidden or 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
| image: amaysim/serverless:1.71.1 | |
| stages: | |
| - Deploy | |
| deploy_aws_lambda: | |
| stage: Deploy | |
| script: | |
| - apk add --no-cache curl # Install packages for Alpine linux | |
| - curl -Ls https://cli.doppler.com/install.sh | sh # Install Doppler |
This file contains hidden or 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
| image: amaysim/serverless:1.71.1 | |
| stages: | |
| - Deploy | |
| deploy_aws_lambda: | |
| stage: Deploy | |
| script: | |
| - sls deploy |
This file contains hidden or 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 json | |
| client = boto3.client('events') | |
| lambda_client = boto3.client('lambda') | |
| def add_schedule(): | |
| rule = client.put_rule( | |
| Name="MyRuleId", | |
| ScheduleExpression="rate(2 minutes)", |
This file contains hidden or 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
| lambda_client = boto3.client('lambda') | |
| lambda_client.add_permission( | |
| FunctionName="MyLambdaFunctionARN", | |
| StatementId="IUseTheSameHereAsTheRuleIdButYouDoAsYouPlease", | |
| Action="lambda:InvokeFunction", | |
| Principal="events.amazonaws.com", | |
| SourceArn=rule["RuleArn"] | |
| ) |
NewerOlder