From d617d3cbc832fec344c02cfa38481380e1f2ff40 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:00:25 +0300 Subject: [PATCH] Initial commit --- .gitattributes | 2 + C++.txt | 35 ++ Commit messages.txt | 9 + PowerShell.txt | 33 ++ PublishConceptPortal.ps1 | 13 + Python.txt | 36 ++ configs/.gitignore | 9 + configs/Dockerfile | 58 +++ configs/NuGet.Config | 6 + configs/VSCODE_settings.json | 235 ++++++++++ configs/VSCustom.ruleset | 658 ++++++++++++++++++++++++++++ configs/concept-options.json | 4 + configs/native.clang-tidy | 29 ++ configs/vscode_python_settings.json | 22 + configs/win32.clang-tidy | 43 ++ devops/SETUP GITEA.txt | 3 + devops/SETUP PRODUCTION.txt | 57 +++ devops/arch/SETUP SERVER.txt | 54 +++ devops/arch/SETUP UBUNTU BUILD.txt | 39 ++ devops/arch/SETUP WINDOWS BUILD.txt | 38 ++ devops/arch/SETUP WINDOWS EDIT.txt | 14 + devops/prod commands.txt | 90 ++++ devops/scripts/ImportGTest.txt | 15 + devops/scripts/MergeIntoMaster.bat | 19 + devops/scripts/OpenCppCoverage.bat | 3 + devops/setup google-benchmark.txt | 26 ++ devops/windows tools.txt | 8 + git.txt | 54 +++ python_libs/Natasha.txt | 42 ++ python_libs/Pymorphy.txt | 14 + python_libs/graphviz.txt | 16 + python_libs/vosk.txt | 55 +++ 32 files changed, 1739 insertions(+) create mode 100644 .gitattributes create mode 100644 C++.txt create mode 100644 Commit messages.txt create mode 100644 PowerShell.txt create mode 100644 PublishConceptPortal.ps1 create mode 100644 Python.txt create mode 100644 configs/.gitignore create mode 100644 configs/Dockerfile create mode 100644 configs/NuGet.Config create mode 100644 configs/VSCODE_settings.json create mode 100644 configs/VSCustom.ruleset create mode 100644 configs/concept-options.json create mode 100644 configs/native.clang-tidy create mode 100644 configs/vscode_python_settings.json create mode 100644 configs/win32.clang-tidy create mode 100644 devops/SETUP GITEA.txt create mode 100644 devops/SETUP PRODUCTION.txt create mode 100644 devops/arch/SETUP SERVER.txt create mode 100644 devops/arch/SETUP UBUNTU BUILD.txt create mode 100644 devops/arch/SETUP WINDOWS BUILD.txt create mode 100644 devops/arch/SETUP WINDOWS EDIT.txt create mode 100644 devops/prod commands.txt create mode 100644 devops/scripts/ImportGTest.txt create mode 100644 devops/scripts/MergeIntoMaster.bat create mode 100644 devops/scripts/OpenCppCoverage.bat create mode 100644 devops/setup google-benchmark.txt create mode 100644 devops/windows tools.txt create mode 100644 git.txt create mode 100644 python_libs/Natasha.txt create mode 100644 python_libs/Pymorphy.txt create mode 100644 python_libs/graphviz.txt create mode 100644 python_libs/vosk.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/C++.txt b/C++.txt new file mode 100644 index 0000000..02a3fe1 --- /dev/null +++ b/C++.txt @@ -0,0 +1,35 @@ +Upgrade code: 7E57EE0B-9FF4-4A12-9776-B5B7FBBC803E + +00. give maximum info to compiler +01. express intent +02. const correctness - values, refs, in-build types +03. full logic (dont skip else after return) +04. skip control block if possible +05. use reference for polymorphism +06. pointer is a nullable reference +07. use smart pointers for ownership +08. use RAII for cleanup on errors +09. dont =delete move ctor (delete copy ctor instead) +10. auto stick and auto deduce! +11. west const +12. noexcept false if noexcept was considered and discarded +13. use algorithm and numeric instead of loops +14. maybe unused to combat assert warnings in realease build +15. nodiscard if function doesnt mutate any state +16. mark unreachable code to draw attention +17. dont use && and || to compose differenet semantic checks! +18. dont bundle return points together! +19. dont mix virtual inheritance and MFC classes + +Именование идентификаторов ресурсов + +IXTRAD - ассоциации файлов, меню и иконов для типов документов +IXTRR - иконки, картинки, курсоры и проч +IXTRC - комманды, контролы +IXTRD - диалоги + +IXTRE - сообщения об ошибка +IXTRS - строки +IXTRO - имена параметров в реестре + +ID, IDC, AFX - идентификаторы MFC \ No newline at end of file diff --git a/Commit messages.txt b/Commit messages.txt new file mode 100644 index 0000000..30685c4 --- /dev/null +++ b/Commit messages.txt @@ -0,0 +1,9 @@ +https://chris.beams.io/posts/git-commit/ + +1. Separate subject from body with a blank line +2. Limit the subject line to 50 characters +3. Capitalize the subject line +4. Do not end the subject line with a period +5. Use the imperative mood in the subject line +6. Wrap the body at 72 characters +7. Use the body to explain what and why vs. how \ No newline at end of file diff --git a/PowerShell.txt b/PowerShell.txt new file mode 100644 index 0000000..5536a5e --- /dev/null +++ b/PowerShell.txt @@ -0,0 +1,33 @@ +0. Docs example + +<# + .SYNOPSIS + Performs monthly data updates. + + .DESCRIPTION + The Update-Month.ps1 script updates the registry with new data generated + during the past month and generates a report. + + .PARAMETER InputPath + Specifies the path to the CSV-based input file. + + .PARAMETER OutputPath + Specifies the name and path for the CSV-based output file. By default, + MonthlyUpdates.ps1 generates a name from the date and time it runs, and + saves the output in the local directory. + + .INPUTS + None. You cannot pipe objects to Update-Month.ps1. + + .OUTPUTS + None. Update-Month.ps1 does not generate any output. + + .EXAMPLE + PS> .\Update-Month.ps1 + + .EXAMPLE + PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv + + .EXAMPLE + PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv -outputPath C:\Reports\2009\January.csv +#> \ No newline at end of file diff --git a/PublishConceptPortal.ps1 b/PublishConceptPortal.ps1 new file mode 100644 index 0000000..39251eb --- /dev/null +++ b/PublishConceptPortal.ps1 @@ -0,0 +1,13 @@ +$tmp = "gitTemp" +$source = "Concept-Web" +$destination = "ConceptPortal" + +if (Test-Path -Path $tmp) { + Remove-Item $tmp -Recurse -Force +} +Remove-Item -recurse $destination\* -exclude .git + +& git clone $source $tmp +Copy-Item $tmp\* $destination\ -Recurse -Exclude .git + +Remove-Item $tmp\ -Recurse -Force \ No newline at end of file diff --git a/Python.txt b/Python.txt new file mode 100644 index 0000000..6f4e1ea --- /dev/null +++ b/Python.txt @@ -0,0 +1,36 @@ +1. Use naming guidelines +https://www.python.org/dev/peps/pep-0008/#package-and-module-names + +2. Use docstrings +https://www.python.org/dev/peps/pep-0257/ + +3. Basic input/output +in_file = open("input.txt", "r", encoding="utf-8") +lines = [line.strip() for line in in_file.readlines()] +in_file.close() + +# process lines +lines = [process_line(line) for line in lines] + +# output result +out_file = open("output.txt", "w", encoding="utf-8") +out_file.writelines([line + '\n' for line in lines]) +out_file.close() + +4. Install Virtual Env +$python -m venv $targetPath + +5. Requirements +$python -m pip freeze > requirements.txt + +OR + +$python -m pip install --user pipenv +cd myproject +$python -m pipenv install requests + +6. Reset Virtual Env +$python -m pip freeze > unins && pip uninstall -y -r unins && rm unins + +7. Create wheels for project +$python -m pip wheel . -w $folder \ No newline at end of file diff --git a/configs/.gitignore b/configs/.gitignore new file mode 100644 index 0000000..6e46923 --- /dev/null +++ b/configs/.gitignore @@ -0,0 +1,9 @@ +.vscode +.vs +*.user +*.aps +~* +*.pch.tmp +*.clang.pch + +build \ No newline at end of file diff --git a/configs/Dockerfile b/configs/Dockerfile new file mode 100644 index 0000000..d091162 --- /dev/null +++ b/configs/Dockerfile @@ -0,0 +1,58 @@ +# ubunutu is the base image +FROM ubuntu:20.04 as cpp-builder +LABEL version="1.0" +LABEL author="IRBorisov iborisov@acconcept.ru" + +ENV DEBIAN_FRONTEND=noninteractive +# ENV TZ=Europe/Moscow +# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# Install standard packages +RUN apt-get update -qq && \ + apt-get install -y --no-install-recommends \ + wget \ + git \ + software-properties-common \ + build-essential \ + gpg-agent \ + cmake \ + python3 \ + python3-pip \ + cppcheck + +# Install conan +RUN python3 -m pip install --upgrade pip setuptools && \ + python3 -m pip install conan && \ + conan --version + +# Set compiler versions as arguments +ARG GCC_VER="11" +ARG LLVM_VER="14" + +# Add GCC compiler +RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ + apt-get update -qq && \ + apt-get install -y --no-install-recommends gcc-${GCC_VER} g++-${GCC_VER} && \ + update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 && \ + update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100 + +# Add Clang compiler +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null +RUN add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${LLVM_VER} main" && \ + apt-get update -qq && \ + apt-get install -y --no-install-recommends \ + clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} \ + llvm-${LLVM_VER}-dev libclang-${LLVM_VER}-dev clang-tidy-${LLVM_VER} && \ + update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100 && \ + update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100 && \ + update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1 + +# Add current cmake/ccmake, from Kitware +RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ + | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ + apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' && \ + apt-get update -qq && \ + apt-get install -y --no-install-recommends cmake cmake-curses-gui + +# Cleanup cached apt data we don't need anymore +RUN apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/configs/NuGet.Config b/configs/NuGet.Config new file mode 100644 index 0000000..9e118af --- /dev/null +++ b/configs/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/configs/VSCODE_settings.json b/configs/VSCODE_settings.json new file mode 100644 index 0000000..920e585 --- /dev/null +++ b/configs/VSCODE_settings.json @@ -0,0 +1,235 @@ +{ + // Themes + "workbench.colorTheme": "Default Light+", + "editor.fontFamily": "'Fira Code', monospace", + "editor.fontSize": 14, + "editor.fontLigatures": true, + "editor.fontWeight": "500", + "terminal.integrated.fontFamily": "'Fira Code', monospace", + "terminal.integrated.fontSize": 12, + // "workbench.iconTheme": "", + + // Git + "git.autofetch": true, + "git.enableSmartCommit": true, + "git.openRepositoryInParentFolders": "always", + "gitlens.codeLens.enabled": false, + "diffEditor.ignoreTrimWhitespace": false, + + // Indentation + "editor.insertSpaces": true, + "editor.tabSize": 2, + "editor.detectIndentation": true, + + // Wrapping + "editor.wordWrap": "bounded", + "editor.wrappingIndent": "same", + "editor.wordWrapColumn": 120, + + // Cursor + "editor.cursorBlinking": "expand", + "editor.cursorStyle": "line-thin", + "editor.cursorSmoothCaretAnimation": "explicit", + "editor.hideCursorInOverviewRuler": false, + + // Scroll + "editor.smoothScrolling": true, + "editor.minimap.enabled": false, + "editor.scrollBeyondLastLine": true, + + // Gutter + "editor.folding": false, + "editor.glyphMargin": false, + + // Breadcrumbs + "breadcrumbs.enabled": true, + "breadcrumbs.icons": false, + "breadcrumbs.showKeys": false, + "breadcrumbs.showFiles": false, + "breadcrumbs.symbolPath": "on", + "breadcrumbs.showArrays": true, + "breadcrumbs.showEvents": true, + "breadcrumbs.showFields": true, + "breadcrumbs.showClasses": true, + "breadcrumbs.showMethods": true, + "breadcrumbs.showBooleans": true, + "breadcrumbs.showFunctions": true, + "breadcrumbs.showConstants": true, + "breadcrumbs.showEnumMembers": true, + "breadcrumbs.showConstructors": true, + + // Autosave + "files.autoSave": "onFocusChange", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "eslint.codeActionsOnSave.rules": null, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + + // Quotes + "html.completion.attributeDefaultValue": "singlequotes", + "typescript.preferences.quoteStyle": "single", + "javascript.preferences.quoteStyle": "single", + + // Autocompletion + "html.autoClosingTags": true, + "javascript.autoClosingTags": true, + "typescript.autoClosingTags": true, + "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", + "workbench.editor.empty.hint": "hidden", + "editor.gotoLocation.multipleDefinitions": "gotoAndPeek", + + // Interactions + "workbench.startupEditor": "newUntitledFile", + "editor.suggestSelection": "first", + "editor.linkedEditing": true, + "editor.quickSuggestionsDelay": 0, + "explorer.confirmDragAndDrop": false, + "explorer.confirmDelete": false, + "security.workspace.trust.untrustedFiles": "open", + "editor.inlineSuggest.enabled": true, + "window.confirmBeforeClose": "keyboardOnly", + + // Appearance + "editor.renderControlCharacters": false, + "editor.bracketPairColorization.enabled": true, + "editor.scrollbar.horizontal": "visible", + "editor.scrollbar.vertical": "visible", + "workbench.editor.highlightModifiedTabs": true, + "window.density.editorTabHeight": "compact", + "workbench.activityBar.location": "top", + "editor.accessibilitySupport": "off", + "window.commandCenter": false, + "workbench.layoutControl.enabled": false, + "explorer.compactFolders": false, + "workbench.editor.tabSizing": "fit", + + // File associations + "workbench.editorAssociations": { + "*.ipynb": "jupyter-notebook" + }, + + // Frontend + "css.lint.unknownAtRules": "ignore", + "typescript.updateImportsOnFileMove.enabled": "always", + "javascript.updateImportsOnFileMove.enabled": "always", + "javascript.format.semicolons": "insert", + "typescript.format.semicolons": "insert", + "colorize.colorized_colors": ["BROWSERS_COLORS", "HEXA", "RGB", "HSL"], + + // Python + "python.globalModuleInstallation": true, + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": true, + "python.testing.cwd": "${workspaceFolder}", + "python.analysis.completeFunctionParens": true, + "[python]": { + "editor.formatOnType": true, + "editor.tabSize": 4 + }, + "pylint.importStrategy": "fromEnvironment", + "pylint.args": ["--extension-pkg-allowlist=pyconcept"], + "python.analysis.autoImportCompletions": true, + "python.analysis.packageIndexDepths": [ + { + "name": "django", + "depth": 4 + }, + { + "name": "djangorestframework", + "depth": 2 + } + ], + "jupyter.askForKernelRestart": false, + "notebook.cellToolbarLocation": { + "default": "right", + "jupyter-notebook": "left" + }, + "jupyter.interactiveWindow.creationMode": "perFile", + + // Powershell + "powershell.pester.debugOutputVerbosity": "Detailed", + + // CMake + "cmake.configureOnOpen": true, + "[cmake]": {}, + + // XML + "[xslt]": { + "editor.semanticHighlighting.enabled": true + }, + + // Hide folders + "files.exclude": { + "**/.next": true, + "**/node_modules": true, + "**/.mypy_cache": true, + "**/__pycache__": true, + "**/.pytest_cache": true, + "**/.coverage": true, + "**/htmlcov": true, + "**/venv": true, + "**/dist": true + }, + + // Spelling + "cSpell.enabled": true, + "cSpell.language": "en,ru", + "cSpell.userWords": [], + "cSpell.enableFiletypes": ["jsx", "tsx", "ts", "js", "h", "hpp", "cpp", "py"], + + // Syntax Highlighting + "editor.unicodeHighlight.ambiguousCharacters": false, + "syntax.debugHover": true, + "editor.semanticTokenColorCustomizations": { + "[Default Light+]": { + "enabled": true, + "rules": { + "variable.declaration": { "bold": true }, + "parameter": "#ff32f5" + } + } + }, + "editor.tokenColorCustomizations": { + "textMateRules": [ + { + "scope": "entity.name.tag", + "settings": { + "foreground": "#ac1bf0" + } + } + ] + }, + "syntax.highlightTerms": [ + "type", + "scope", + "function", + "variable", + "number", + "string", + "comment", + "constant", + "directive", + "control", + "operator", + "modifier", + "punctuation" + ], + "syntax.highlightLanguages": [ + "c", + "cpp", + "python", + "typescript", + "typescriptreact", + "javascript", + "go", + "rust", + "php", + "ruby", + "shellscript", + "ocaml", + "lua" + ], + "redhat.telemetry.enabled": false +} diff --git a/configs/VSCustom.ruleset b/configs/VSCustom.ruleset new file mode 100644 index 0000000..c148a24 --- /dev/null +++ b/configs/VSCustom.ruleset @@ -0,0 +1,658 @@ +п»ї + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/configs/concept-options.json b/configs/concept-options.json new file mode 100644 index 0000000..f85edcd --- /dev/null +++ b/configs/concept-options.json @@ -0,0 +1,4 @@ +{ + "PythonInterpreter": "python" + "PythonImports": "D:\\DEV\\!WORK\\PyRunner\\src" +} \ No newline at end of file diff --git a/configs/native.clang-tidy b/configs/native.clang-tidy new file mode 100644 index 0000000..d409eb0 --- /dev/null +++ b/configs/native.clang-tidy @@ -0,0 +1,29 @@ +Checks: "*,\ + -llvmlibc-callee-namespace,\ + -llvmlibc-restrict-system-libc-headers,\ + -llvm-else-after-return,\ + -bugprone-branch-clone,\ + -bugprone-suspicious-include,\ + -modernize-use-trailing-return-type,\ + -hicpp-special-member-functions,\ + -llvm-header-guard,\ + -google-runtime-references,\ + -llvm-include-order,\ + -fuchsia-overloaded-operator,\ + -fuchsia-default-arguments,\ + -google-readability-todo,\ + -google-global-names-in-headers,\ + -readability-redundant-access-specifiers,\ + -readability-else-after-return,\ + -readability-implicit-bool-conversion,\ + -readability-use-anyofallof,\ + -performance-inefficient-string-concatenation,\ + -performance-unnecessary-value-param,\ + -fuchsia-default-arguments-declarations,\ + -fuchsia-trailing-return,\ + -fuchsia-multiple-inheritance,\ + -fuchsia-default-arguments-calls,\ + -misc-non-private-member-variables-in-classes,\ + -misc-no-recursion,\ + -cppcoreguidelines-special-member-functions,\ + -cppcoreguidelines-non-private-member-variables-in-classes" \ No newline at end of file diff --git a/configs/vscode_python_settings.json b/configs/vscode_python_settings.json new file mode 100644 index 0000000..7bb87b5 --- /dev/null +++ b/configs/vscode_python_settings.json @@ -0,0 +1,22 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true, + "python.linting.pylintEnabled": true, + "python.linting.enabled": true + "python.linting.pylintArgs": [ + "--max-line-length=120", + "--disable=invalid-name", + "--disable=line-too-long", + "--disable=no-else-return", + "--disable=too-many-return-statements", + "--disable=no-else-break", + "--disable=no-else-continue" + ] +} \ No newline at end of file diff --git a/configs/win32.clang-tidy b/configs/win32.clang-tidy new file mode 100644 index 0000000..6feb063 --- /dev/null +++ b/configs/win32.clang-tidy @@ -0,0 +1,43 @@ +Checks: "*,\ + -llvmlibc-implementation-in-namespace,\ + -llvmlibc-callee-namespace,\ + -llvmlibc-restrict-system-libc-headers,\ + -llvm-else-after-return,\ + -bugprone-branch-clone,\ + -bugprone-suspicious-include,\ + -modernize-use-trailing-return-type,\ + -modernize-avoid-c-arrays,\ + -hicpp-special-member-functions,\ + -hicpp-multiway-paths-covered,\ + -hicpp-signed-bitwise,\ + -hicpp-avoid-c-arrays,\ + -hicpp-vararg,\ + -llvm-header-guard,\ + -google-runtime-references,\ + -google-runtime-int,\ + -llvm-include-order,\ + -fuchsia-overloaded-operator,\ + -fuchsia-default-arguments,\ + -google-readability-todo,\ + -google-global-names-in-headers,\ + -readability-redundant-access-specifiers,\ + -readability-else-after-return,\ + -readability-implicit-bool-conversion,\ + -readability-use-anyofallof,\ + -performance-no-int-to-ptr,\ + -performance-inefficient-string-concatenation,\ + -performance-unnecessary-value-param,\ + -fuchsia-default-arguments-declarations,\ + -fuchsia-trailing-return,\ + -fuchsia-multiple-inheritance,\ + -fuchsia-default-arguments-calls,\ + -misc-non-private-member-variables-in-classes,\ + -misc-no-recursion,\ + -cppcoreguidelines-pro-type-union-access,\ + -cppcoreguidelines-pro-type-reinterpret-cast,\ + -cppcoreguidelines-macro-usage,\ + -cppcoreguidelines-pro-type-vararg,\ + -cppcoreguidelines-special-member-functions,\ + -cppcoreguidelines-avoid-c-arrays,\ + -cppcoreguidelines-pro-type-cstyle-cast,\ + -cppcoreguidelines-non-private-member-variables-in-classes" \ No newline at end of file diff --git a/devops/SETUP GITEA.txt b/devops/SETUP GITEA.txt new file mode 100644 index 0000000..e0962aa --- /dev/null +++ b/devops/SETUP GITEA.txt @@ -0,0 +1,3 @@ +https://docs.gitea.com/installation/install-with-docker-rootless + +sudo docker-compose up -d \ No newline at end of file diff --git a/devops/SETUP PRODUCTION.txt b/devops/SETUP PRODUCTION.txt new file mode 100644 index 0000000..3f4e94d --- /dev/null +++ b/devops/SETUP PRODUCTION.txt @@ -0,0 +1,57 @@ +IP сервера: 77.232.136.118 +# ------ SETUP PROD SERVER --------- +# 1. ======== SSH AS ROOT ========== +apt update && apt install docker.io -y +groupadd docker + +adduser prod +usermod -aG sudo prod +usermod -aG docker prod +su - prod + + +# 2. ====== SSH AS PROD USER ========== +mkdir backup portal +cd portal +git clone https://github.com/IRBorisov/ConceptPortal ./ +mkdir secretes + + +# 3. ====== WINDOWS ========= +scp D:\DEV\WORK\Concept-Web\rsconcept\backend\import\pyconcept-1.3.0-cp310-cp310-linux_x86_64.whl prod@77.232.136.118:~/portal/rsconcept/backend/import/pyconcept-1.3.0-cp310-cp310-linux_x86_64.whl + +scp -r D:\DEV\WORK\Concept-Web\secrets prod@77.232.136.118:~/portal/secrets + + +# 4. ======= SSH AS PROD USER ======= +cd ~/protal +bash scripts/prod/UpdateProd.sh + +# 5. For Initial certbot startup we need to temporarily edit nginx config to prevent it from failing to load them +nano nginx/production.conf +# Remove all HTTPS sections (listen 443) + +docker compose -f "docker-compose-prod.yml" up --build -d +docker logs -t portal-router +# Make sure that router logs do not contain errors + +# 6. Get cerificates first time +docker compose -f "docker-compose-prod.yml" run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ --dry-run -d portal.acconcept.ru -d api.portal.acconcept.ru +> email: portal@acconcept.ru +# Should result in "The dry run was successful. + +docker compose -f "docker-compose-prod.yml" run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d portal.acconcept.ru +docker compose -f "docker-compose-prod.yml" run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d api.portal.acconcept.ru +# Should result in "Successfully received certificate" + +# 7. Setup nginx using certs +git checkout HEAD -- nginx/production.conf +docker compose -f "docker-compose-prod.yml" up --build -d + +# 8. Setup Initial data +docker exec -it portal-backend /bin/bash +python manage.py createsuperuser +python manage.py loaddata fixtures/InitialData.json + +# OR restore backup from pg_dump +docker exec -i portal-db pg_restore --username=portal-admin --dbname=portal-db --clean < ~/restore/2023-09-18-db.dump \ No newline at end of file diff --git a/devops/arch/SETUP SERVER.txt b/devops/arch/SETUP SERVER.txt new file mode 100644 index 0000000..3310380 --- /dev/null +++ b/devops/arch/SETUP SERVER.txt @@ -0,0 +1,54 @@ +# NOTE: Server IP = 172.22.1.2 // ssh admuser@192.168.1.249 +# VPN CONNECTION REQUIRED + +======== System =========== +Install Ubuntu + +sudo apt full-upgrade + +sudo apt-get upgrade +sudo apt-get update + +sudo timedatectl set-timezone Europe/Moscow + +Setup en_US locale +https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu + +sudo apt install zip unzip + +======== GIT ============== +Add git user and setup git repos server +https://git-scm.com/book/ru/v1/Git-%D0%BD%D0%B0-%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80%D0%B5-%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%B0%D0%B8%D0%B2%D0%B0%D0%B5%D0%BC-%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80 + +Import git repositories +https://gist.github.com/niksumeiko/8972566 + +Update submodule links between repos +http://pa1gitsolutions.blogspot.com/2015/07/changing-git-submodules-urlbranch-to.html + +======== Jenkins =========== +1. Install Java, Jenkins, Apache server, UFW Firewall +https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-20-04-ru + +wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - +sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' +sudo apt install jenkins +sudo ufw allow 8080 +sudo cat /var/lib/jenkins/secrets/initialAdminPassword + +2. Use Internet browser to connect to http://172.22.1.2:8080/ + +3. Jenkins Plugins: Folders OWASP Markup Formatter Build Timeout Credentials Binding Timestamper Workspace Cleanup Pipeline Pipeline: Stage View Git SSH Build Agents Email Extension Mailer Dashboard View MSBuild Cobertura Warnings Next Generation Multijob Copy Artifact SSH Agent Active Directory Publish Over SSH Locale + +4. Setup network DNS to alias jenkins URL + +5. Configure Jenkins Master and Slave +https://www.howtoforge.com/tutorial/ubuntu-jenkins-master-slave + +6. Jenkins: Subverion Version Number +To control this behavior with Jenkins go to Manage Jenkins -> Configure System -> Subversion and configure the Subversion Workspace Version to 1.6 from the combo box (by default it is set to oldest version - 1.4). +https://stackoverflow.com/questions/11872313/svn-is-not-under-version-control-failure-with-jenkins + +7. Configure and connect Jenkins agents +Use JNLP to connect Windows slave. Might require network adjustm +https://scmquest.com/jenkins-windows-slave-configuration-with-screenshots/ \ No newline at end of file diff --git a/devops/arch/SETUP UBUNTU BUILD.txt b/devops/arch/SETUP UBUNTU BUILD.txt new file mode 100644 index 0000000..b5f9522 --- /dev/null +++ b/devops/arch/SETUP UBUNTU BUILD.txt @@ -0,0 +1,39 @@ +======= gcc-10 ======= +sudo apt install g++-10 + +https://askubuntu.com/questions/1028601/install-gcc-8-only-on-ubuntu-18-04 +https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/ + +======= clang-11 ======= +sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - +sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" +sudo apt-get install clang-11 lldb-11 lld-11 + +======= CMake =============== +sudo apt-get install cmake + +# or build desired version from source +# https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line + +==== Python ===== +sudo apt install python3-pip + +======== Conan =========== +sudo pip3 install conan + +FIX CMAKE NOT DOWNLOADING HTTPS: https://github.com/libigl/libigl/issues/1019 +sudo apt install libcurl4-openssl-dev (or another dev package for cURL with TLS support) +Download cmake source and change to unpacked directory +./bootstrap --system-curl -- -DCMAKE_BUILD_TYPE:STRING=Release +make +make install + + +---------------------------------------- +========== DEPRECATED DEPENDENCIES ===== +========= might reintroduce in future ==== +----------------------------------------- + +======= boost ======= +from source +https://stackoverflow.com/questions/12578499/how-to-install-boost-on-ubuntu \ No newline at end of file diff --git a/devops/arch/SETUP WINDOWS BUILD.txt b/devops/arch/SETUP WINDOWS BUILD.txt new file mode 100644 index 0000000..8117e58 --- /dev/null +++ b/devops/arch/SETUP WINDOWS BUILD.txt @@ -0,0 +1,38 @@ +Setup SSH for client + +1. Enable Windows SSH Agent service + +2. ssh-keygen -t ecdsa -b 521 +# VERY IMPORTANT TO GENERATE ECDSA KEY: +# https://github.com/PowerShell/Win32-OpenSSH/issues/1263#issuecomment-716215121 + +3. ssh-add FILENAME +# If needed remove old keys with ssh-add -D + +4. Setup GIT to use native ssh: +git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'" + +5. Add public key to server authorized_keys +https://stackoverflow.com/questions/31813080/windows-10-ssh-keys + +- Visual Studio +- vcpkg +- vcpkg install poco:x86-windows-static-md // see https://levelup.gitconnected.com/how-to-statically-link-c-libraries-with-vcpkg-visual-studio-2019-435c2d4ace03 +- vcpkg install poco:x64-windows-static-md +- PATH (for lib.exe) +- HTML Help Workshop + PATH +- CMake 3.14+, PATH +- OpenCppCoverage, PATH +- MSBuild, PATH +- Git PATH +- nuget.exe, PATH +- setup %PACKAGEHOME% system variable pointing to folder for storing shared nuget packages +- 7zip, PATH +- Python 3.9 - INSTALL WITH DEBUG LIBRARIES! +- python -m pip install --upgrade pip +- pip install conan +- setup CONAN_USER_HOME +- pip install nose +- pip install coverage +- winflexbison3 https://sourceforge.net/projects/winflexbison/files/ + PATH +- reflex https://github.com/Genivia/RE-flex + PATH \ No newline at end of file diff --git a/devops/arch/SETUP WINDOWS EDIT.txt b/devops/arch/SETUP WINDOWS EDIT.txt new file mode 100644 index 0000000..3f6486a --- /dev/null +++ b/devops/arch/SETUP WINDOWS EDIT.txt @@ -0,0 +1,14 @@ +0. Setup windows build +1. Vistual Studio +2. VS Extensions +- Fix File Encoding +- Clang Power Tools +- GitHub Extension +- GitExtensions +- VS Intellicode +- Test Adapter for Google Test +- Syntax Highlighting Pack + +Setup SSH Agent and keys +https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows +https://vladmihalcea.com/tutorials/git/windows-git-ssh-authentication-to-github/ \ No newline at end of file diff --git a/devops/prod commands.txt b/devops/prod commands.txt new file mode 100644 index 0000000..dc3be98 --- /dev/null +++ b/devops/prod commands.txt @@ -0,0 +1,90 @@ +ssh prod@77.232.136.118 +bash scripts/prod/UpdateProd.sh +docker compose -f "docker-compose-prod.yml" restart +sudo apt-get full-upgrade + +sudo nano /etc/docker/daemon.json + +python -m smtpd -n -c DebuggingServer localhost:1025 + +npm update --save +venv\Scripts\activate +python -m pip install cctext==0.1.2 +pip freeze -r requirements.txt + +scp -r prod@77.232.136.118:~/backup/* E:\Google\!WORK\backup\ +scp -r D:\DEV\WORK\Concept-Web\secrets\* prod@77.232.136.118:~/portal/secrets/ + +zabbix +Grafana +ELK + +docker *** ls + +docker compose -f "docker-compose-prod.yml" up --build -d +docker run --rm -it --entrypoint /bin/bash image_name + +# Nuke all except volumes and running containers +docker system prune -a + +docker container prune +docker image prune --all +docker volume prune --all + +# Create Superuser +python manage.py createsuperuser + +# Django data +-Xutf8 +python -Xutf8 manage.py dumpdata rsform --indent 2 -o fixtures/InitialData.json +python manage.py loaddata fixtures/InitialData.json + +./manage.py migrate --fake + +# Connect to container +docker exec -it /bin/bash +Ctrl + D = exit +# connect to stopped container +docker run --rm -it --entrypoint /bin/bash concept-core-builder + +docker logs -t [OPTIONS] CONTAINER + +# Check memory usage +sudo df -h --total + + +# Certificates CERTBOT +sudo apt install certbot python3-certbot-nginx +sudo certbot --nginx -d portal.acconcept.ru + +docker compose -f "docker-compose-prod.yml" run --rm + certbot certonly --webroot --webroot-path /var/www/certbot/ -d portal.acconcept.ru api.portal.acconcept.ru + +docker compose -f "docker-compose-prod.yml" run --rm certbot renew + + +#chkmk monitoring +https://checkmk.com/download?method=docker&edition=cre&version=2.2.0p8 + +docker container run -dit -p 8080:5000 -p 8000:8000 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v monitoring:/omd/sites --name monitoring -v /etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:2.2.0p8 + +# check container logs +docker container logs portal-backend + +#DB +pg_dump -U -h -t > exported_data.sql + +docker exec -t container pg_dump ... > dump.sql +cat dump.sql | docker exec -i container psql ... + +docker exec pg_dump -U -F t > mydb.tar +docker cp mydb.tar :/ +pg_restore -U -C -d mydb.tar + + +pg_restore --verbose --clean --no-acl --no-owner -h + + +# Fix ubuntu repo + +https://www.oslogic.ru/knowledge/1540/ispravlyaem-key-is-stored-in-legacy-trusted-gpg-keyring-etc-apt-trusted-gpg/ diff --git a/devops/scripts/ImportGTest.txt b/devops/scripts/ImportGTest.txt new file mode 100644 index 0000000..11a1261 --- /dev/null +++ b/devops/scripts/ImportGTest.txt @@ -0,0 +1,15 @@ +п»їcmake_minimum_required(VERSION 3.12) + +project(googletest-download LANGUAGES CXX) + +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG master + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) \ No newline at end of file diff --git a/devops/scripts/MergeIntoMaster.bat b/devops/scripts/MergeIntoMaster.bat new file mode 100644 index 0000000..3c6a344 --- /dev/null +++ b/devops/scripts/MergeIntoMaster.bat @@ -0,0 +1,19 @@ +cd REPO +mkdir out +cd out + +FOR /F "tokens=*" %%A IN (../../repos.txt) DO (call :subroutine "%%A") + +PAUSE +GOTO :eof + +:subroutine + git clone ../%1 + cd %1 + git remote rm origin + git remote add origin git@repo:/var/repos/%1.git + git config master.remote origin + git config master.merge refs/heads/master + git push -u origin master + cd .. +GOTO :eof \ No newline at end of file diff --git a/devops/scripts/OpenCppCoverage.bat b/devops/scripts/OpenCppCoverage.bat new file mode 100644 index 0000000..1a9fb69 --- /dev/null +++ b/devops/scripts/OpenCppCoverage.bat @@ -0,0 +1,3 @@ +OpenCppCoverage --sources "%~dp0src" --sources "%~dp0header" --sources "%~dp0include" --modules "%~dp0build\Debug\ConceptCoreLibraryd.lib" --modules "%~dp0test\build\Debug\cclTest.exe" --excluded_line_regex "\s*\} else \{.*" --excluded_line_regex "\s*\}\s*" --excluded_line_regex "\s*\sthrow *" --excluded_line_regex "\sassert\(.*" --excluded_sources "rsparserimpl.cpp" --excluded_sources "rsparserimpl.y" --excluded_sources "stack.hh" -- %~dp0test\build\Debug\CCLTest.exe + +pause \ No newline at end of file diff --git a/devops/setup google-benchmark.txt b/devops/setup google-benchmark.txt new file mode 100644 index 0000000..3ec03ad --- /dev/null +++ b/devops/setup google-benchmark.txt @@ -0,0 +1,26 @@ +https://github.com/google/benchmark + +git clone https://github.com/google/benchmark.git +git clone https://github.com/google/googletest.git benchmark/googletest +mkdir build && cd build + +cmake ../ -G "Visual Studio 2019" -A "Win32" + +Открыть BUILD_ALL.sln Рё далее скомпилить Release Рё Debug +Скопировать РёР· build/src/Release либы РІ lib/Win32/Release +аналогично Debug + +------------------ + +git clone https://github.com/google/benchmark.git +git clone https://github.com/google/googletest.git benchmark/googletest + +cmake -E make_directory "build" +cmake -E chdir "build" cmake -DCMAKE_BUILD_TYPE=Release ../ +# or use this to auto download googletest: +# cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=TRUE, -DCMAKE_BUILD_TYPE=Release ../ +cmake --build "build" --config Release + + +# copy result from build\src\Release into lib folder (i.t. lib\x64\Release) +# repeat for --config Debug and -A Win32 \ No newline at end of file diff --git a/devops/windows tools.txt b/devops/windows tools.txt new file mode 100644 index 0000000..8254b90 --- /dev/null +++ b/devops/windows tools.txt @@ -0,0 +1,8 @@ +1. Dependencies - analyse dependencies for dll and exe +# helps with Critical error "the application was unable to start correctly 0xc00007b" + +2. LongPathTool - deal with windows paths > 260 symbols + +3. WinSpy64 - analyze open windows + +4. ProcessExplorer - analyze open processes \ No newline at end of file diff --git a/git.txt b/git.txt new file mode 100644 index 0000000..cc86008 --- /dev/null +++ b/git.txt @@ -0,0 +1,54 @@ +0. Add new repository to Ubuntu server +cd /var/repos +mkdir Name.git +cd Name.git +git init --bare +cd .. +sudo chown -R git Name.git +sudo chmod -R a+rwx /var/repos + +1. Move a bunch of files through git mv +for FILE in src/*.h; do git mv $FILE include/; done + +2. Submodules +https://git-scm.com/docs/git-submodule +git submodule update --init --recursive --remote +git config submodule.moduleName.url git@repo:/var/repos/common/CodeStandard.git + +3. Remove submodule +https://gist.github.com/myusuf3/7f645819ded92bda6677 + +4. Move files with history into another repo +https://medium.com/@ayushya/move-directory-from-one-repository-to-another-preserving-git-history-d210fa049d4b + +5. Change origin +git remote rm origin +git remote add origin git@repo:/var/repos/CodeStandard.git +git config master.remote origin +git config master.merge refs/heads/master + +6. Push commits to remote (origin) +git push -u origin master + +7. move files with history +https://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/ +git filter-branch --subdirectory-filter -- --all +git pull repo-A-branch master --allow-unrelated-histories + +8. Remove history for inactive files = delete all and restore active +https://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files + +$ git checkout master +$ git ls-files > keep-these.txt +$ git filter-branch --force --index-filter \ + "git rm --ignore-unmatch --cached -qr . ; \ + cat $PWD/keep-these.txt | tr '\n' '\0' | xargs -d '\0' git reset -q \$GIT_COMMIT --" \ + --prune-empty --tag-name-filter cat -- --all + +$ rm -rf .git/refs/original/ +$ git reflog expire --expire=now --all +$ git gc --prune=now + +9. Remove file from history +https://myopswork.com/how-remove-files-completely-from-git-repository-history-47ed3e0c4c35 +git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD \ No newline at end of file diff --git a/python_libs/Natasha.txt b/python_libs/Natasha.txt new file mode 100644 index 0000000..5e8fdee --- /dev/null +++ b/python_libs/Natasha.txt @@ -0,0 +1,42 @@ +https://github.com/natasha/natasha + +====== install ========= +pip install natasha +wget https://storage.yandexcloud.net/natasha-navec/packs/navec_hudlit_v1_12B_500K_300d_100q.tar +wget https://storage.yandexcloud.net/natasha-navec/packs/navec_news_v1_1B_250K_300d_100q.tar + + +======= config ======== +from natasha import ( + Segmenter, + MorphVocab, + + NewsEmbedding, + NewsMorphTagger, + NewsSyntaxParser, + NewsNERTagger, + + PER, + NamesExtractor, + + Doc +) + +segmenter = Segmenter() +morph_vocab = MorphVocab() + +emb = NewsEmbedding() +morph_tagger = NewsMorphTagger(emb) +syntax_parser = NewsSyntaxParser(emb) +ner_tagger = NewsNERTagger(emb) + +names_extractor = NamesExtractor(morph_vocab) + + +============= use ============== +text = 'Мама мыла раму' +doc = Doc(text) + +doc.segment(segmenter) +doc.parse_syntax(syntax_parser) +doc.sents[0].syntax.print() \ No newline at end of file diff --git a/python_libs/Pymorphy.txt b/python_libs/Pymorphy.txt new file mode 100644 index 0000000..565bf97 --- /dev/null +++ b/python_libs/Pymorphy.txt @@ -0,0 +1,14 @@ +https://pymorphy2.readthedocs.io/en/stable/user/index.html + +======= install ======== +pip install pymorphy2 +pip install -U pymorphy2-dicts-ru +pip install -U pymorphy2-dicts-uk + +========= config ============ +import pymorphy2 +parser = pymorphy2.MorphAnalyzer() + +=========== use ============= +parser.parse("слон") +parser.parse("слона")[0].inflect({'sing', 'nomn'}).word \ No newline at end of file diff --git a/python_libs/graphviz.txt b/python_libs/graphviz.txt new file mode 100644 index 0000000..b1befd4 --- /dev/null +++ b/python_libs/graphviz.txt @@ -0,0 +1,16 @@ +https://forum.graphviz.org/t/new-simplified-installation-procedure-on-windows/224 +https://graphviz.readthedocs.io/en/stable/manual.html + +====== install ========= +pip install graphviz + +======= config ======== +from graphviz import Digraph + +============= use ============== +dot = Digraph(comment='The Round Table') +dot.node('A', 'King Arthur') +dot.node('B', 'Sir Bedevere the Wise') +dot.node('L', 'Sir Lancelot the Brave') +dot.edges(['AB', 'AL']) +print(dot.source) \ No newline at end of file diff --git a/python_libs/vosk.txt b/python_libs/vosk.txt new file mode 100644 index 0000000..1dc7509 --- /dev/null +++ b/python_libs/vosk.txt @@ -0,0 +1,55 @@ +https://alphacephei.com/vosk/install + +======= install ======== +pip install vosk +pip install srt +pip install sounddevice + + +========= config ============ +from vosk import Model, KaldiRecognizer, SetLogLevel +import sys +import os +import wave +import subprocess +import srt +import json +import datetime + +sample_rate=16000 +model = Model(r"D:\DEV\models\vosk-model-small-ru-0.15") +rec = KaldiRecognizer(model, sample_rate) + +=========== use ============= +process = subprocess.Popen(['ffmpeg', '-loglevel', 'quiet', '-i', + sys.argv[1], + '-ar', str(sample_rate) , '-ac', '1', '-f', 's16le', '-'], + stdout=subprocess.PIPE) + + +WORDS_PER_LINE = 7 + +def transcribe(): + results = [] + subs = [] + while True: + data = process.stdout.read(4000) + if len(data) == 0: + break + if rec.AcceptWaveform(data): + results.append(rec.Result()) + results.append(rec.FinalResult()) + + for i, res in enumerate(results): + jres = json.loads(res) + if not 'result' in jres: + continue + words = jres['result'] + for j in range(0, len(words), WORDS_PER_LINE): + line = words[j : j + WORDS_PER_LINE] + s = srt.Subtitle(index=len(subs), + content=" ".join([l['word'] for l in line]), + start=datetime.timedelta(seconds=line[0]['start']), + end=datetime.timedelta(seconds=line[-1]['end'])) + subs.append(s) + return subs \ No newline at end of file