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 October 23, 2024 18:30
.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 October 22, 2024 21:15
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
@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 September 4, 2024 10:05
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 November 15, 2024 20:01
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 November 19, 2024 17:55
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)