π¨βπ»
This file contains hidden or 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
| # client.py | |
| import request | |
| def client_function_name(param) -> bool: | |
| response = request.post(url, json="{}"); | |
| if response: | |
| return True | |
| return False | |
This file contains hidden or 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 concurrent.futures | |
| import json | |
| import logging | |
| import requests | |
| # AWS pricing API Endpoint | |
| URL = "https://a0.p.awsstatic.com/pricing/1.0/ec2/region/{region}/reserved-instance/linux/index.json" | |
| class AWSService: |
This file contains hidden or 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 requests | |
| import concurrent.futures | |
| import json | |
| import logging | |
| # AWS pricing API Endpoint | |
| url = "https://a0.p.awsstatic.com/pricing/1.0/ec2/region/{region}/reserved-instance/linux/index.json" | |
| class AWSService: |
This file contains hidden or 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 requests | |
| import concurrent.futures | |
| import json | |
| import logging | |
| class AwsEc2Price: | |
| # Retrieving EC2 instance prices from AWS EC2 Pricing API | |
| def get_ec2_prices(self, reserved_instance_plan_args): | |
| url = f"https://a0.p.awsstatic.com/pricing/1.0/ec2/region/{reserved_instance_plan_args[0]}/reserved-instance/linux/index.json" |
This file contains hidden or 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 requests | |
| import threading | |
| import json | |
| from json import JSONDecodeError | |
| class AwsEc2Price: | |
| def __init__(self, term_offering_class_, term_length_, payment_option_, region_, operating_system_, tenancy_): | |
| self.term_offering_class = term_offering_class_ | |
| self.term_length = term_length_ |
This file contains hidden or 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
| private HashMap<Integer, Integer> sortByValueAscending(HashMap<Integer, Integer> numCounts) { | |
| List<Map.Entry<Integer, Integer> > list = | |
| new LinkedList<Map.Entry<Integer, Integer> >(numCounts.entrySet()); | |
| Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { | |
| public int compare(Map.Entry<Integer, Integer> o1, | |
| Map.Entry<Integer, Integer> o2) | |
| { | |
| return (o1.getValue()).compareTo(o2.getValue()); | |
| } |
This file contains hidden or 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
| private HashMap<Integer, Integer> sortByValueDescending(HashMap<Integer, Integer> numCounts) { | |
| List<Map.Entry<Integer, Integer> > list = | |
| new LinkedList<Map.Entry<Integer, Integer> >(numCounts.entrySet()); | |
| Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { | |
| public int compare(Map.Entry<Integer, Integer> o1, | |
| Map.Entry<Integer, Integer> o2) | |
| { | |
| return (o2.getValue()).compareTo(o1.getValue()); | |
| } |
This file contains hidden or 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
| package jdbc; | |
| import java.sql.*; | |
| public class MysqlConnect { | |
| public static void main(String[] args ) { | |
| System.out.println("Inserting values in mysql database table!"); | |
| Connection conn = null; | |
| String url = "jdbc:mysql://192.168.43.6"; | |
| String db = "learntrix"; |
This file contains hidden or 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 pymongo | |
| from bson.code import Code | |
| myclient = pymongo.MongoClient("mongodb://localhost:27017/") | |
| mydb = myclient["mydb"] | |
| mycol = mydb["myColl"] | |
| mylist = [ | |
| { "resource": "oxygen", "city": "Mumbai", "status": "verified"}, |
This file contains hidden or 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
| # Amazon Linux 2 | |
| - name: Install docker | |
| package: | |
| name: docker | |
| state: present | |
| register: dockerinstall | |
| - name: Update docker driver to systemd | |
| copy: | |
| src: daemon.json |
NewerOlder