This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2021/04/09 11:52:11 INFO fsmsupport.go:252 - *** Entering state SET_KERNELCONFIG after getting event: salt_finished (Src: SALT_COMPUTE_RUNNING) | |
fatal error: sync: RUnlock of unlocked RWMutex | |
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x11f6601] | |
goroutine 1 [running]: | |
runtime.throw(0x14ed190, 0x21) | |
/jump/software/rhel7/golang-1.16/src/runtime/panic.go:1117 +0x72 fp=0xc00001b478 sp=0xc00001b448 pc=0x4447f2 | |
sync.throw(0x14ed190, 0x21) | |
/jump/software/rhel7/golang-1.16/src/runtime/panic.go:1103 +0x35 fp=0xc00001b498 sp=0xc00001b478 pc=0x4758b5 | |
sync.(*RWMutex).rUnlockSlow(0xc0004fc5d8, 0xffffffff) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def append_one(data=[]): | |
data.append(1) | |
return data | |
### What does this function return for | |
1. `append_one()` | |
2. `append_one(data=[2])` | |
3. `append_one()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/var/www/myip.html: | |
file.managed: | |
- source: salt://roles/wordpress/files/myip.html.jinja | |
- user: root | |
- group: root | |
- mode: 640 | |
- template: jinja | |
- context: | |
hostname: {{ grains['fqdn'] }} | |
ip: {{ salt['network.interfaces']()['eth0']['ipaddr'] }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName balancer.local | |
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED | |
<Location /balancer-manager> | |
ProxyPass ! | |
SetHandler balancer-manager | |
#Require host example.com | |
Require host localhost | |
</Location> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro postconf(key, value) -%} | |
postconf-{{ key }}: | |
cmd: | |
- run | |
- name: | |
- postconf -e {{ key }}='{{ value }}' | |
- unless: test "x$(postconf -h {{ key }} )" = 'x{{ value }}' | |
- require: | |
- pkg: postfix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Courtesy of https://github.com/wimglenn | |
import sys | |
try: | |
import builtins | |
except ImportError: | |
# py2 | |
import __builtin__ as builtins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally based on: http://djangosnippets.org/snippets/1872/ | |
# Requires sqlparse: http://pypi.python.org/pypi/sqlparse | |
import time | |
from django.test.signals import template_rendered | |
from django.conf import settings | |
from django.db import connection | |
from django.utils.encoding import force_unicode | |
from django.utils.safestring import mark_safe | |
TEMPLATE = """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################## 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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def which(exe=None): | |
''' | |
Python clone of POSIX's /usr/bin/which | |
''' | |
if exe: | |
(path, name) = os.path.split(exe) | |
if os.access(exe, os.X_OK): | |
return exe | |
for path in os.environ.get('PATH').split(os.pathsep): | |
full_path = os.path.join(path, exe) |