Skip to content

Instantly share code, notes, and snippets.

@Tishka17
Tishka17 / confirm.py
Last active October 5, 2023 10:07
aiogram-dialog Confirmation Dialog with StatesGroup generation
import asyncio
import logging
import operator
from typing import Any, Tuple, List
from aiogram import Bot, Dispatcher
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.dispatcher.filters.state import (
StatesGroup, State, StatesGroupMeta,
)
@davidfowl
davidfowl / .NET6Migration.md
Last active April 11, 2025 11:12
.NET 6 ASP.NET Core Migration
@ststeiger
ststeiger / RSAKeys.cs
Created October 25, 2018 11:29 — forked from therightstuff/RSAKeys.cs
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@svet-b
svet-b / bigdashboard_output.pdf
Last active April 23, 2025 03:06
PDF export of Grafana dashboard using puppeteer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svet-b
svet-b / grafana_pdf_via_snapshot.md
Last active December 27, 2022 09:01
PDF export of Grafana dashboard via snapshot

Get PDF export of Grafana dashboard

Note

As currently described, this approach does not work. The reason for that is that creating a snapshot via the API does not actually populate any data, as described in e.g. https://community.grafana.com/t/snapshot-using-http-api-does-nothing/. An alternative approach which does work described in https://gist.github.com/svet-b/1ad0656cd3ce0e1a633e16eb20f66425.

Prerequisites

Packages:

  • The jq JSON processing command line tool, which is available for most distributions (https://stedolan.github.io/jq/, sudo apt install jq)
  • NodeJS, and the puppeteer package (npm install puppeteer), which is used to run headless Chrome
@SleepyLctl
SleepyLctl / test.txt
Created July 16, 2018 05:56
Test Strings
EICAR Test String
(anti-virus) X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
When an anti-virus program scans this file, it reports that it finds the EICAR-STANDARD-AV-TEST-FILE virus.
GTUBE Test String
(spam) XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
For further information, see: http://spamassassin.apache.org/gtube/.
@gitfvb
gitfvb / aws_s3.ps1
Created May 16, 2018 17:41
native powershell for AWS S3
<#########################
LINKS
#########################>
<#
resource: https://devops.profitbricks.com/api/s3/
@nblumhardt
nblumhardt / Program.cs
Last active January 12, 2025 19:31
Enrich.WithCaller()
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using Serilog;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
namespace ConsoleApp24
@mdonkers
mdonkers / server.py
Last active April 4, 2025 13:11
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@zmts
zmts / tokens.md
Last active April 27, 2025 21:01
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов