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
# borrowed from http://stackoverflow.com/questions/32324120/arbitrary-host-name-resolution-in-ansible | |
# might be used as {{ lookup('ip', 'www.google.com') }} | |
import socket | |
import ansible.errors as errors | |
class LookupModule(object): | |
def __init__(self, basedir=None, **kwargs): | |
self.basedir = basedir |
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
echo '{"json":"obj"}' | python -m json.tool |
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
from suds.sudsobject import Object as SudsObject | |
obj = SudsObject() | |
obj.Title = "My title" | |
obj.JustAList = [1, 2, 3] | |
obj.Child = SudsObject() | |
obj.Child.Title = "Child title" | |
obj.Child.AnotherList = ["4", "5", "6"] | |
child_obj = SudsObject() |
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
nginx version: nginx/1.4.6 (Ubuntu) | |
# 1. passwords | |
both password are ‘123’ passed through openssl passwd | |
# cat /etc/nginx/default.htpasswd | |
# default:ZE3exsFczUZUY | |
# cat /etc/nginx/test.htpasswd | |
# test:ZE3exsFczUZUY |
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
import logging | |
import sys | |
# Traces what's updating the logging configuration | |
# https://stackoverflow.com/questions/28694540/python-default-logger-disabled | |
def get_disabled(self): | |
return self._disabled | |
def set_disabled(self, disabled): |
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
# https://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl | |
openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 |
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
# https://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection | |
SELECT | |
pg_terminate_backend(pid) | |
FROM | |
pg_stat_activity | |
WHERE | |
-- don't kill my own connection! | |
pid <> pg_backend_pid() | |
-- don't kill the connections to other databases | |
AND datname = 'database_name' |
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
redis-benchmark -n 1000000 -r 1000000 -q -P 32 zadd zset __rand_int__ __rand_int__ |
OlderNewer