This file contains 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
#!/usr/bin/python2.6 | |
# -*- coding: utf-8 -*- | |
# (c) Copyright 2011-2013 by Joseph Reagle | |
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html> | |
import codecs | |
from difflib import SequenceMatcher | |
from cfiledict import FileDict # compressed FileDict | |
#from filedict import FileDict # http://erezsh.wordpress.com/2009/05/24/filedict-a-persistent-dictionary-in-python/ | |
import logging |
This file contains 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
#!/usr/bin/python2 | |
# -*- coding: utf-8 -*- | |
""" Read page indices to build book index. | |
Input consists of lines of a topic, page_no, and subtopic | |
affixed with prepositions, or a "see also". Page numbers | |
may have a range ('-') but no commas (','). | |
topic 000 | |
topic 000-002 | |
topic 000 subtopic | |
topic 000 {in, and} subtopic |
This file contains 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
#!/usr/bin/env python3 | |
"""Generate a class calendar using duration of semester, the days of the week a | |
class meets, and holidays. It can modify a markdown syllabus if they share the | |
same number of sessions and classes are designed with the pattern "### Sep 30 Fri" | |
""" | |
# https://gist.github.com/reagle/19806122fdb22515ea0b | |
__author__ = "Joseph Reagle" |
This file contains 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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
# detox filenames so as to across most file systems | |
# (c) Copyright 2016 by Joseph Reagle | |
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html> | |
# | |
import codecs | |
import glob | |
import locale |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# (c) Copyright 2016 by Joseph Reagle | |
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html> | |
# | |
"""Pretty print a markdown file as line-numbered source. | |
Perhaps one day replace with a [panflute] filter for pandoc. | |
[panflute]: http://scorreia.com/software/panflute/ |
This file contains 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 sublime # https://www.sublimetext.com/docs/3/api_reference.html | |
import sublime_plugin | |
import textwrap | |
import urllib | |
# | |
def unsafe_links(content): | |
"""remove annoying outlook link protection |
This file contains 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
#!/usr/bin/env python2.7 | |
"""Wrap text, including semantically by add breaks at | |
terminal punctuation.""" | |
# Using python 2.7 so portions can be used in Sublime Text 3 plugin | |
import argparse # http://docs.python.org/dev/library/argparse.html | |
import logging | |
import re | |
import sys |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# | |
# (c) Copyright 2019 by Joseph Reagle | |
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html> | |
# | |
""" Convert string to pandoc auto_identifiers default algorithm. | |
Intended as a CopyQ clipboard function. | |
""" |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# DESCRIPTION | |
# (c) Copyright 2020 by Joseph Reagle | |
# Licensed under the GPLv3, see <http://www.gnu.org/licenses/gpl-3.0.html> | |
# | |
import argparse # http://docs.python.org/dev/library/argparse.html | |
import codecs | |
import logging |
This file contains 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
# A Sublime Text 3 (python 2.7) plugin for wrapping text, including | |
# semantic wraps. | |
import re | |
import sublime # https://www.sublimetext.com/docs/3/api_reference.html | |
import sublime_plugin | |
SEMANTIC_BREAK_RE = re.compile( | |
r""" | |
( # end of sentence includes... | |
[a-z]{2,}| # end of word |
OlderNewer