Skip to content

Instantly share code, notes, and snippets.

View vatsal2210's full-sized avatar
πŸ’»
https://vatsalshah.in

Vatsal Shah vatsal2210

πŸ’»
https://vatsalshah.in
View GitHub Profile
@vatsal2210
vatsal2210 / emails.js
Last active July 14, 2024 20:51
Block Emails List
const blockEmailList = [
'0-mail.com',
'027168.com',
'0815.ru',
'0815.ry',
'0815.su',
'0845.ru',
'0box.eu',
'0clickemail.com',
'0n0ff.net',
@vatsal2210
vatsal2210 / deployment.yml
Created July 26, 2023 20:32
ECR to EKS Deployment YML file
apiVersion: apps/v1
kind: Deployment
metadata:
name: YOUR_PROJECT_NAME
namespace: eks-test
labels:
app: YOUR_PROJECT_NAME
spec:
replicas: 2
strategy:
@vatsal2210
vatsal2210 / buildspec.yml
Created July 26, 2023 20:30
AWS Codebuild File to Deploy a node.js application to ECR
version: 0.2
phases:
pre_build:
commands:
- set -e
- echo - Set parameters
- AWS_DEFAULT_REGION=YOUR_REGION
- AWS_ACCOUNT_ID=YOUR_ACCOUNT_ID
- REGISTRY_NAME=YOUR_REGISTRY_NAME
- EKS_ROLE_ARN=YOUR_EKS_ROLE_ARN
@vatsal2210
vatsal2210 / index.js
Created June 11, 2021 04:03
Twitter Follower + Message Automation
var Twit = require('twit');
var T = new Twit({
consumer_key: '...',
consumer_secret: '...',
access_token: '...',
access_token_secret: '...',
timeout_ms: 60 * 1000, // optional HTTP request timeout to apply to all requests.
});
@vatsal2210
vatsal2210 / Redaction Regex
Created January 13, 2021 16:56
Redaction Regex
const aptRegex = /(apt|bldg|dept|fl|hngr|lot|pier|rm|ste|slip|trlr|unit|#)\.? *[a-z0-9-]+\b/gi;
const poBoxRegex = /P\.? ?O\.? *Box +\d+/gi;
const roadRegex = /(street|st|road|rd|avenue|ave|drive|dr|loop|court|ct|circle|cir|lane|ln|boulevard|blvd|way)\.?\b/gi;
export const creditCardNumber = /\d{4}[ -]?\d{4}[ -]?\d{4}[ -]?\d{4}|\d{4}[ -]?\d{6}[ -]?\d{4}\d?/g;
export const streetAddress = new RegExp(
'(\\d+\\s*(\\w+ ){1,2}' + roadRegex.source + '(\\s+' + aptRegex.source + ')?)|(' + poBoxRegex.source + ')',
'gi'
);
export const zipcode = /\b\d{5}\b(-\d{4})?\b/g;
@vatsal2210
vatsal2210 / buildspec.yml
Created December 23, 2020 16:03
Node.js buildspec.yml file to deploy on Elastic Beanstalk
# 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
commands:
- echo Installing Mocha...
- npm install -g mocha
@vatsal2210
vatsal2210 / buildspec.yml
Created December 23, 2020 16:02
Angular Buildspec.yml file to deploy on AWS S3 via Code Pipeline.
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
# BUILD_ENV = dev / prod (Check on Build projects ENV. section)
# BUCKET_NAME = dev.domain.com / prod.domain.com (Check on Build projects ENV. section)
# APPLICATION_NAME = If you store dist/APPLICATION_NAME then replace with the APPLICATION_NAME
version: 0.2
phases:
install:
runtime-versions:
@vatsal2210
vatsal2210 / aws EB - proxy.conf
Last active December 23, 2020 16:03
Set Elastic Beanstalk nginx config file
/**
* Delete this comment when you deploy the code.
* Step 1: Create a folder in your application at root leve
* : .platform/nginx/conf.d/proxy.conf
* Step 2: Write a single line as below:
* Reference: Difference b/w Linux 1 and Linux 2 - https://stackoverflow.com/questions/62924523/configuring-nginx-client-max-body-size-on-elastic-beanstalk-node
**/
client_max_body_size 100M;
@vatsal2210
vatsal2210 / .eslint.json
Created July 10, 2020 19:29
eslint json file and rules are defined here https://eslint.org/docs/rules/
{
"env": {
"node": true,
"es6": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParameters": true,
@vatsal2210
vatsal2210 / sns.js
Last active March 29, 2022 13:38
Android and IOS Push Notification with AWS SNS - Node.js
//https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html#deleteEndpoint-property
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '',
secretAccessKey: '',
region: ''
});