Skip to content

Instantly share code, notes, and snippets.

@erickod
erickod / django.cgi.py
Created August 9, 2021 18:51 — forked from philchristensen/django.cgi.py
A very slow way to serve Django when all you have is CGI
#!/usr/bin/env python
# encoding: utf-8
"""
django.cgi
A simple cgi script which uses the django WSGI to serve requests.
Code copy/pasted from PEP-0333 and then tweaked to serve django.
http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
@erickod
erickod / convert-docx-to-html.py
Created March 22, 2022 18:49 — forked from longbowking/convert-docx-to-html.py
Convert a DOCX file to HTML (using python-docx)
# Converts a docx file with tables and images to (simple) HTML
# ORIGINAL CODE BY DAVID SSALI AT SOURCE: https://medium.com/@dvdssali/docx-to-html-1374eb6491a1
#
# Requires the Python module 'python-docx' <https://python-docx.readthedocs.io>
#
# Example use:
# >>> s = convert('./SOURCEDIR', 'SAMPLE.docx')
# >>> print(s)
# or
# $ python .\convert-docx-to-html.py > temp.html
@erickod
erickod / gist:e301684ba97c9f8c4550887560a08c08
Created June 29, 2022 21:09 — forked from bebosudo/gist:7b1c0650e2f94d26afe830530764de65
Compile python 3.6 locally, with openssl and sqlite3 support
Create a dir to build things into:
$ mkdir ~/stack && cd ~/stack
Download the sources (sqlite 3230100 was broken, 3220000 was used instead):
$ wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
$ wget https://sqlite.org/2018/sqlite-src-3220000.zip
$ wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
@erickod
erickod / create_function.py
Created April 6, 2023 18:39 — forked from dhagrow/create_function.py
Dynamic function creation in Python
"""
Python is a dynamic language, and it is relatively easy to dynamically create
and modify things such as classes and objects. Functions, however, are quite
challenging to create dynamically.
One area where we might want to do this is in an RPC library, where a function
defined on a server needs to be available remotely on a client.
The naive solution is to simply pass arguments to a generic function that
accepts `*args` and `**kwargs`. A lot of information is lost with this approach,
@erickod
erickod / Retry.py
Created June 9, 2024 13:33 — forked from ultrafunkamsterdam/Retry.py
Python (Auto) Retry - Automatically retry your calls using optional delay - asyncio compatible
import asyncio
import functools
import time
__all__ = ['Retry']
class Retry(object):
"""

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@erickod
erickod / list_kindle_releases.py
Created March 13, 2025 08:43 — forked from marccarre/list_kindle_releases.py
List all available versions of Kindle for Mac and Kindle for PC.
#!/usr/bin/env python
'''
List all available versions of Kindle for Mac and Kindle for PC.
Dependencies:
- asyncio==3.4.3
- aiohttp==3.6.3
'''
import os
import sys