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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Magical Recipes</title> | |
<style> | |
body { | |
background-color: #f5e3f8; /* Magical pastel purple */ | |
font-family: 'Cursive Magic', fantasy; |
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 pandas as pd | |
from datetime import datetime | |
def min_date_difference(df, date_columns): | |
""" | |
Create a new column with the minimum difference (in days) between today's date and future dates. | |
Parameters: | |
- df: pandas DataFrame | |
- date_columns: list of str, column names containing datetime values |
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
def print_shri_shri(rows): | |
for i in range(rows): | |
for j in range(rows - i - 1): | |
print(" ", end=" ") | |
for j in range(i + 1): | |
print("श्री ", end="") | |
print() |
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 qrcode | |
def generate_upi_qr_code(merchant_upi_id, merchant_name, payment_description, payment_amount): | |
# create the QR code string | |
qr_string = "upi://pay?pa={}&pn={}&tn={}&am={}".format(merchant_upi_id, merchant_name, payment_description, payment_amount) | |
# generate the QR code | |
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=4) | |
qr.add_data(qr_string) | |
qr.make(fit=True) |
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
from google.oauth2.credentials import Credentials | |
from googleapiclient.discovery import build | |
from datetime import datetime, timedelta | |
import pandas as pd | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
# Replace with the path to your credentials.json file | |
credentials_path = 'fitternew.json' | |
# Define the scopes that your app needs |
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 xmltodict | |
import json | |
# Specify the input and output file paths | |
input_file = 'input.xml' | |
output_file = 'output.jsonl' | |
# Open the input and output files | |
with open(input_file, 'r') as xml_file, open(output_file, 'w') as jsonl_file: | |
# Parse the XML file using xmltodict |
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
def read_mongo_collection(uri, pipeline=None, given_schema=None, spark=None): | |
""" | |
:param uri: uri for mongo connection | |
:param pipeline: pipeline option for pushing queries to mongo | |
:param given_schema: schema option, will read in mentioned schema | |
:return: dataframe after reading from mongo | |
""" | |
if pipeline: | |
if not given_schema: | |
return spark.read.format("com.mongodb.spark.sql.DefaultSource").option("pipeline", pipeline).option( |
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 sys | |
from types import ModuleType, FunctionType | |
from gc import get_referents | |
# Custom objects know their class. | |
# Function objects seem to know way too much, including modules. | |
# Exclude modules as well. | |
BLACKLIST = type, ModuleType, FunctionType | |
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
def get_interval(space_list, width): | |
for i in range(len(space_list)-1): | |
if space_list[i+1]>width: | |
return space_list[i] | |
else: | |
continue | |
return space_list[-1] | |
def get_subtracted_list(space_list, width): | |
return list(map(lambda x: int(((x-width)+abs(x-width))/2), space_list)) |
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 re | |
import yaml | |
def parse_config(vars_dict, path=None, data=None, tag='!ENV'): | |
""" | |
Load a yaml configuration file and resolve any environment variables | |
The environment variables must have !ENV before them and be in this format | |
to be parsed: $<VAR_NAME>. | |
E.g.: | |
database: |
NewerOlder