Skip to content

Instantly share code, notes, and snippets.

View flutefreak7's full-sized avatar

Brett Ables flutefreak7

View GitHub Profile
@phillipkent
phillipkent / convert-docx.py
Last active November 7, 2023 09:19
Python code using the python-docx module to convert a DOCX file to another DOCX file
# Converts a docx file with tables and images to a new docx file
# The new file is based on a 'stub' document which contains preamble text and styles
#
# Requires the Python module 'python-docx' <https://python-docx.readthedocs.io>
# Written for Python 3
#
# Source documents are taken from the directory 'source' and converted documents are saved
# to the directory 'converted'
#
# Two types of source documents are handled: 'Fiscal Guide' or 'Economics Regime'. Each one
@noporpoise
noporpoise / unifieddiff.py
Last active July 11, 2024 11:13
Apply unified diff patches in pure python2/3
#!/usr/bin/env python
# coding=utf-8
# License: Public domain (CC0)
# Isaac Turner 2016/12/05
from __future__ import print_function
import difflib
import re