Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry Verkhoturov paskal

View GitHub Profile
@paskal
paskal / Readme.md
Last active Sep 14, 2021
How to set up the Percona Monitoring and Management (PMM) v2 with docker-compose
View Readme.md

Set up PMM Server v2

Let's start by creating entry for server in docker-compose.yaml:

version: '2'
# version 2 of docker-compose is not "old" version, it's the actual version,
# see below for explanation:
# https://stackoverflow.com/a/53636006/961092
services:
View resume.json
{
"meta": {
"theme": "kendall",
"canonical": "https://github.com/paskal/terrty/blob/master/cv/resume.json"
},
"basics": {
"name": "Dmitry Verkhoturov",
"label": "Senior Site Reliability Engineer",
"picture": "https://terrty.net/images/avatar.jpg",
"email": "paskal.07@gmail.com",
@paskal
paskal / expand_macro.py
Last active Jul 26, 2018
Recuresively resolve Zabbix user macro within string
View expand_macro.py
import re
import logging
def expand_macro(zapi, itemid, hostid, macro):
"""Expand macro in passed string, recursively. Non-existent macro resolved to empty string.
Example:
# {$MACRO} resolves to "test macro in ${ENV} environment"
# {$ENV} resolves to "dev"
>>> print(expand_macro(zapi, 12345, 54321, "string with {$MACRO}"))
@paskal
paskal / zabbix_find_unused_macroses.sql
Last active Jul 2, 2017
Find hosts\templates macroses, unused by items and triggers (including autodiscovery)
View zabbix_find_unused_macroses.sql
SELECT m.hostid,
m.macro
FROM hostmacro AS m
WHERE
NOT (SELECT count(*)
FROM functions AS f
JOIN items AS i ON i.itemid = f.itemid
WHERE i.hostid = m.hostid
AND f.parameter LIKE concat('%',m.macro,'%'))
AND NOT
View imap_cleaner.py
#!/usr/bin/env python
#
# imap_cleaner.py
#
# Copyright 2012 Konstantin Shcherban <k.scherban@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@paskal
paskal / site.conf
Last active Aug 6, 2021 — forked from plentz/nginx.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
View site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null