Skip to content

Instantly share code, notes, and snippets.

View Paritosh-Anand's full-sized avatar

Paritosh Paritosh-Anand

View GitHub Profile
@Paritosh-Anand
Paritosh-Anand / aws-multi-account-sm.config
Last active December 28, 2020 12:08
Secret Manager Integration across multiple account #AWS
[default]
region=ap-south-1
output = json
[profile sm-peer-account]
region = ap-south-1
output = json
role_arn=arn:aws:iam::0000000000:role/my-iam-role
credential_source=Ec2InstanceMetadata or EcsContainer
@Paritosh-Anand
Paritosh-Anand / jira-linked-issue.groovy
Created December 18, 2019 10:02
Jira script to check if any Linked Issue exists corresponding to ticket
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.fields.IssueLinksSystemField
import com.opensymphony.workflow.InvalidInputException
import webwork.action.ActionContext
def fieldManager = ComponentAccessor.getFieldManager()
def linksSystemField = fieldManager.getField("issuelinks") as IssueLinksSystemField
def request = ActionContext.getRequest()
@Paritosh-Anand
Paritosh-Anand / google_play_report.py
Last active October 19, 2019 10:50
Google Play Reports Analytics
import json
from httplib2 import Http
from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.discovery import build
client_email = "user@manifest-device.iam.gserviceaccount.com"
key_json_file = "<gcp_key_of_the_user>"
private_key = json.loads(open(key_json_file).read())['private_key']
@Paritosh-Anand
Paritosh-Anand / kafka.md
Last active July 9, 2019 04:25
Kafka Kerberos Consumer
  • pip install confluent_kafka
  • brew install librdkafka
  • Add krb5.conf in /etc/
  • keep keytab file on a known path and replace it with <path_to_keytab>
  • replace value of <bootsrap_servers>
  • change value of principal user@realm
@Paritosh-Anand
Paritosh-Anand / notebook.py
Created July 8, 2019 14:14
Kafka Kerberos Consumer
from confluent_kafka import Consumer, KafkaError
topics = ['topic_name']
conf = {
'bootstrap.servers': '<bootsrap_servers>:9092',
'security.protocol': 'SASL_PLAINTEXT',
'sasl.kerberos.service.name': 'kafka',
'sasl.kerberos.keytab': '<path_to_keytab>',
'sasl.kerberos.kinit.cmd': 'kinit -k -t <path_to_keytab> <principal>',
@Paritosh-Anand
Paritosh-Anand / local.py
Last active June 21, 2019 12:17
classification-backfill
from datetime import datetime
from aggregator.tasks import *
n = datetime.strptime("2019-06-20 16:00:00", "%Y-%m-%d %H:%M:%S")
m = datetime.strptime("2019-06-20 17:00:00", "%Y-%m-%d %H:%M:%S")
def datetime_range(start, end, delta):
current = start
while current < end:
yield current
client = boto3.Session(profile_name='acc_profile').client('route53')
hosted_zone_id = '********'
resp = client.list_resource_record_sets(HostedZoneId=hosted_zone_id)
for i in resp['ResourceRecordSets']:
print i
@Paritosh-Anand
Paritosh-Anand / ami_creation.py
Last active November 9, 2018 07:24
AMI Creation | AWS
import boto3
instance_id = "i-04aea94******3"
client = boto3.Session(profile_name='default', region_name='ap-south-1').client('ec2')
client.create_image(DryRun=False, InstanceId=instance_id, Name="image_name", Description="description", NoReboot=True)
@Paritosh-Anand
Paritosh-Anand / create_alarm_per_policy.py
Last active April 12, 2019 12:31
create alarm per policy using boto3
import boto3
from pprint import pformat
autoscaling_client = boto3.client("autoscaling")
lb_client = boto3.client("elbv2")
cloudwatch_client = boto3.client("cloudwatch")
for asg_info in ['asg_name_list']:
p_asg = {}
up_threshold = 0.02

Docker: Model for Production.

Web layer: Container

Running both HTTPD and Tomcat service inside a single Docker container. A Docker container essentially runs a single service inside a container, however we can tweak this functionality to run multiple service inside a container using SupervisorD. Creating a Docker image using below steps.

![Sample Docker Container] (https://d2mxuefqeaa7sj.cloudfront.net/s_5E4E5D4E7819918F4A7FFC5AD14BA5406AEE511BEF98A38F756ED666B912BEA8_1469036761891_Screen+Shot+2016-07-20+at+11.15.42+PM.png)

  1. Base image: CentOS6.