This file contains hidden or 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
def dfs(tree): | |
"""Функция для обхода дерева в глубину, представленного в виде вложенных списков.""" | |
if not isinstance(tree, list): # Если текущий узел не является списком, возвращаем его | |
return [tree] | |
result = [] | |
for element in tree: | |
result.extend(dfs(element)) # Рекурсивно обходим каждый элемент | |
return result | |
# Пример использования |
This file contains hidden or 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
% Определяем предикат для префиксного обхода дерева | |
preorder(Tree, List) :- preorder(Tree, [], List). | |
% Базовый случай: пустое дерево приводит к накопленному списку | |
preorder([], Acc, Acc). | |
% Рекурсивный случай: обрабатываем узел и его поддеревья | |
preorder([Node|Subtrees], Acc, List) :- | |
preorder(Subtrees, Acc, NewAcc), % Сначала обрабатываем поддеревья | |
List = [Node|NewAcc]. % Добавляем узел в начало списка |
This file contains hidden or 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
from typing import List, Optional, Tuple, Union | |
import numpy as np | |
import ffmpeg | |
import torch | |
import torch.nn.functional as F | |
import whisper | |
from whisper.audio import SAMPLE_RATE, N_FRAMES, HOP_LENGTH, pad_or_trim, log_mel_spectrogram | |
from whisper.decoding import DecodingOptions, DecodingResult | |
from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE, get_tokenizer |
This file contains hidden or 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
# Quality benchmarks | |
## search service | |
Dataset: validation part from https://multimediacommons.wordpress.com/yfcc100m-core-dataset/. | |
Methodology of measure: add all images to the Index, request TOP100 for each signature, check if the result is a picture by signature, | |
estimate % of hits. | |
acc TOP100: 0.5 | |
## race classification |
This file contains hidden or 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 scala.util.control.NoStackTrace | |
implicit class Formula(strExpr: String) { | |
private trait Expr { | |
def evaluate = { | |
def eval(e: Expr): String = { | |
def sub(s1: String, s2: String): String = if (s1.endsWith(s2)) s1.dropRight(s2.length) else s1 | |
def prod(s1: String, s2: String): String = | |
s1.zip(s2).foldLeft("") { case (acc, (str1, str2)) => acc + str1 + str2 } + s2.drop(s1.length) + s1.drop(s2.length) | |
def div(s1: String, s2: String): String = { |
This file contains hidden or 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
# install soft | |
$soft = ['wget', 'curl', 'zsh', 'cowsay', 'fortune', 'strace', | |
'sudo', 'mc', 'make', 'gcc', 'tree', 'ntpdate', 'dh-make', | |
'debhelper', 'devscripts', 'fakeroot', 'openjdk-7-jdk', 'git', | |
'storm', 'vim', 'md5deep', 'dpkg', 'debconf', 'lintian'] | |
apt::source { 'edisoft': | |
location => 'http://10.20.20.75:8080/static/edisoft', | |
release => 'wheezy', | |
repos => 'main', | |
key => 'D5EFD011', |
This file contains hidden or 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
set confirm | |
set tabstop=4 | |
set shiftwidth=4 | |
set smarttab | |
set et "Expand tab | |
set ai "autoindent | |
set hlsearch | |
set lz "Lazy draw |
This file contains hidden or 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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="robbyrussell" | |
# Example aliases |