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 calc_rate_offset(monthly_cost, annual_cost, tolerance=1e-8): | |
| """ | |
| Find the monthly interest rate needed to offset the cost difference | |
| between monthly and annual plans. | |
| """ | |
| total_monthly = 12 * monthly_cost | |
| diff = total_monthly - annual_cost # Extra cost to offset | |
| # If there's no meaningful difference, no interest rate is needed | |
| if diff <= 0: |
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
| // Just some quick snippets for creating colour pickers quickly, mainly for VS Code | |
| // Put this in your python code snippet file, accessed through ctrl + shift + p > Snippets: Configure Snippets | |
| // Creates a colour picker with the #000000 hex format | |
| "Colour Picker": { | |
| "prefix": "col", | |
| "body": [ | |
| "\"#000000\"" | |
| ], | |
| "description": "color picker!" | |
| }, |
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 | |
| import os | |
| import exifread | |
| from PyQt5 import QtWidgets, QtGui, QtCore | |
| from PyQt5.QtWidgets import QMainWindow, QLabel, QFileDialog, QWidget, QTextEdit, QVBoxLayout, QScrollArea, QPushButton | |
| from PIL.PngImagePlugin import PngImageFile | |
| class MainWindow(QMainWindow): | |
| def __init__(self): | |
| super().__init__() |
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 os | |
| import exifread | |
| import PIL.PngImagePlugin | |
| def extract_metadata_from_png(png_file): | |
| """Extract metadata from a PNG file object""" | |
| png = PIL.PngImagePlugin.PngImageFile(png_file) | |
| return png.info | |
| def has_prompt_in_metadata(metadata): |