Skip to content

Instantly share code, notes, and snippets.

View AnvilFox1965's full-sized avatar

Alexander Aprelikov AnvilFox1965

View GitHub Profile
@AnvilFox1965
AnvilFox1965 / alertmanager.yml
Created April 22, 2025 10:14 — forked from sanchpet/alertmanager.yml
Telegram message template for Alertmanager & how to add it to your receiver in alertmanager.yml
receivers:
- name: 'Default'
telegram_configs:
- bot_token: <token>
api_url: https://api.telegram.org
chat_id: <chat_id>
message_thread_id: <message_thread_id> # for supergroups with threads
parse_mode: 'HTML'
message: '{{ template "telegram.message". }}'
@AnvilFox1965
AnvilFox1965 / Grafana Alert Template.md
Created April 22, 2025 10:14 — forked from gelldur/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{- /* Telegram message to use: {{ template "telegram.message2" . }} */ -}}
    {{ define "__alerts_list" -}}
    {{ range . }}
    {{if ne (index .Labels "alertname") "" -}}
    {{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }}
        {{- if ne (index .Labels "severity") "" -}}
            <u><b>P{{ index .Labels "severity" }}</b></u> {{ end -}}
@AnvilFox1965
AnvilFox1965 / nginx_deployment.yaml
Created April 14, 2025 19:29 — forked from petitviolet/nginx_deployment.yaml
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@AnvilFox1965
AnvilFox1965 / docker-compose-backup.sh
Created June 20, 2024 23:02 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@AnvilFox1965
AnvilFox1965 / psql_useful_stat_queries.sql
Created June 14, 2024 12:50 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
This gist I write, because I couldn't find step by step instructions
how to install and start postgresql locally (using conda within a conda environment - with the result
that you can run it without sudo/admin rights on your machine!)
and not globally in the operating system (which requires sudo/admin rights on that machine).
I hope, this will help especially people new to postgresql (and those who don't have sudo/admin rights on a specific machine but want
to run postgresql there)!
####################################
# create conda environment
@AnvilFox1965
AnvilFox1965 / pgcopy.sh
Created February 6, 2024 20:28 — forked from wylee/pgcopy.sh
Bash script to copy a Postgres database from one host/instance to another
#!/bin/bash
#
# NOTE: Although this script attempts to be safe, it has the potential
# to be highly destructive; please run with caution.
#
# This copies the specified database from pgsql.rc.pdx.edu to
# postgresql.rc.pdx.edu.
#
# If the database is PostGIS-enabled, use the --postgis flag. This also
# requires that postgis_restore.pl is on your $PATH.
@AnvilFox1965
AnvilFox1965 / confirm.Makefile
Created November 28, 2023 20:28 — forked from Pierstoval/confirm.Makefile
"confirm" action for your Makefile
# To use the "confirm" target inside another target,
# use the " if $(MAKE) -s confirm ; " syntax.
mycommand:
@if $(MAKE) -s confirm ; then \
execute_your_command_here ; \
fi
.PHONY: mycommand
# The CI environment variable can be set to a non-empty string,
@AnvilFox1965
AnvilFox1965 / nginx.conf
Created June 22, 2022 17:21 — forked from jsutlovic/nginx.conf
nginx + uwsgi local configs
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@AnvilFox1965
AnvilFox1965 / postgres_queries_and_commands.sql
Created June 11, 2022 16:12 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'