Skip to content

Instantly share code, notes, and snippets.

@gelldur
gelldur / Grafana Alert Template.md
Last active April 4, 2025 16:52 — forked from Himura2la/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 -}}
@KANekT
KANekT / DeclensionGenerator
Created May 3, 2018 13:02
Склонение числительных в C#
public class DeclensionGenerator
{
/// <summary>
/// Возвращает слова в падеже, зависимом от заданного числа
/// </summary>
/// <param name="number">Число от которого зависит выбранное слово</param>
/// <param name="nominativ">Именительный падеж слова. Например "день"</param>
/// <param name="genetiv">Родительный падеж слова. Например "дня"</param>
/// <param name="plural">Множественное число слова. Например "дней"</param>
/// <returns></returns>
@lkaczanowski
lkaczanowski / CustomHandleErrorAttribute.cs
Last active November 14, 2020 00:33
Custom ASP.NET MVC handle error attribute. Handles and logs all errors.
public class CustomHandleErrorAttribute : HandleErrorAttribute
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public override void OnException(ExceptionContext filterContext)
{
if (!filterContext.HttpContext.IsCustomErrorEnabled)
{
return;
}
@mabster
mabster / gist:3174380
Created July 25, 2012 04:23
Entity Framework and Interfaces
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
namespace ConsoleApplication5
{
public interface IFoo
{