Skip to content

Instantly share code, notes, and snippets.

View amureki's full-sized avatar
😮‍💨
taking a break, will be back in June

Rust Saiargaliev amureki

😮‍💨
taking a break, will be back in June
View GitHub Profile
@amureki
amureki / base.py
Created November 29, 2022 08:51
Django PostgreSQL backend with connection logging
import logging
import os
import time
from django.contrib.gis.db.backends.postgis.base import (
DatabaseWrapper as PostGISDatabaseWrapper,
)
logger = logging.getLogger(__name__)
@amureki
amureki / mixins.py
Last active March 25, 2019 08:48
Python/Django typing and circular dependencies
from module.models import MainThing
class ActivityMixin:
is_active = models.BooleanField(default=False)
def activate(self: MainThing):
# Type definition up there would help PyCharm and other editors
# to know that they could access the method of the main class,
# BUT it requires an import of the model, which leads to a circular import issue.
# How can we solve it?

Keybase proof

I hereby claim:

  • I am amureki on github.
  • I am amureki (https://keybase.io/amureki) on keybase.
  • I have a public key whose fingerprint is 9D48 0653 4823 3CB5 DB6D 4BF4 DB45 6B12 92FC 4F63

To claim this, I am signing this object:

# Adds 3-sec fading out title image before video.
# What's going on here: We get title.png image, loop it for 3 sec video, create 3 sec silence, get video.mp4 (framerate 25). Next, we add fade out filter on looped image video, after that we concat our image video, audio silence and main video into one. Easy peasy.
ffmpeg -loop 1 -framerate 25 -t 3 -i title.png -t 3 -f lavfi -i aevalsrc=0 -i video.mp4 -filter_complex '[0:0]fade=out:50:25:alpha=1[title]; [title][1:0][2:0][2:1] concat=n=2:v=1:a=1' output.mp4
name,email
hello,test@test.ru
hello2,test2@test.ru