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 base64 | |
from Crypto.Cipher import AES # pip install pycrypto or pycryptodome | |
from Crypto.Hash import SHA256 | |
from Crypto import Random | |
__all__ = ['encrypt', 'decrypt'] | |
def encrypt(key, text, **kwargs): |
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 smtplib | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
# Check older version compatibility | |
if not hasattr(smtplib, "SMTPNotSupportedError"): | |
smtplib.SMTPNotSupportedError = smtplib.SMTPDataError |
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 qtpy import QtCore, QtWidgets, QtGui | |
class QImageLabel(QtWidgets.QLabel): | |
doubleClicked = QtCore.Signal() | |
def loadFile(self, filename): | |
"""Load the image with the given filename.""" | |
pm = QtGui.QPixmap() | |
with open(filename, 'rb') as f: |
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 win32com.client # Requires "pip install pywin32" | |
__all__ = ['get_xl_properties', 'get_file_details'] | |
# https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.tools.excel.workbook.builtindocumentproperties?view=vsto-2017 | |
BUILTIN_XLS_ATTRS = ['Title', 'Subject', 'Author', 'Keywords', 'Comments', 'Template', 'Last Author', 'Revision Number', | |
'Application Name', 'Last Print Date', 'Creation Date', 'Last Save Time', 'Total Editing Time', |
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
""" | |
Convert PDF images to jpg files | |
Requirements: | |
* Install imagemagick http://www.imagemagick.org/download/binaries/ | |
* Install ghostscript https://www.ghostscript.com/download.html | |
* pip install wand | |
""" | |
import os | |
from wand.image import Image |
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
""" | |
Merge multiple pdf files into one pdf file. | |
Args: | |
f (list/str): List of filenames to merge | |
out (str): Save filename to merge all of the files into. | |
Requires: | |
* pip install PyPDF2 |
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
"""Convert office document to file formats that may be visible in a web browser. This file uses microsoft office to | |
convert the files, so Windows OS is assumed and required! | |
Requirements: | |
* pywin32>=228 # Not available for Python3.8 at this time | |
Server Requirements: | |
* uvicorn>=0.11.5 | |
* fastapi>=0.58.0 | |
* python-multipart>=0.0.5 |
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
""" | |
https://developers.google.com/calendar/v3/reference/events/insert | |
""" | |
import os | |
import pickle | |
import datetime | |
from googleapiclient.discovery import build | |
from google_auth_oauthlib.flow import InstalledAppFlow | |
from google.auth.transport.requests import Request |
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
<html> | |
<head> | |
<title>Mortgage Calculator</title> | |
</head> | |
<body> | |
<h1>Mortgage Calculator</h1> | |
<h2>References</h2> | |
<ul> |
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
""" | |
Change a library version and upload it to pypi. | |
If you are updating the version, this script assumes a __meta__.py file exists in the package you want to upload. | |
Warning: | |
This has not been tested on all platforms! | |
Requirements: | |
* shell_proc>=1.1.1 |
OlderNewer