Skip to content

Instantly share code, notes, and snippets.

View sanudatta11's full-sized avatar
🏠
Working from home

Soumyajit Dutta sanudatta11

🏠
Working from home
View GitHub Profile
@sanudatta11
sanudatta11 / app.yaml
Created July 8, 2023 15:44
Load Testing CF
Description: (SO0062) - Distributed Load Testing on AWS is a reference architecture to perform application load testing at scale. Version v3.2.1
AWSTemplateFormatVersion: "2010-09-09"
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Console access
Parameters:
- AdminName
- AdminEmail
@sanudatta11
sanudatta11 / Log Group Purger
Created January 1, 2020 06:43
This Script Purges a Log Group but doesn't delete the Log Group. It Shows Current Progress and Confirms with you before deleting the streams
#!/usr/bin/env bash
LOG_GROUP_NAME=${1:?log group name is not set}
echo Getting stream names...
LOG_STREAMS=$(
aws logs describe-log-streams \
--log-group-name ${LOG_GROUP_NAME} \
--query 'logStreams[*].logStreamName' \
--output table |
@sanudatta11
sanudatta11 / install-chef-server.sh
Created November 17, 2019 04:11
This is the Boostrap script for creating a chef server on Ubuntu 16.04+ versions
#!/bin/bash
apt-get update
apt-get -y install curl
# create staging directories
if [ ! -d /drop ]; then
mkdir /drop
fi
if [ ! -d /downloads ]; then
@sanudatta11
sanudatta11 / Telegram_Echo_Bot.py
Created October 26, 2019 06:48
This is the Code for Telegram Echo Bot. Put your Bot Token ID in Environment with Key TOKEN
import json
import os
from botocore.vendored import requests
TOKEN = os.environ['TOKEN']
API = "https://api.telegram.org/bot{}/".format(TOKEN)
def send_message(text, chat_id):
final_text = "Your Message was: " + text
url = API + "sendMessage?text={}&chat_id={}".format(final_text, chat_id)
@sanudatta11
sanudatta11 / apache.conf
Created July 10, 2019 07:49
Medium Publication Apache Conf
input {
kafka {
bootstrap_servers => "localhost:9092"
topics => "apache"
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
@sanudatta11
sanudatta11 / gist-elasticsearch-resp.json
Last active July 11, 2019 05:37
Medium Publication ElasticSearch Response
{
"name" : "elasticsearch",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "W_Ky1DL3QL2vgu3sdafyag",
"version" : {
"number" : "7.2.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "508c38a",
"build_date" : "2019-06-20T15:54:18.811730Z",
{
"min": $input.params('min');
"max": $input.params('max');
}
@sanudatta11
sanudatta11 / EFS Mount on Reboot
Created July 1, 2019 06:21
Auto Remount on Reboot EFS
#!/bin/bash
# mount EFS volume
# https://docs.aws.amazon.com/efs/latest/ug/gs-step-three-connect-to-ec2-instance.html
# create a directory to mount our efs volume to
"sudo mkdir -p /mnt/efs",
# mount the efs volume
"sudo mount -t nfs4 -o nfsvers=4.1 ${aws_efs_mount_target.efs-mount-target.dns_name}:/ /mnt/efs",
# create fstab entry to ensure automount on reboots
# https://docs.aws.amazon.com/efs/latest/ug/mount-fs-auto-mount-onreboot.html#mount-fs-auto-mount-on-creation
"sudo su -c \"echo '${aws_efs_mount_target.efs-mount-target.dns_name}:/ /mnt/efs nfs defaults,vers=4.1 0 0' >> /etc/fstab\"" #create fstab entry to ensure automount on reboots
#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/rundeckFiles/
#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
server.address=DNS_REPLACE
grails.serverURL=DNS_REPLACE
dataSource.dbCreate = update
dataSource.url = jdbc:driver://RDS_HOSTNAME:3306/RDS_DBNAME?user=RDS_USERNAME&password=RDS_PASSWORD;MVCC=true
AWSTemplateFormatVersion: 2010-09-09
Description: "This is the first CF Template for running Rundeck via UserData!"
Parameters:
NameOfService:
Description: "The name of the service this stack is to be used for."
Type: String
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access into the server
Type: AWS::EC2::KeyPair::KeyName
DatabaseName: