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
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
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 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
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): |
NewerOlder