Skip to content

Instantly share code, notes, and snippets.

View David-Guillot's full-sized avatar

David Guillot David-Guillot

View GitHub Profile
@ipmb
ipmb / strawman.md
Created October 23, 2024 15:14
Django Configuration Loader Strawman

A generic configuration loader for Django. Configuration is the term I’m using for environment-specific settings values. Most settings are static and don’t change from environment-to-environment, but some like DATABASES or SECRET_KEY should.

Inspired by dataclasses and Pydantic.

Users should define a class which inherits from a Configuration class:

class Config(Configuration):
    DEBUG: bool = False  # value with default
    SECRET_KEY: str      # value with no default (raises an error if not provided)
@DoubleYouEl
DoubleYouEl / spam_decode.py
Last active August 19, 2025 11:25 — forked from lkraider/spam_decode.py
X-OVH-SPAMCAUSE decoder
def decode(msg):
text = ""
for i in range(0, len(msg), 2):
text += unrot(msg[i: i + 2], i // 2) # add position as extra parameter
return text
def unrot(pair, pos, key=ord('x')):
if pos % 2 == 0: # "even" position => 2nd char is offset
pair = pair[1] + pair[0] # swap letters in pair
@radiofrequency
radiofrequency / aws_import.sh
Created January 3, 2018 03:56
Import lets encrypt cert to aws certificate manager in renew hook
#place in /etc/letsencrypt/renewal-hooks/post
export AWS_ACCESS_KEY_ID=XXX
export AWS_SECRET_ACCESS_KEY=XXX
#certs must be in us-east-1 to use with cloudfront
export AWS_DEFAULT_REGION=us-east-1
#run without --certificate-arn first time then specify arn for updates
aws acm import-certificate --certificate file:///etc/letsencrypt/live/site.com/cert.pem --private-key file:///etc/letsencrypt/live/site.com/privkey.pem --certificate-chain file:///etc/letsencrypt/live/site.com/chain.pem --certificate-arn specifyarnforupdate