Skip to content

Instantly share code, notes, and snippets.

View mujeebishaque's full-sized avatar
💭
Let it burn

Mujeeb Ishaque mujeebishaque

💭
Let it burn
View GitHub Profile
@mujeebishaque
mujeebishaque / disk_info.py
Created November 7, 2023 14:06
calculate disk space in GBs using python psutils
import psutil
UNITS = {1000: ['KB', 'MB', 'GB']}
class DiskInfo:
def __init__(self) -> None:
self.disk_info = {}
self.total_disk_size = 0
@mujeebishaque
mujeebishaque / sqlite
Created March 18, 2022 20:08
create database and table sqlite3
def create_if_not_exists():
try:
import sqlite3
connection = sqlite3.connect('database.db')
cursor = connection.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS listings
(listing_url TEXT, current_price TEXT)
''')
@mujeebishaque
mujeebishaque / alerts.py
Created October 19, 2021 21:39
alerts.py
from tkinter import messagebox
from tkinter import Tk
class Alerts:
@staticmethod
def show_alert(type=None, text=None):
window = Tk()
window.withdraw()
if type.lower() == 'warning':
@mujeebishaque
mujeebishaque / binance_socket_live.md
Created October 3, 2021 03:24
Binance live data via sockets

''' Description: Capture stream; store it temporarily; delete it after certain time interval/99/100 values. Stream Name: @kline_ ''' from matplotlib.pyplot import close from constants import CURRENT_SYMBOL import websocket, json

class BinanceDataStream:

username = input("Enter your username: ")
password = input("Enter your password: ")
if username == 'admin' and password == 'admin':
pass
else:
raise ValueError("Incorrect Value")
<script type=text/javascript>
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
import argparse
import os
parser = argparse.ArgumentParser(description="Python3 script to create folders")
parser.add_argument("-o", "--output_dir", type=str, required=False, help="Add path to output folder")
parser.add_argument("-n", "--number_of_folders", type=int, required=True, help="Total number of folders")
args = vars(parser.parse_args())
CONFIRMED = False
SUCCESS = False
@mujeebishaque
mujeebishaque / write_images_to_excel.py
Created April 1, 2020 15:16
write and position multiple images in excel using openpyxl
def write_excel_second(self, folder_name=None, images=None):
import openpyxl
from openpyxl import load_workbook
from openpyxl.drawing.spreadsheet_drawing import AbsoluteAnchor
from openpyxl.drawing.xdr import XDRPoint2D, XDRPositiveSize2D
from openpyxl.utils.units import pixels_to_EMU, cm_to_EMU
# print('========>', folder_name, images)
if images is None or len(images) == 0:
@mujeebishaque
mujeebishaque / openpyxl writer multiple images
Created April 1, 2020 11:02
add multiple images using openpyxl
def real_writer(self, folder_name=None, images=None):
if images is None or len(images) ==0:
return
import openpyxl
from openpyxl.drawing.image import Image
workbook = openpyxl.Workbook()
# Let's use the hello_world spreadsheet since it has less data
# workbook = load_workbook(filename="hello_world.xlsx")
@mujeebishaque
mujeebishaque / delete_xml.py
Created December 3, 2019 18:30
delete all the .xml files from your images dataset including folders, subfolders
import os
for root, dirs, files in os.walk(os.getcwd()):
for _dir in dirs:
current_dir = os.getcwd() + os.sep + _dir
for x in os.listdir(current_dir):
if x.endswith(".xml"):
# print(current_dir + os.sep + x)
os.remove(current_dir + os.sep + x)