Skip to content

Instantly share code, notes, and snippets.

View mrkiril's full-sized avatar
🏠
Working from home

Kyrylo Kukhelnyi mrkiril

🏠
Working from home
View GitHub Profile
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@popravich
popravich / PostgreSQL_index_naming.rst
Last active July 19, 2024 06:03
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@zmts
zmts / tokens.md
Last active July 22, 2024 10:27
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

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

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@dankrause
dankrause / postgresql_recursive.sql
Last active February 26, 2024 16:03
An example of creating a recursive postgresql query to generate data about parent-child relationships within a single table.
CREATE TABLE test
(
id INTEGER,
parent INTEGER
);
INSERT INTO test (id, parent) VALUES
(1, NULL),
(2, 1),
@kingbuzzman
kingbuzzman / jwt_test.py
Last active February 29, 2024 15:59
JWT test with private/public keys
import jwt
import time
import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
# Load the key we created
with open("mykey.pem", "rb") as key_file:
private_key = serialization.load_pem_private_key(
@flyingdogz
flyingdogz / fb-deletion-callback-example.py
Last active April 21, 2021 12:16
Example implementation of Facebook Data Deletion Callback in Python
import base64
import hashlib
import hmac
import json
from flask import Flask, jsonify, request
app = Flask(__name__)
@Kludex
Kludex / main.py
Last active April 17, 2024 01:55
Document each version on FastAPI
from fastapi import APIRouter, FastAPI
from utils import create_versioning_docs
app = FastAPI(docs_url=None, redoc_url=None)
v1_router = APIRouter(prefix="/v1")
v2_router = APIRouter(prefix="/v2")
@vicchi
vicchi / main.py
Last active September 5, 2023 09:59
Versioned documentation in FastAPI, based on https://gist.github.com/Kludex/1c515aa38d22ec28d514da6b6f36da9f
# uvicorn main:app --host $(hostname) --port 8080 --log-level debug --reload
from fastapi import APIRouter, FastAPI
from utils import create_versioned_docs
VERSION = '2.0.0'
TITLE = 'Sample Versioned API'
DESCRIPTION = 'Sample versioned API blurb'
app = FastAPI(docs_url=None, redoc_url=None, title=TITLE, version=VERSION, description=DESCRIPTION)
@44213
44213 / ffmpeg-commands.sh
Created September 17, 2021 19:51 — forked from rowe-morehouse/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image: