Skip to content

Instantly share code, notes, and snippets.

@bengosney
bengosney / .pre-commit-config.yaml
Last active June 23, 2023 07:40
My default pre-commit for python
exclude: migrations/.*\.py|Procfile|[aw]sgi\.py|node_modules|.git|\.polar|inputs/.*
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
@bengosney
bengosney / mailhog.service
Last active September 14, 2022 11:16
Systemd service that will run mailhog in docker and setup iptable rules to redirect all outgoing on ports 25, 587 and 465 back to mailhog
[Unit]
Description=MailHog service
After=docker.service
Wants=network-online.target docker.socket
Requires=docker.socket
[Service]
TimeoutStartSec=120
Restart=on-failure
RestartSec=5
#!/bin/bash
for PY in $(ls /usr/bin/python3.* | egrep "3.[0-9]+$"); do
PRI=$(echo $PY | egrep -o "[0-9]+$")
echo "Installing 3.$PRI"
update-alternatives --install /usr/bin/python python ${PY} ${PRI}
update-alternatives --install /usr/bin/python3 python3 ${PY} ${PRI}
done
@bengosney
bengosney / pyproject.toml
Last active June 23, 2023 07:54
Base pyproject.toml
[project]
name = "New-Project"
description = "Replace this with a description"
version = "0.0.1"
authors = [{name = "Ben Gosney", email = "bengosney@googlemail.com"}]
dependencies = []
[project.optional-dependencies]
dev = ["black", "mypy", "pip-tools", "pre-commit", "icecream"]