Skip to content

Instantly share code, notes, and snippets.

@dmckeone
dmckeone / dovecot.conf.j2
Last active January 26, 2026 21:35
Dovecot 2.4 primary server configuration on Ubuntu 24.04 with LDAP (LLDAP), rspamd education, and Full Text Search (fts_flatcurve)
# Dovecot 2.4.2 primary server w/ LDAP (lldap), rspamd education, and Full Text Search (fts_flatcurve)
#
# This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }}
#
# For gateway/relay see: https://gist.github.com/dmckeone/20b09040909fb010ae97f1139e2cf827
#
# On Ubuntu 24.04 LTS this requires the PPA: https://repo.dovecot.org/
#
# Generic settings reference: https://doc.dovecot.org/2.4.2/core/summaries/settings.html
#
@dmckeone
dmckeone / spam-to-junk.sieve.j2
Last active January 26, 2026 21:36
Dovecot 2.4 sieve for automatically filing rspamd spam into the Junk folder
require ["fileinto", "mailbox", "spamtest", "spamtestplus", "relational", "comparator-i;ascii-numeric"];
# See dovecot.conf for matching configuration: https://gist.github.com/dmckeone/7cdf170624d77c4ddcdce1721c6f760e
# This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }}
# Must install spamtest & spamtestplus and normalize spam headers in dovecot.conf: https://doc.dovecot.org/main/core/config/sieve/extensions/spamtest_virustest.html
# :percent normalizes the rspamd score ratio to a percent, so "X-Spamd-Result: default: False [12.00 / 15.00]" would be 12 / 15 = 0.8 or 80%.
#
# Don't create INBOX/Junk; only sort mail if it already exists
if mailboxexists "INBOX/Junk" {
@dmckeone
dmckeone / learn-spam.sieve.j2
Last active January 26, 2026 21:36
Dovecot 2.4 sieve for sending rspamd Spam education to a relay/gateway
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
# See dovecot.conf for matching configuration: https://gist.github.com/dmckeone/7cdf170624d77c4ddcdce1721c6f760e
# This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }}
# NOTE: When moving from Trash to Junk assume that the user is intentionally flagging an email as Junk
if environment :matches "imap.user" "*" {
set "username" "${1}";
}
@dmckeone
dmckeone / learn-ham.sieve.j2
Last active January 26, 2026 21:36
Dovecot 2.4 sieve for sending rspamd Ham education to a relay/gateway
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables", "imap4flags"];
# See dovecot.conf for matching configuration: https://gist.github.com/dmckeone/7cdf170624d77c4ddcdce1721c6f760e
# This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }}
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
# If moving from Junk to Trash then the email is being deleted, not marked as ham
@dmckeone
dmckeone / dovecot.conf.j2
Last active January 26, 2026 21:36
Dovecot 2.4 gateway/relay configuration on Ubuntu 24.04 with LDAP (LLDAP)
# Dovecot 2.4.2 gateway/relay w/ LDAP
#
# This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }}
#
# For primary server see: https://gist.github.com/dmckeone/7cdf170624d77c4ddcdce1721c6f760e
#
# On Ubuntu 24.04 LTS this requires the PPA: https://repo.dovecot.org/
#
# This file was created as a "minimal" configuration since it only requires authorization and nothing else
#
@dmckeone
dmckeone / compress.py
Last active December 23, 2024 22:55
Sanic Compress Extension with gzip, deflate, or brotli
"""
Sanic Compress Extension
Compress responses using gzip, deflate or brotli (if [brotli](https://pypi.org/project/Brotli/) or
[brotlicffi](https://pypi.org/project/brotlicffi/) is installed).
Limitations:
* No compression on streaming responses
* No compression on chunked responess
@dmckeone
dmckeone / OpenSSLOnFreeBSD.md
Last active November 2, 2016 15:18
Keep OpenSSL updated on FreeBSD
@dmckeone
dmckeone / CanadaTallStores.txt
Last active September 15, 2015 18:12
Stores with Men's Tall Sizes (and shipping to Canada)
LL Bean: http://www.llbean.com/
American Eagle: http://www.ae.com/web/canada/store.jsp
J. Crew: https://www.jcrew.com/ca/index.jsp
Eddie Bauer: http://www.eddiebauer.com
Gap: http://www.gap.com
Macy's: http://www1.macys.com
Land's End: http://www.landsend.com
Banana Republic: http://bananarepublic.gap.com
Quicksilver: http://www.quiksilver.com
Columbia: http://www.columbiasportswear.ca

getting started with salt

a little adventurous tale of setting up salt on osx...

salt osx docs: http://goo.gl/E6ZtA

overall, seemed pretty straight forward...(?)

  • preliminary steps:
    • brew update (I did this to make sure I was up to date)
    • brew upgrade (I did this to upgrade what I was not up to date with)
  • brew doctor (I did this to make sure I was 'raring to brew')
@dmckeone
dmckeone / gist:69334e2d8b27f586414a
Last active February 11, 2023 15:28
Using virtualenv under PostgreSQL PL/Python

(All of this code tested in Enterprise DB PostgreSQL 9.4 Beta 1 and Python 3.3)

As of Virtualenv 1.3 (https://pypi.python.org/pypi/virtualenv) (and excluding Python 3.4's venv) there is an activate_this.py file within a virtualenv package that allows activation of a virtual environment within an embedded version of Python (like PostgreSQL's PL/Python). A Python 2/3 compatible version looks like this:

exec(open('/Some/VirtualEnv/Directory/myvirtualenv/bin/activate_this.py').read(), 
     dict(__file__='/Some/VirtualEnv/Directory/myvirtualenv/bin/activate_this.py'))

Where /Some/VirtualEnv/Directory is a directory and myvirtualenv is the name of the virtual environment in use. On Windows replace bin with Scripts.