Skip to content

Instantly share code, notes, and snippets.

@anqxyr
anqxyr / threading.py
Last active July 5, 2018 14:59
PyQt lazy threading
WORKERS = []
class BackgroundWorker(QtCore.QThread):
result = QtCore.pyqtSignal(object)
exception = QtCore.pyqtSignal(object)
def __init__(self, func, fin):
super().__init__()
WORKERS.append(self)
self.finished.connect(lambda: WORKERS.remove(self))
@anqxyr
anqxyr / setup.py
Last active January 9, 2018 14:44
Python: automagically increment version with commit count
import setuptools
import subprocess
major_version = '1.4'
commits = commits = subprocess.check_output(
['/usr/bin/git', 'rev-list', 'HEAD', '--count']).decode('utf8').strip()
kwargs = {} # you know what to put here
setuptools.setup(
@anqxyr
anqxyr / archived
Last active July 5, 2018 15:08
Create EPUB files with Python
The gist that used to be here has since been implemented as a complete pip-installable package: https://github.com/anqxyr/mkepub
This notice is left here as a courtesy to the people who starred/bookmarked this gist in the past.