This file contains 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 argparse | |
parser = argparse.ArgumentParser() | |
# String Argument | |
parser.add_argument('-c','--compName', type=str, metavar='compName', help='Competitor name as Input', required=True); | |
# Optional Integer Arguement, | |
parser.add_argument('-l','--limit', type=int, metavar='limit', help='Number of recrods to fetch', required=False); | |
# Date arguement with format validation | |
def lambda_date_args(s): | |
if(s is not None or s != '' ): |
This file contains 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 | |
from botocore.exceptions import ClientError | |
def get_secret(): | |
secret_name = "mysql/lowes-matching-prod/demo" | |
region_name = "us-west-2" | |
session = boto3.session.Session() | |
client = session.client( | |
service_name='secretsmanager', |
This file contains 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 os | |
import boto3 | |
import argparse | |
from botocore.exceptions import ClientError | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.mime.application import MIMEApplication | |
parser = argparse.ArgumentParser(description='Send e-mail through aws-ses') |
This file contains 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 | |
from botocore.exceptions import ClientError | |
def upload_file(file_name, bucket, object_name): | |
"""Upload a file to an S3 bucket | |
:param file_name: File to upload | |
:param bucket: Bucket to upload to | |
:param object_name: S3 object name. If not specified then file_name is used | |
:return: True if file was uploaded, else False |
This file contains 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 java.util.Scanner; | |
public class SubArrayWithGivenSum { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.println("Enter the Array as space separated String"); | |
String [] inputStrArray = input.nextLine().split(" "); | |
// Convert String array to int array |
This file contains 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 java.util.ArrayList; | |
import java.util.Collections; | |
public class CountTriplets { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
ArrayList<Integer> inputList = new ArrayList<Integer>(); | |
for (int i = 0; i < args.length; i++) { | |
inputList.add(Integer.parseInt(args[i])); |
This file contains 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
public class Kadanes { | |
public static void main(String args[]) { | |
int max_value = Integer.MIN_VALUE; | |
// Convert input to string array | |
int [] inputArray = new int [args.length]; | |
for (int i = 0; i < args.length; i++) { | |
inputArray[i] = Integer.parseInt(args[i]); | |
} | |
int max_value_so_far = 0; |
This file contains 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 java.util.Scanner; | |
public class MissingNumber { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Scanner input = new Scanner(System.in); | |
System.out.println("Please enter the value of N"); | |
int N = Integer.parseInt(input.nextLine()); | |
int expectedSum = (N * (N+1))/2; |
This file contains 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 java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Scanner; | |
public class MergeTwoSortedArray { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Scanner userInput = new Scanner(System.in); | |
This file contains 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
from pathlib import Path | |
from urllib.request import Request, urlopen | |
class Crawl: | |
# Download the HTML Content of the URL and return absolute path of the HTML file | |
@staticmethod | |
def fetch(outputDirectory,url): | |
try: | |
# Create the output directory if not exists |
OlderNewer