Instantly share code, notes, and snippets.

View gist:8883c3a2e570c64800bd51554c3d199d
1. Stop Kafka.
2. In Custom kafka-broker section in Ambari Configs, click Add Property and create
inter.broker.protocol.version with the following values and click Save.
Key: inter.broker.protocol.version
Value: CURRENT_KAFKA_VERSION
Where CURRENT_KAFKA_VERSION is the version of Kafka you are currently running. For
example, 0.10.1.
3. In Custom kafka-broker section in Ambari Configs, click Add Property and
createlog.message.format.version with the following values and click Save.
Key: log.message.format.version
View gist:dd335f2ecfbede3ea9cfd45e5db6af64
https://blog.seocahill.com/docker-postgres-cluster-with-high-availability-and-disaster-recovery/
https://github.com/paunin/PostDock
https://github.com/zalando/spilo
https://github.com/sorintlab/stolon
View gist:a6464bff942934c64607698218590710
#!/bin/bash
# If specified value is true, return valid
# Else return invalid
#
# Allows concatenation via && and ||
evaluate_boolean() {
if [ "${1}" == "True" ] || \
[ "${1}" == "true" ] || \
[ "${1}" == "1" ]; then
View gist:a3269f6a4ed54fbac8060578066f1dce
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "icinga_dbversion" does not exist
LINE 1: SELECT icinga_dbversion.version FROM icinga_dbversion
^, query was: SELECT icinga_dbversion.version FROM icinga_dbversion
#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(816): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array)
#4 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(1400): Zend_Db_Adapter_Abstract->fetchOne(Object(Zend_Db_Select))
#5 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(832): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->getIdoVers
View gist:605da6fd3a745363586cdc4270c5842f
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "icinga_dbversion" does not exist
LINE 1: SELECT icinga_dbversion.version FROM icinga_dbversion
^, query was: SELECT icinga_dbversion.version FROM icinga_dbversion
#0 /usr/share/icingaweb2/library/vendor/Zend/Db/Statement.php(297): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(470): Zend_Db_Statement->execute(Array)
#2 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(String, Array)
#3 /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/Abstract.php(816): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Select), Array)
#4 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(1400): Zend_Db_Adapter_Abstract->fetchOne(Object(Zend_Db_Select))
#5 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php(832): Icinga\Module\Monitoring\Backend\Ido\Query\IdoQuery->getIdoVers
View 0_python_email.md

Use Python to:

  • send a plain text email
  • send an email with attachment
  • receive and filter emails according to some criteria
View supervisord.service
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
View gist:915ff15d697d614fe7c874ba497ef42f
>>> print path
/filedrop-dev/folder3new
>>> print key
/filedrop-dev/folder3new
>>> print bad_key
/filedrop-dev/folder
>>> p = re.compile(bad_key)