This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MOTION_VECTOR | |
* | |
* Calculates motion vector using ffmpeg and libavcodec. | |
* | |
* @authors First modifications by Victor Hsieh. | |
* Second modifications by Jiasi Chen. | |
* Third modifications by Ilya Nikitin <w@w-495.ru>. | |
* | |
* @date: 2014.05.10 23:30:13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
Простой текстовый консольный видео-плеер. | |
Выводит кадры в символьном представлении на стандартный вывод. | |
Поддержки звука нет. | |
Как пользоваться: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
import collections | |
import types | |
import itertools | |
class SlidingWindow(collections.deque): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Shortcuts] | |
activate_last_tab=Alt+0 | |
activate_next_tab=Ctrl+PgDown; Ctrl+]; Ctrl+Tab | |
activate_prev_tab=Ctrl+PgUp; Ctrl+[; Ctrl+Shift+Tab | |
activate_tab_0=Alt+1 | |
activate_tab_1=Alt+2 | |
activate_tab_2=Alt+3 | |
activate_tab_3=Alt+4 | |
activate_tab_4=Alt+5 | |
activate_tab_5=Alt+6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% @file test.erl Реализация генератора чисел Фиббоначи. | |
%%% Результатом работы генератора должна | |
%%% быть пара {очередное_число, генератор_следующего_числа}. | |
%%% | |
%%% Для ускорения счета используется классическая рекурсивная мемоизация. | |
%%% Она Реализована через оператор неподвижной точки. | |
%%% Крайне эффективна для рекурсивных функций. | |
%%% | |
%%% Можно реализовать и простую мемоизацию для данного примера. | |
%%% Будем запоминать только последний вариант чисел фиббоначи, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import logging | |
class AddLoggerMeta(type): | |
def __new__(mcs, class_name, bases, attr_dict): | |
attr_dict[f'_{class_name}__logger'] = logging.getLogger(class_name) | |
return super().__new__(mcs, class_name, bases, attr_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import logging | |
__logger = logging.getLogger(__name__) | |
def global_function(): | |
__logger.error('global_function') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import av | |
from av.video.frame import VideoFrame | |
from av.video.stream import VideoStream | |
# В этом списке будем хранить кадры в виде numpy-векторов. | |
array_list = [] | |
# Откроем контейнер на чтение | |
input_container = av.open('input.mp4') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
import av | |
# Откроем ресурс на чтение | |
input_resource = av.open( | |
'rtmp://src_stream:1935/play' | |
) | |
# Откроем ресурс на запись. | |
output_resource = av.open( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
@file magic_buffer.c | |
Пример использования библиотеки libmagic. | |
Ниже показано как собирать и тестировать файл: | |
$> gcc magic_buffer.c -lmagic -I/usr/include/magic -Wall -o magic_buffer | |
$>./magic_buffer "asas" 2> errr | |
text/plain | |
$>./magic_buffer "<?xml version="1.0" encoding="utf-8"?><x>абырвалг</x>" | |
application/xml | |
$>./magic_buffer "<?xml" |
NewerOlder