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()); |
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 | |
header('Accept : application/json'); | |
header('Access-Control-Allow-Origin : *'); | |
header('Access-Control-Allow-Methods : POST,GET,OPTIONS,PUT,DELETE'); | |
header('X-Requested-With : XMLHttpRequest'); | |
header('Access-Control-Allow-Headers : Content-Type,Authorization'); | |
//https://cors-anywhere.herokuapp.com/ | |
if (!empty($_SERVER["REQUEST_METHOD"]) && $_SERVER['REQUEST_METHOD']=='OPTIONS') { | |
header("HTTP/1.1 204 NO CONTENT"); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<style type="text/css"> | |
TABLE { | |
width: 300px; /* Ширина таблицы */ |
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_x_firebase | |
log_format postdata escape=json '$remote_addr $remote_user [$time_local] $request_time $request $status $body_bytes_sent $http_referer "$http_user_agent"' | |
' $request_body'; | |
server { | |
listen 443 ssl http2; | |
server_name site.com; | |
access_log "/var/log/nginx/site.com_ssl-access.log" postdata; | |
error_log "/var/log/nginx/site.com_ssl-error.log" warn; |
NewerOlder