Skip to content

Instantly share code, notes, and snippets.

View jafrancov's full-sized avatar
🐍

Alex Franco jafrancov

🐍
View GitHub Profile
@rbtsolis
rbtsolis / middleware.py
Created May 3, 2018 02:46
Django Access the Request or User Object Inside the Models and Signals
# 1) Create a middlewares/middlewares.py file and copy this:
import threading
class RequestMiddleware:
def __init__(self, get_response, thread_local=threading.local()):
self.get_response = get_response
self.thread_local = thread_local
# One-time configuration and initialization.
@joncutrer
joncutrer / windows-service-check.py
Last active September 27, 2023 09:08
Python: Check if Windows Service is running|installed without pywin32
import psutil
#
# Python Script to Check if...
# Windows Service is found|installed,stopped|running without pywin32
# Found at https://stackoverflow.com/questions/33843024
# Update to work on python 3.x
#
def getService(name):
@joepreludian
joepreludian / .pylintrc
Created January 26, 2015 19:04
Pylint rc file template for django projects. Ignores migrations and test suites.
[MASTER]
profile=no
persistent=yes
ignore=tests.py, urls.py, migrations
cache-size=500
[MESSAGES CONTROL]
# C0111 Missing docstring
# I0011 Warning locally suppressed using disable-msg
# I0012 Warning locally suppressed using disable-msg
@plentz
plentz / nginx.conf
Last active July 30, 2024 09:24
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048