Skip to content

Instantly share code, notes, and snippets.

@SEJeff
SEJeff / settings_logging.py
Created July 8, 2011 22:19
How to enable debug logging for django_auth_ldap
############################## django-auth-ldap ##############################
if DEBUG:
import logging, logging.handlers
logfile = "/tmp/django-ldap-debug.log"
my_logger = logging.getLogger('django_auth_ldap')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.RotatingFileHandler(
logfile, maxBytes=1024 * 500, backupCount=5)
@SEJeff
SEJeff / settings_ldap.py
Created July 8, 2011 22:27
Example django_auth_ldap configuration
############################## django-auth-ldap ##############################
import ldap
from django_auth_ldap.config import LDAPSearch, PosixGroupType
# django-auth-ldap configuration starts here
AUTH_LDAP_SERVER_URI = "ldap://ldap.els03.loc ldap://ldap.zbw03.loc ldap://ldap.cvg03.loc"
#AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=People,o=loc"
# JW is in ou=Admin,o=loc so we search over o=loc to find him
AUTH_LDAP_USER_SEARCH = LDAPSearch("o=loc",
@etchalon
etchalon / gist:4493752
Last active October 28, 2018 07:03
Query String alteration template tag for Django.
"""
Query String manipulation filters
"""
import logging
from django import template
from django.http import QueryDict
from django.utils.translation import ugettext as _
@plentz
plentz / nginx.conf
Last active July 22, 2024 11:19
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
From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
From: Bearice Ren <bearice@icybear.net>
Date: Tue, 20 Sep 2016 11:52:08 +0800
Subject: [PATCH] add filter-aaaa option
---
src/dnsmasq.h | 3 ++-
src/option.c | 3 +++
src/rfc1035.c | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
@allykzam
allykzam / 1_settings.diff
Created July 22, 2014 15:42
GitLab SSH URL change
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index f55e69c..b6f1ad9 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -10,11 +10,7 @@ class Settings < Settingslogic
private
def build_gitlab_shell_ssh_path_prefix
- if gitlab_shell.ssh_port != 22
- "ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/"
@abn
abn / heredoc-dockerfile.snip
Last active June 16, 2024 22:01
Dockerfile alternatives for heredoc
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
>> /tmp/hello
#echo
RUN echo -e '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2'\
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active July 22, 2024 18:14
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@brake
brake / argparse_demo.py
Created March 7, 2015 19:32
2.5 argparse tricks (sample code)
# -*- coding: UTF-8 -*-
"""
CLI скрипт, поддерживающий две ветви параметров:
userdb.py append <username> <age>
userdb.py show <userid>
Заглушка предусматривает, что:
пользователь с именем admin уже существует
по userid = 1 всегда возвращается User(name='admin', age=20)
@Jaza
Jaza / Private-pypi-howto
Last active July 2, 2023 16:24
Guide for how to create a (minimal) private PyPI repo, just using Apache with directory autoindex, and pip with an extra index URL.
*