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
// Nepali format number system in Google sheets | |
>=10000000]##\,##\,##\,##0;[>=100000] ##\,##\,##0;##,##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 os | |
import zipfile | |
required_mb = 850 | |
def zip_folder(folder_path, max_chunk_size_mb=required_mb): | |
# Convert MB to bytes for comparison | |
max_chunk_size = max_chunk_size_mb * 1024 * 1024 | |
current_chunk_size = 0 | |
chunk_num = 1 | |
zip_file = None |
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
# For Restoring the the backup in the given database | |
# While running on docker I first copied the local file to docker container and docker cp and did below | |
psql -U {db_user} -d database_name -f {db}.sql |
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
function numberToWords(num) { | |
if (num === 0) return "zero"; | |
const underTwenty = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", | |
"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", | |
"seventeen", "eighteen", "nineteen"]; | |
const tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]; | |
const scales = ["", "thousand", "million", "billion", "trillion", "quadrillion"]; // Extend as needed | |
const toWords = (n) => { |
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
FEEDS = { | |
f'data/{name}.csv':{ | |
'format':'csv', | |
'overwrite':True # Will create every time new | |
} | |
} |
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 asyncio | |
import time | |
# What is the difference between this I find same ? | |
# Coroutine | |
async def my_coroutine(): | |
print("Coroutine is starting...") | |
await asyncio.sleep(5) # Simulate a non-blocking delay |
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 scrapy import cmdline | |
from datetime import datetime | |
region = 'depew' | |
date_now = datetime.now() | |
# tslco is my scrapy spider and other arguments | |
cmdline.execute(f"scrapy crawl tslco -a db_connection={region} -o {region}-{date_now.strftime('%Y-%m-%d')}.csv".split()) |
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 cv2 | |
from PIL import Image, ImageDraw, ImageFont | |
import datetime | |
import numpy as np | |
# Constants | |
total_seconds = 60 # 24 hours in seconds | |
fps = 1 # 1 frame per second | |
size = (800, 600) # Frame size | |
font_size = 200 |
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
Act as Senior Python developer, Follow all the standard PEP8 Styles, Always provide required standard practise of Python | |
Guide me with complete for this given task | |
----- |
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
def seconds_to_hms(seconds): | |
""" Convert seconds to a time format (HH:MM:SS). | |
Args: | |
seconds (float): The time duration in seconds. | |
Returns: | |
str: The time formatted as HH:MM:SS. | |
""" | |
# Ensure the input is a float and round it to the nearest whole number |
NewerOlder