Skip to content

Instantly share code, notes, and snippets.

@vickyRathee
vickyRathee / buildspec.yml
Created December 3, 2021 05:12
Deploying NestJS application on Elastic Beanstalk via Code pipeline
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
version: 0.2
phases:
install:
runtime-versions:
nodejs: '12'
pre_build:
commands:
- echo Installing source NPM dependencies...
@vickyRathee
vickyRathee / puppeteer-adblocker
Created September 19, 2021 11:33
Block ads and other resources using Puppeteer network request interceptor
const puppeteer = require("puppeteer");
(async () => {
const browser = await puppeteer.launch({
headless: true,
timeout: 30000,
ignoreHTTPSErrors: true,
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
@vickyRathee
vickyRathee / buildspec.yml
Created January 9, 2021 10:04
AWS CodeBuild buildspec.yml to build and test dot net 5 based application runtime.
# Based on https://github.com/PrakashTrove/AWS-CodeBuild-NetCore/blob/master/buildspec.yml
# AWS CodeBuild spec to build an Elastic Beanstalk artifact for AWS CodePipeline to deploy
version: 0.2
phases:
install:
runtime-versions:
dotnet: 5.0
#dotnet: latest - Latest resolve to 3.1, check this issue https://github.com/aws/aws-codebuild-docker-images/issues/414
#!/bin/bash
yum -y install gcc make # install GCC compiler
cd /home/ec2-user
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
rm -f redis-stable.tar.gz
cd redis-stable
make distclean
make
# Run tests
@vickyRathee
vickyRathee / install_redis-5.0.8.config
Created May 6, 2020 13:16
Elastic beanstalk .ebextensions config to auto install Redis
packages:
yum:
gcc-c++: []
make: []
sources:
/home/ec2-user: http://download.redis.io/releases/redis-5.0.8.tar.gz
commands:
redis_build:
command: make
cwd: /home/ec2-user/redis-5.0.8
@vickyRathee
vickyRathee / manual-install-redis-in-amazon-linux.sh
Created May 6, 2020 12:58
install Redis manually in amazon Linux instance using Putty
sudo yum -y install gcc make # install GCC compiler
cd /home/ec2-user
sudo wget http://download.redis.io/redis-stable.tar.gz
sudo tar xvzf redis-stable.tar.gz
sudo rm -f redis-stable.tar.gz
cd redis-stable
sudo make distclean
sudo make
@vickyRathee
vickyRathee / multiple-btn-click-with-delay
Created May 1, 2020 12:58
Click on submit button multiple times. similar to await btn.click({ clickCount: 3 }) in puppeteer. https://www.agenty.com/docs/scraping-agent/crawling-password-protected-website-online
var clicked = 0;
var timer = setInterval(() => {
var element = document.querySelector('#submit');
if (!element || clicked > 3)
{
clearInterval(timer);
}
else{
element.click();
clicked++;
var totalHeight = 0;
var distance = 100;
var timer = setInterval(() => {
var scrollHeight = document.body.scrollHeight;
window.scrollBy(0, distance);
totalHeight += distance;
if (totalHeight >= scrollHeight) {
clearInterval(timer);
}