Skip to content

Instantly share code, notes, and snippets.

@nikolaysm
nikolaysm / pg_backup.config
Last active September 15, 2021 15:34
Automated Backup on Linux with admin notification by mail
##############################
## POSTGRESQL BACKUP CONFIG ##
##############################
# Optional system user to run backups as. If the user the script is running as doesn't match this
# the script terminates. Leave blank to skip check.
BACKUP_USER=
# Optional hostname to adhere to pg_hba policies. Will default to "localhost" if none specified.
HOSTNAME=
@nikolaysm
nikolaysm / gist:1f8e6dd42173a62341d34d616151888e
Created March 21, 2021 16:02 — forked from bradleyayers/gist:1480017
Fill a page with an image with ReportLab and PIL
def fill_page_with_image(path, canvas):
"""
Given the path to an image and a reportlab canvas, fill the current page
with the image.
This function takes into consideration EXIF orientation information (making
it compatible with photos taken from iOS devices).
This function makes use of ``canvas.setPageRotation()`` and
``canvas.setPageSize()`` which will affect subsequent pages, so be sure to