Skip to content

Instantly share code, notes, and snippets.

@jidckii
jidckii / alertmanager.tmpl
Created April 5, 2023 14:08
Alertmanager telegram template
{{ define "__yucca_text_alert_list" }}{{ range . }}
---
🪪 <b>{{ .Labels.alertname }}</b>
{{- if .Annotations.summary }}
📝 {{ .Annotations.summary }}{{ end }}
{{- if .Annotations.description }}
📖 {{ .Annotations.description }}{{ end }}
🏷 Labels:
{{ range .Labels.SortedPairs }} <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
{{ end }}{{ end }}
@realkarmakun
realkarmakun / grafana-alertmanager-telegram-template
Last active January 3, 2023 19:11
Grafana alertmanager Telegram Template. Just some Telegram template I use for my Grafana alerts
{{ define "TelegramAlert" }}
{{ if eq .Status "firing" }}🔥<b>[FIRING {{end}}{{ if eq .Status "resolved" }}✅<b>[RESOLVED {{end}}ALERT]</b>
{{ range .Alerts -}}
🔎 <b>Title:</b> <i>{{ .Annotations.title }}</i>
{{ if .Labels.severity }} 📖 <b>Status:</b> `{{ .Labels.severity }}`{{ end }}
🏷️ <b>Labels:</b>
{{ range .Labels.SortedPairs }} 🔖 <i><b>{{ .Name }}:</b> {{ .Value }}</i>
{{end}}
📚 <b>Description:</b> {{ .Annotations.description }}
{{ if gt (len .GeneratorURL) 0 }}💥 <b>Source:</b> {{ .GeneratorURL }}{{ end }}
from flask import Flask, request, jsonify
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
app = Flask(__name__)
def send_test_mail(body):
@danielalvarenga
danielalvarenga / terminal-colors-branch.sh
Last active May 18, 2024 16:39
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"