Skip to content

Instantly share code, notes, and snippets.

View kumaraditya303's full-sized avatar

Kumar Aditya kumaraditya303

View GitHub Profile
@kumaraditya303
kumaraditya303 / toml_data.py
Created May 25, 2022 09:54
Generate toml data for benchmarks
from urllib.request import urlopen
import json
import toml
BASE_URL = "https://api.github.com/repos/python/cpython/pulls?per_page=1000&state=all"
def main():
page = 1
all_issues = []
while page <= 10:
with urlopen(f"{BASE_URL}&page={page}") as response:
@kumaraditya303
kumaraditya303 / main.py
Last active June 15, 2024 04:51
MultiThreaded Playwright with ThreadPoolExecutor
import threading
from playwright.sync_api import sync_playwright
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
class Tls(threading.local):
def __init__(self) -> None:
self.playwright = sync_playwright().start()
print("Create playwright instance in Thread", threading.current_thread().name)
@kumaraditya303
kumaraditya303 / main.py
Created February 14, 2021 15:49
Run Async function as blocking function without running it in main thread
import asyncio
from threading import Thread, enumerate
def async_to_sync() -> asyncio.AbstractEventLoop:
loop = asyncio.new_event_loop()
Thread(target=loop.run_forever).start()
return loop
@kumaraditya303
kumaraditya303 / ESP8266_LPG_Leakage_Email_Sender.ino
Last active March 21, 2020 10:15
ESP8266_LPG_Leakage_Email_Sender
/*
ESP8266 LPG Leakage Email Sender
Monitors the LPG sensor output 500 times and takes the average of the sampling to reduce reading noise,
and if the value is greater than the threshold value, it sends email to the recipient .
Before uploading make sure that your ESP8266 Core is version is 2.4.0 as this code only works for that !
Before uploading the code make to sure to change in the Gsender header file:
const int SMTP_PORT = 465;// STMP port change it if you use other smtp