Skip to content

Instantly share code, notes, and snippets.

View cankush625's full-sized avatar
👨‍💻
TechKiddie

Ankush Chavan cankush625

👨‍💻
TechKiddie
View GitHub Profile
# client.py
import request
def client_function_name(param) -> bool:
response = request.post(url, json="{}");
if response:
return True
return False
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:
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:
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"
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_
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());
}
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());
}
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";
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"},
# Amazon Linux 2
- name: Install docker
package:
name: docker
state: present
register: dockerinstall
- name: Update docker driver to systemd
copy:
src: daemon.json