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 sys | |
import os | |
def extract_unique_lines(input_file): | |
seen = set() | |
unique_lines = [] | |
total_lines = 0 | |
with open(input_file, 'r', encoding='utf-8') as f: | |
for line in f: |
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 pymorphy2 | |
import os | |
import sys | |
def is_russian(word): | |
return all('а' <= ch <= 'я' or ch == 'ё' for ch in word) | |
def get_word_forms(word, morph): | |
parses = morph.parse(word) | |
word_forms = set() |
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 re | |
import sys | |
from pathlib import Path | |
def load_words(words_file): | |
words_set = set() | |
with open(words_file, encoding='utf-8') as f: | |
for line in f: | |
word = line.strip() | |
# Удаляем начальные -, ", ! |
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 torch | |
from transformers import AutoTokenizer, pipeline, AutoModelForCausalLM | |
import time | |
def custom_chat_template(chat): | |
# This template concatenates role and content, each on new line | |
return "\n".join(f"{turn['role']}: {turn['content']}" for turn in chat) | |
def generate_response(system_prompt, user_prompt): | |
try: |
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
# Конфигурация для HTTP-сервера | |
server { | |
# Указываем доменное имя | |
server_name new-automation.ru; | |
# Путь к корневой директории сайта | |
root /var/www/opencart/public_html; | |
# Указываем, какие файлы должны обрабатываться при запросе корня сайта | |
index index.php index.html |
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
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
RewriteCond %{ENV:HTTPS} !on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
RewriteEngine On | |
#Если у Вас переход на index.html: |
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
package main | |
import ( | |
"fmt" | |
) | |
type Foo interface { | |
bar(name 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
http { | |
log_format bodylog '$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent" $request_time ' | |
'<"$request_body" >"$resp_body"'; | |
lua_need_request_body on; | |
set $resp_body ""; | |
body_filter_by_lua ' |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/gohouse/gorose/v2" | |
_ "github.com/go-sql-driver/mysql" | |
) | |
var err error |
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
<?php | |
$menu = \App\Menu::find(1); | |
$menu->getDescendantsAndSelf(); | |
$menu = \App\Menu::find(3); | |
$menu->getAncestorsAndSelf(); | |
$menu = \App\Menu::find(1); | |
dd($menu->getTree()); |
NewerOlder