Skip to content

Instantly share code, notes, and snippets.

View AlexeySetevoi's full-sized avatar

AlexeySetevoi

  • Cyprus, Limassol
View GitHub Profile
@AlexeySetevoi
AlexeySetevoi / alertmanager.yml
Last active October 16, 2022 21:39
Alertmanager 0.24.0 telegram receiver send example
route:
group_by: [ 'job', 'alertname', 'priority' ]
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'telegram'
routes:
- receiver: 'null'
matchers:
- alertname =~ "InfoInhibitor|Watchdog"
@AlexeySetevoi
AlexeySetevoi / answers.yml
Last active February 5, 2022 02:08
Running gitlab runner in own-hosted kubernetes via official chart, with separate dind deployment and transparent injection DOCKER_HOST in runner pod. Require to enable podpreset alpha api.
## GitLab Runner Image
##
## By default it's using gitlab/gitlab-runner:alpine-v{VERSION}
## where {VERSION} is taken from Chart.yaml from appVersion field
##
## ref: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
##
# image: gitlab/gitlab-runner:alpine-v12.1.0
## Specify a imagePullPolicy
openssl pkcs12 -export -out domain.p12 -inkey privkey.pem -in cert.pem -certfile chain.pem
openssl pkcs12 -export -out domain.p12 -inkey privkey.pem -in fullchain.pem
awk -vDate=`date -d'now-24 hours' +[%d/%b/%Y:%H:%M:%S` ' { if ($4 > Date) print Date FS $4,$7}' access.log |grep aaa > similar24.txt
https://stackoverflow.com/questions/7706095/filter-log-file-entries-based-on-date-range
@AlexeySetevoi
AlexeySetevoi / statistics.sql
Created March 8, 2018 14:33 — forked from ruckus/statistics.sql
Postgres statistics queries
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
----------------------+--------------+---------------+------------------------
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
@AlexeySetevoi
AlexeySetevoi / build-nginx-geoip2-deb.sh
Last active April 17, 2020 11:33
nginx geoip2 debian
#!/bin/bash
nginxver=`apt show nginx-full |grep Version | awk '{print $2}' |awk -F '-' '{print $1}'`
nginxname=nginx-$nginxver.tar.gz
nginxdir=nginx-$nginxver
#apt -y install libmaxminddb0 libmaxminddb-dev mmdb-bin
if [ -f "$nginxname" ]
@AlexeySetevoi
AlexeySetevoi / attr.sql
Last active April 17, 2017 14:02
mysql pivot attr reverse(also now as pivot-table) as view
SET @sql = NULL;
SET @sourcetable = 'Table';
set @viewname = CONCAT(@sourcetable,'F');
SET @@group_concat_max_len = 10000;
SELECT GROUP_CONCAT(DISTINCT
CONCAT(
'MAX(IF(name = ''',
name,
''', data, NULL)) AS ',
'''',
@AlexeySetevoi
AlexeySetevoi / docker-compose.yml
Last active April 10, 2017 08:00
Docker compose selenium hub + nodes
version: '2'
services:
hub:
image: selenium/hub
ports:
- 4444:4444
networks:
- front-tier
- back-tier
@AlexeySetevoi
AlexeySetevoi / env.example.yml
Last active November 27, 2018 14:42
Systemd unit template to run multi-instance sphinx 2, jinja2-ansible. Sphinx 2 jinja config.
env: "dev"
sphinx_instname: "searchd-{{ env }}"
sphinx_run_path: "/var/run/sphinxsearch"
sphinx_log_path: "/var/log/sphinxsearch"
sphinx_data_path: "/var/lib/sphinxsearch/{{ sphinx_instname }}"
sphinx_confname: "{{ sphinx_instname }}.conf"
sphinx_sock_path: "{{ sphinx_run_path }}/{{ sphinx_instname }}.sock"
sphinx_pid_path: "{{ sphinx_run_path }}/{{ sphinx_instname }}.pid"
sphinx_sockmysql_path: "{{ sphinx_run_path }}/{{ sphinx_instname }}-mysql.sock"
sphinx_sockmysql_conf: "{{ sphinx_sockmysql_path }}:mysql41"