row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
31,821
|
clear ;
tic;
format long;
H=zeros(3,3,3,3,3,3);
for s1i=1:3
for s1f=1:3
for s2i=1:3
for s2f=1:3
for s3i=1:3
for s3f=1:3
H(s1i,s2i,s3i,s1f,s2i,s3f)=c(s1i,s2i,s3i,s1f,s2f,s3f);
end
end
end
end
end
end
G=zeros(3,3,3,5,5);
for s1i=1:3
for s2i=1:3
for s3i=1:3
for s4i=1:5
for s4f=1:5
G(s1i,s2i,s3i,s4i,s4f)=G_value(s1i,s2i,s3i,s4i,s4f);
end
end
end
end
end
P=1;
G_1=G(:,:,:,2:4,1);
ind=find(G_1~=0);
P_cyc=P*G_1(ind);
|
624499851cf4433662725894c5a2c885
|
{
"intermediate": 0.30996233224868774,
"beginner": 0.4360675811767578,
"expert": 0.25397005677223206
}
|
31,822
|
url_label = QLabel('YouTube URL:', self)
self.main_layout.addWidget(url_label)
self.input_layout = QHBoxLayout() # Create a new horizontal layout
self.url_input = QLineEdit(self)
self.url_input.setPlaceholderText('유튜브 비디오 url를 넣으세요.')
self.url_input.setFixedWidth(280) # Set a fixed width
self.input_layout.addWidget(self.url_input)
# Add button
self.add_button = QPushButton('Add', self)
self.input_layout.addWidget(self.add_button)
self.main_layout.addLayout(self.input_layout) # Add the input layout to the main layout
# URL list
self.url_list = QListWidget(self)
self.main_layout.addWidget(self.url_list
url_label과 url_input 사이 간격이 너무 넓은데 좁게 바꿔줘
|
1b187a4134378e6df66847bd314d3c43
|
{
"intermediate": 0.342410683631897,
"beginner": 0.3242470324039459,
"expert": 0.3333422839641571
}
|
31,823
|
pls write python code for maze solving
|
72bce533447df10817158cd26eb98b77
|
{
"intermediate": 0.2341332584619522,
"beginner": 0.2048894315958023,
"expert": 0.5609773397445679
}
|
31,824
|
Hello. Can you give me a simple webpage about me template please?
|
2c8f201cda0d5f2ba2e9ad78c7fcaaa7
|
{
"intermediate": 0.40490105748176575,
"beginner": 0.35821956396102905,
"expert": 0.2368793487548828
}
|
31,825
|
Using selenium webdriver in python write a script to log in into site, select filters and load data
|
94111a6858972570ebea715830738f41
|
{
"intermediate": 0.6432244777679443,
"beginner": 0.10362137109041214,
"expert": 0.2531541585922241
}
|
31,826
|
---------------------------------------------------------------------------
NoSuchElementException Traceback (most recent call last)
Cell In[8], line 6
3 filter_button.click()
5 # Locate the desired option by its text and click it
----> 6 desired_option = driver.find_element(By.XPATH, "//span[contains(text(), 'Кредиторы')]")
7 desired_option.click()
File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\remote\webdriver.py:741, in WebDriver.find_element(self, by, value)
738 by = By.CSS_SELECTOR
739 value = f'[name="{value}"]'
--> 741 return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\remote\webdriver.py:347, in WebDriver.execute(self, driver_command, params)
345 response = self.command_executor.execute(driver_command, params)
346 if response:
--> 347 self.error_handler.check_response(response)
348 response["value"] = self._unwrap_value(response.get("value", None))
349 return response
File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\remote\errorhandler.py:229, in ErrorHandler.check_response(self, response)
227 alert_text = value["alert"].get("text")
228 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
--> 229 raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//span[contains(text(), 'Кредиторы')]"}
(Session info: chrome=119.0.6045.160); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
GetHandleVerifier [0x00007FF6255182B2+55298]
(No symbol) [0x00007FF625485E02]
(No symbol) [0x00007FF6253405AB]
(No symbol) [0x00007FF62538175C]
(No symbol) [0x00007FF6253818DC]
(No symbol) [0x00007FF6253BCBC7]
(No symbol) [0x00007FF6253A20EF]
(No symbol) [0x00007FF6253BAAA4]
(No symbol) [0x00007FF6253A1E83]
(No symbol) [0x00007FF62537670A]
(No symbol) [0x00007FF625377964]
GetHandleVerifier [0x00007FF625890AAB+3694587]
GetHandleVerifier [0x00007FF6258E728E+4048862]
GetHandleVerifier [0x00007FF6258DF173+4015811]
GetHandleVerifier [0x00007FF6255B47D6+695590]
(No symbol) [0x00007FF625490CE8]
(No symbol) [0x00007FF62548CF34]
(No symbol) [0x00007FF62548D062]
(No symbol) [0x00007FF62547D3A3]
BaseThreadInitThunk [0x00007FFD0FF3257D+29]
RtlUserThreadStart [0x00007FFD1170AA78+40]
|
1080c4d1ce031b6fb0f4f6058a97bfd1
|
{
"intermediate": 0.31770461797714233,
"beginner": 0.38412243127822876,
"expert": 0.2981729507446289
}
|
31,827
|
Set property to <appended> of log4j.xml from class @Component
|
2507c84129601207eaf9129a2b73bdfb
|
{
"intermediate": 0.4225301742553711,
"beginner": 0.24994662404060364,
"expert": 0.3275231420993805
}
|
31,828
|
I need to sum every second column in Excel.
|
e9d5c34528fa9858afa6f1b7c5ce790f
|
{
"intermediate": 0.4072810709476471,
"beginner": 0.2563817799091339,
"expert": 0.3363371789455414
}
|
31,829
|
Мне нужен промт для миджорней чтобы создать обложку для трека, исходя из описания и требований ниже:
Трек называется «Мутабор». Это популярный клуб в Москве, где все торчат под техно. Также вот его значение вне названия клуба: Мутабор – это понятие, которое часто используется в современной науке и технологии. Оно описывает объект или систему, способную изменять свою форму, структуру, функции или состояние под воздействием внешних или внутренних условий. Мутаборы являются основными строительными блоками многих инновационных разработок и продуктов, которые применяются в различных отраслях, включая информационные технологии, медицину, робототехнику, аэрокосмическую промышленность и многое другое. В треке я читаю о том что я, в отличие от большинства рэперов, не играю в гэнста, не читаю за наркоту и мэйнстримные карикатурно-рэперские атрибуты, а позиционирую себя как осознанного, трезвого, здравомыслящего человека. Есть пожелания чтобы это было ближе к мультяшному стайлу. Цвета: фиолетовый приоритет, также зеленый черный и бирюзовый.
|
5267ab52ab29238328cf3cab7969d47c
|
{
"intermediate": 0.17364683747291565,
"beginner": 0.5813153386116028,
"expert": 0.24503779411315918
}
|
31,830
|
请使用NEST 7.17.5库来更新旧版本(NEST 1.4.3)的C#代码,请注意and和or方法在NEST 7.x版本中不存在了,但是请区分出查询条件中是and还是or。
private QueryContainerDescriptor<SparePartEntity> ApplyFilters(SearchRequest request, QueryContainerDescriptor<SparePartEntity> fqd)
{
return fqd.Bool(b => b.Filter(fd => {
var filters = new List<QueryContainer>();
var dimensionFilter = AddDimensions(request, fd);
if (dimensionFilter != null)
filters.Add(dimensionFilter);
AddKgAndLanguage(request, filters, fd);
AddPredefinedSolutions(request, filters, fd);
foreach (var value in Enum.GetValues(typeof(FilterType)).Cast<FilterType>())
{
if (value == FilterType.Attribute)
{
filters.Add(fd.And(
request.Filters.Where(f => f.FilterType == value)
.Select(r => fd.Term(GetTerm(value), r.Value))
.ToArray()));
}
else if (value == FilterType.ElevatorManufacturer)
{
filters.Add(fd.Or(
request.Filters.Where(
f => f.FilterType == value)
.Select(
r =>
fd.Term(GetTerm(value),
r.Value))
.ToArray()));
}
else
{
filters.Add(fd.Or(request.Filters.Where(f => f.FilterType == value)
.Select(r => fd.Term(GetTerm(value), r.MainAttributeId))
.ToArray()));
}
}
return fd.And(filters.ToArray());
});
}
|
333348402f1823379350e61f1077abcc
|
{
"intermediate": 0.36003586649894714,
"beginner": 0.3691367506980896,
"expert": 0.27082735300064087
}
|
31,831
|
I need to list all nics and associated IP's on an Ubuntu server.... is there a command for that?
|
c7053a59121bd3bd914a11faffdf6769
|
{
"intermediate": 0.4318341910839081,
"beginner": 0.19805866479873657,
"expert": 0.37010711431503296
}
|
31,832
|
переписать команду firewall-cmd –permanent –add-service=gre под alt linux и red os
|
a9ce2cb5aae1d2af8da29791e0ce6438
|
{
"intermediate": 0.28745293617248535,
"beginner": 0.38330814242362976,
"expert": 0.3292389214038849
}
|
31,833
|
help me on how I should think about rewriting this into an phone app:
from fastapi import FastAPI, Request, BackgroundTasks
import uvicorn
from fastapi.templating import Jinja2Templates
import numpy as np
import cv2
import random
import pygame
from pydub import AudioSegment
import requests
import logging
import os
from datetime import datetime, timedelta
import csv
import time
from roboflow import Roboflow
rf = Roboflow(api_key="xq0chu47g4AXAFzn4VDl")
project = rf.workspace().project("digital-number-ocr")
model = project.version(1).model
templates = Jinja2Templates(directory="templates")
logging.basicConfig(
filename="app.log", # For file output, set to None if you only want console output
level=logging.INFO, # For catching all info level or higher messages
format="%(asctime)s - %(levelname)s - %(message)s",
)
TASK_STATUS = "Not started"
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
console_handler.setFormatter(formatter)
logging.getLogger().addHandler(console_handler)
app = FastAPI()
# Paddleocr supports Chinese, English, French, German, Korean and Japanese.
# You can set the parameter `lang` as `ch`, `en`, `fr`, `german`, `korean`, `japan`
# to switch the language model in order.
# ocr = PaddleOCR(
# use_angle_cls=False,
# lang="en",
# ) # need to run only once to download and load model into memory
x, y, w, h = 100, 100, 200, 200
threshold = 400
# Paths to template images
window_template_path = "shot2Target.png"
dot_template_path = "dottemplate.png"
# Load template images
window_template = cv2.imread(window_template_path, 0)
dot_template = cv2.imread(dot_template_path, 0)
# Global variable to store the server’s response
SERVER_RESPONSE = None
def play_audio_file(filepath):
pygame.mixer.init()
pygame.mixer.music.load(filepath)
pygame.mixer.music.play()
while pygame.mixer.music.get_busy(): # Wait for audio to finish playing
continue
pygame.mixer.music.unload()
return "played"
def check_green_spectrum(image):
green_threshold = 0.02
# Convert to HSV color space
hsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
# Define range of green color in HSV
lower_green = np.array([45, 100, 100])
upper_green = np.array([100, 255, 200])
# Create a binary mask where green colors are white and the rest are black
green_mask = cv2.inRange(hsv_image, lower_green, upper_green)
# Calculate the proportion of the image that is green
green_ratio = np.sum(green_mask > 0) / (
image.size / 3
) # image.size / 3 gives the total number of pixels in the image
print(green_ratio)
# Return True if there is a significant amount of green, indicating the display might be on
return green_ratio > green_threshold
# Image processing function
async def process_images():
global SERVER_RESPONSE, TASK_STATUS
last_frame_change_time = datetime.now()
stable_frame = None
combined_result = []
long_time_no_seen = False
failed_frames = 0
support = 0
minimum_stable_time = timedelta(seconds=2.5) # Stable time of 1.5 seconds
frame_diff_threshold = 350 # A threshold to determine when frames are "different’
try:
TASK_STATUS = "In progress"
logging.info("The process started")
# url = "http://10.30.227.254:8088/shot.jpg"
# frame = cv2.imread("shot(3).jpg")
url = "http://192.168.127.124:8080/shot.jpg"
window_match_threshold = 0.8 # Adjust according to your needs
dot_match_threshold = 0.6 # Adjust according to your needs
found_weight = False
# Initialize background subtractor
# url = "http://10.30.225.127:8080/shot.jpg"
while True:
img_resp = requests.get(url)
img_arr = np.frombuffer(img_resp.content, np.uint8)
frame = cv2.imdecode(img_arr, -1)
current_pic = frame
combined_result = []
# Ensure the trackbars do not exceed the frame’s boundaries
# cv2.imshow("Video Feed", frame)
# Apply background subtraction
# Convert frame to grayscale
# cropped_img = current_pic[580 : 580 + 75, 960 : 960 + 180]
cropped_img = current_pic[555 : 555 + 75, 995 : 995 + 180]
if check_green_spectrum(cropped_img):
# You can now further check for frame stability before running OCR or directly run OCR
print("screen is on")
else:
print("Display appears to be off or not ready.")
last_frame_change_time = datetime.now()
found_weight = False
combined_result = []
stable_frame = None
continue
# Get the center of the image for rotation
if not long_time_no_seen:
play_audio_file("Audio/redo.mp3")
long_time_no_seen = True
last_frame_change_time = datetime.now()
cropped_img_gray = cv2.cvtColor(cropped_img, cv2.COLOR_BGR2GRAY)
image_center = tuple(np.array(cropped_img_gray.shape[1::-1]) / 2)
## Get the rotation matrix using the center and the angle
rot_mat = cv2.getRotationMatrix2D(image_center, -3.5, 1.0)
# Rotate the cropped_img_gray using the rotation matrix
rotated_image = cv2.warpAffine(
cropped_img_gray,
rot_mat,
cropped_img_gray.shape[1::-1],
flags=cv2.INTER_LINEAR,
)
# Draw rectangles around detected windows
# If a stable frame is already detected, check if the current frame differs too much
thresholded_image = cv2.adaptiveThreshold(
rotated_image,
255,
cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY,
11,
11,
)
blurred_image = cv2.GaussianBlur(thresholded_image, (1, 1), 0)
kernel = np.ones((3, 3), np.uint8)
new_thresh = cv2.erode(blurred_image, kernel, iterations=1)
# After applying the threshold to cropped_img:
height, width = new_thresh.shape[:2]
# Define regions within the new_thresh where the numbers are expected
kg_region = (60, 0, 60, 70) # Replace with actual values
hg_region = (115, 0, 60, 70) # Replace with actual values
combined_region = (60, 0, 115, 70)
combined_area = new_thresh[
combined_region[1] : combined_region[1] + combined_region[3],
combined_region[0] : combined_region[0] + combined_region[2],
]
kg_area = new_thresh[
kg_region[1] : kg_region[1] + kg_region[3],
kg_region[0] : kg_region[0] + kg_region[2],
]
hg_area = new_thresh[
hg_region[1] : hg_region[1] + hg_region[3],
hg_region[0] : hg_region[0] + hg_region[2],
]
if stable_frame is not None:
frame_diff = cv2.absdiff(combined_area, stable_frame)
non_zero_count = np.count_nonzero(frame_diff)
print("heythere")
print(non_zero_count)
if non_zero_count > frame_diff_threshold:
if support > 2:
play_audio_file("Audio/support.mp3")
elif failed_frames > 3:
random_number = random.randint(1, 2)
play_audio_file(f"Audio/waiting{random_number}.mp3")
failed_frames = 0
support += 1
# A significant difference is detected, update the stable frame and reset timestamp
last_frame_change_time = datetime.now()
stable_frame = np.copy(combined_area)
print("Frame has changed significantly. Updating stable frame.")
failed_frames += 1
else:
# No stable frame yet, so assign one and start the timer
stable_frame = np.copy(combined_area)
# Check if the frame has been stable for at least 1.5 seconds
print(datetime.now() - last_frame_change_time)
if (
datetime.now() - last_frame_change_time >= minimum_stable_time
and found_weight == False
):
cv2.imwrite("combined_area.png", cropped_img)
print("Frame has been stable for 1.5 seconds. Running OCR.")
# kg_result = await check_picture(kg_area)
# hg_result = await check_picture(hg_area)
if combined_result == []:
combined_result = await check_picture(combined_area)
print(combined_result)
if combined_result != []:
if "-" in combined_result:
combined_result = combined_result.replace("-", ".")
formatted_combined_result = "{:.2f}".format(float(combined_result))
hey_there = await generate_audio(formatted_combined_result)
print(f"{hey_there}")
play_audio_file("audio.mp3")
print(f"combined: {formatted_combined_result}")
await update_csv(formatted_combined_result)
#
# # Reset stable frame and timestamp after running OCR
failed_frames = 0
support = 0
found_weight = True
stable_frame = None
# Show the frame
time.sleep(0.5)
except Exception as e:
TASK_STATUS = "Failed"
SERVER_RESPONSE = str(e)
logging.error(
"An error occurred during image processing: {0}".format(e), exc_info=True
)
@app.post("/start_processing")
async def start_processing(background_tasks: BackgroundTasks):
logging.info("Received start_processing request")
background_tasks.add_task(process_images)
return {"message": "Image processing started"}
@app.get("/get_response")
async def get_response():
return {"response": SERVER_RESPONSE}
@app.get("/task_status")
def get_task_status():
return {"status": TASK_STATUS}
async def generate_audio(clenedUpResponse):
global TASK_STATUS
already_exists = False
while float(clenedUpResponse) > 30.0:
clenedUpResponse = float(clenedUpResponse) / 10
if "." in clenedUpResponse:
clenedUpResponse = clenedUpResponse.replace(".", " komma ")
combined_audio_seg = AudioSegment.empty()
# Generate and concatenate audio for each word
audio_seg = AudioSegment.from_mp3("Audio/lagtin.mp3")
combined_audio_seg += audio_seg
for text in clenedUpResponse.split():
audio_filename = f"Audio/{text}.mp3"
audio_seg = AudioSegment.from_mp3(audio_filename)
combined_audio_seg += audio_seg
# Export the combined audio file
audio_seg = AudioSegment.from_mp3("Audio/kilo.mp3")
combined_audio_seg += audio_seg
combined_audio_filename = "audio.mp3"
combined_audio_seg.export(combined_audio_filename, format="mp3")
return combined_audio_filename
@app.get("/audio")
async def play_audio():
play_audio_file("audio.mp3")
return {"message": "Audio playback started on server"}
@app.get("/video")
async def video_endpoint(request: Request):
return templates.TemplateResponse("video.html", {"request": request})
async def check_picture(image_array):
# Convert the Numpy array to an image file-like object
is_success, buffer = cv2.imencode(".jpg", image_array)
if not is_success:
return None # Handle errors here
# Convert the buffer to bytes
image_bytes = buffer.tobytes()
try:
result = model.predict("combined_area.png", confidence=40, overlap=30).json()
# Sort the predictions by the ‘x’ value
sorted_predictions = sorted(result["predictions"], key=lambda k: k["x"])
# Update the original result with the sorted predictions
result["predictions"] = sorted_predictions
# Initialize an empty list to store the classes from the sorted predictions
classes = []
# Loop through each sorted prediction and add the “class” to the classes list
for prediction in sorted_predictions:
classes.append(prediction["class"])
# Join the classes into a single string
classes_string = "".join(classes)
print(classes_string)
except:
print("no visable numbers")
new_result = []
return classes_string
async def update_csv(result):
# Ensure result is not None and can be converted to float
if result is None:
print("No result to update CSV.")
return
today = datetime.now().strftime("%Y-%m-%d")
# Check if the file exists
file_name = f"Elektronik_{today}.csv"
file_exists = os.path.isfile(file_name)
# If the file doesn't exist, create a new one with the header row
if not file_exists:
with open(file_name, "w", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",", quotechar='"')
writer.writerow(["Vikt", "Datum", "Total Vikt"])
csvfile.close()
# Read the existing CSV file
with open(file_name, "r") as csvfile:
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
rows = list(reader)
# Check if the date already exists
# Add the weights for the current date
total_weight = 0
for row in rows:
if row[1] == today:
total_weight += float(row[0])
try:
while float(result) > 30.0:
result = float(result) / 10
except ValueError as ve:
print(f"Error converting result to float: {ve}")
# Handle the error or return from the function
# Round the result to 2 decimal places
result = round(float(result), 2)
total_weight += float(result)
rows.append([str(result), today, round(total_weight, 2)])
# Write the updated rows to the CSV file
with open(file_name, "w", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",", quotechar='"')
writer.writerows(rows)
return "Done"
if __name__ == "__main__":
uvicorn.run(app, host="localhost", port=3333)
|
06595aa7dfbfa329ededf8596b14fc7e
|
{
"intermediate": 0.40817520022392273,
"beginner": 0.3701432943344116,
"expert": 0.22168150544166565
}
|
31,834
|
Can azure service be shared by many microservices? Is it wise? Or it breaks the rules of microservice concepts?
|
68ba4223f1b8bd9ba19605baefd709d1
|
{
"intermediate": 0.4039217531681061,
"beginner": 0.27369120717048645,
"expert": 0.3223870098590851
}
|
31,835
|
create an image for cute polar bear
|
b7a831cbf98dd75b009f9c96a6ebe5bf
|
{
"intermediate": 0.3478880226612091,
"beginner": 0.24045859277248383,
"expert": 0.41165339946746826
}
|
31,836
|
Make concise instructions for how to have a script be run by systemd in Debian right before shutting down.
|
e4c6119d47f8a844013a970beeb721a9
|
{
"intermediate": 0.4152087867259979,
"beginner": 0.2341759204864502,
"expert": 0.3506152629852295
}
|
31,837
|
现有代码如下:import d2lzh as d2l
from mxnet import nd
from mxnet.gluon import loss as glossbatch_size = 256
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)num_inputs, num_outputs, num_hiddens = 784, 10, 256
W1 = nd.random.normal(scale=0.01, shape=(num_inputs, num_hiddens))
b1 = nd.zeros(num_hiddens)
W2 = nd.random.normal(scale=0.01, shape=(num_hiddens, num_outputs))
b2 = nd.zeros(num_outputs)
params = [W1, b1, W2, b2]
for param in params:
param.attach_grad()def relu(X):
return nd.maximum(X, 0)def net(X):
X = nd.array(X).reshape((-1, num_inputs))
H = relu(nd.dot(X, W1) + b1)
return nd.dot(H, W2) + b2loss = gloss.SoftmaxCrossEntropyLoss()num_epochs, lr = 5, 0.5
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,params, lr)。出现以下报错:AssertionError Traceback (most recent call last)
<ipython-input-22-46d79ebadd2b> in <module>
1 num_epochs, lr = 5, 0.5
----> 2 d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,params, lr)
D:\ProgramData\Anaconda3\lib\site-packages\d2lzh\utils.py in train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size, params, lr, optimizer)
120 for X, y in train_iter:
121 y_hat = net(X)
--> 122 l = loss(y_hat, y).sum()
123
124 # 梯度清零
~\AppData\Roaming\Python\Python38\site-packages\mxnet\gluon\block.py in __call__(self, *args)
680 hook(self, args)
681
--> 682 out = self.forward(*args)
683
684 for hook in self._forward_hooks.values():
~\AppData\Roaming\Python\Python38\site-packages\mxnet\gluon\block.py in forward(self, x, *args)
1252 params = {k: v.data(ctx) for k, v in self._reg_params.items()}
1253
-> 1254 return self.hybrid_forward(ndarray, x, *args, **params)
1255 params = {i: j.var() for i, j in self._reg_params.items()}
1256 with self.name_scope():
~\AppData\Roaming\Python\Python38\site-packages\mxnet\gluon\loss.py in hybrid_forward(self, F, pred, label, sample_weight)
388 pred = log_softmax(pred, self._axis)
389 if self._sparse_label:
--> 390 loss = -pick(pred, label, axis=self._axis, keepdims=True)
391 else:
392 label = _reshape_like(F, label, pred)
~\AppData\Roaming\Python\Python38\site-packages\mxnet\ndarray\register.py in pick(data, index, axis, keepdims, mode, out, name, **kwargs)
AssertionError: Argument index must have NDArray type, but got tensor。请问如何解决?
|
022c53204c6bf489c2a92368e381e882
|
{
"intermediate": 0.3950318694114685,
"beginner": 0.3816567063331604,
"expert": 0.2233114242553711
}
|
31,838
|
I have this code:
active_signal = None
orderId = None
clientOrderId = None
buy_entry_price = None
sell_entry_price = None
orderId = None
import binance
def calculate_percentage_difference_buy(entry_price, exit_price):
result = exit_price - entry_price
price_result = entry_price / 100
final_result = result / price_result
result = final_result * 40
return result
def calculate_percentage_difference_sell(sell_entry_price, sell_exit_price):
percentage_difference = sell_entry_price - sell_exit_price
price_result = sell_entry_price / 100 # price result = 1%
price_percent_difference = percentage_difference / price_result
result = price_percent_difference * 40
return result
while True:
if df is not None:
# Get balance function
balance = client.balance()
#Get USDT balance function
for asset in balance:
if asset['asset'] == 'USDT':
balance_usdt = float(asset['balance'])
balance_usdt_futures = balance_usdt * 40
#Constant
price_bch = mark_price
dollars = balance_usdt_futures
#Counting Balance : BCH price
bch_amount = dollars / price_bch
bch_amount_rounded = round(bch_amount, 2)
quantity = bch_amount_rounded / 2
signals = signal_generator(df)
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
if signals == ['buy'] or signals == ['sell']:
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}, Price {mark_price} - Signals: {signals}")
if 'buy' in signals and active_signal != 'buy':
try:
order = client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
order = latest_trade['orderId']
clientOrderId = latest_trade['clientOrderId']
active_signal = 'buy'
buy_entry_price = mark_price # Record the Buy entry price
print(f"Buy Entry Price: {buy_entry_price}")
order = client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
client.cancel_order(symbol=symbol, orderId=orderId, origClientOrderId=clientOrderId)
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
print(f"Long order executed!")
except binance.error.ClientError as e:
print(f"Error executing long order: ")
if sell_entry_price is not None and buy_entry_price is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_sell(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
print(f"sell entry price {sell_entry_price}, sell exit price {sell_exit_price} , Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
else:
print("Sell Entry price or Buy Entry price is not defined.")
israel = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
if signals == ['buy_exit']:
active_signal = None
israel.append("Long !!! EXIT !!!")
if buy_entry_price is not None and israel is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
try:
client.cancel_open_orders(symbol=symbol)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Long position successfully exited! ")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} buy entry price {buy_entry_price}, buy exit price: {mark_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
buy_entry_price = None
buy_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
israel.append('')
elif 'sell' in signals and active_signal != 'sell':
try:
active_signal = 'sell'
sell_entry_price = mark_price # Record the sell entry price
print(f"Sell Entry Price: {sell_entry_price}")
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
print("Short order executed!")
except binance.error.ClientError as e:
print(f"Error executing short order: ")
if buy_entry_price is not None and sell_entry_price is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
print(f"buy entry price {buy_entry_price}, buy exit price: {sell_entry_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
else:
print("Buy Entry price or Sell Entry price is not defined.")
jerusalem = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
if signals == ['sell_exit']:
active_signal = None
jerusalem.append("Short !!! EXIT !!!")
if sell_entry_price is not None and jerusalem is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_buy(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Short position successfully exited!")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} sell entry price {sell_entry_price}, sell exit price: {mark_price}, Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
sell_entry_price = None
sell_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
jerusalem.append('')
time.sleep(1)
You need to add system in my code : that if signal == ['buy'] : order = client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
order = latest_trade['orderId']
clientOrderId = latest_trade['clientOrderId']
And if active_signal == ['buy'] and signal == sell it need to cancel_order(symbol=symbol, orderId=orderId , origClientOrderId=clientOrderId)
Ands same system for sell
|
239fe44aff081493816daf8ce33dd061
|
{
"intermediate": 0.3664323091506958,
"beginner": 0.4763859808444977,
"expert": 0.15718179941177368
}
|
31,839
|
how to get id from microsoft.xrm.sdk.entityreference
|
4e577fd61863a934cb4aae678b4dabe9
|
{
"intermediate": 0.37026846408843994,
"beginner": 0.2553592324256897,
"expert": 0.37437236309051514
}
|
31,840
|
Make very concise instructions for how to have a bash script be run (with systemd) right before a Debian system shuts down.
|
a409d6af26b292dd538275bf8927727d
|
{
"intermediate": 0.3998522162437439,
"beginner": 0.27440351247787476,
"expert": 0.32574424147605896
}
|
31,841
|
## np.concatenate() explain this function
|
cf305248532a37dc6aa43de5f2080bbc
|
{
"intermediate": 0.24704304337501526,
"beginner": 0.36631810665130615,
"expert": 0.3866388201713562
}
|
31,842
|
please write a blender script for me which deletes the cube
|
2b0abe54f9b7636c746306416fe7a148
|
{
"intermediate": 0.3534514904022217,
"beginner": 0.2797764539718628,
"expert": 0.3667721152305603
}
|
31,843
|
what kind of message brokers could be used for cqrs?
|
e48a32f254396503000d6fff4156e194
|
{
"intermediate": 0.28118494153022766,
"beginner": 0.21453285217285156,
"expert": 0.5042822360992432
}
|
31,844
|
Make instructions for Debian+systemd to run a bash script right before shutting down each time the system is told to shut down. Be very concise.
|
2f7b096ba0f52e1b042745f05468b9dd
|
{
"intermediate": 0.4259325861930847,
"beginner": 0.22914589941501617,
"expert": 0.3449215292930603
}
|
31,845
|
I have this code :
active_signal = None
orderId = None
clientOrderId = None
buy_entry_price = None
sell_entry_price = None
orderId = None
import binance
def calculate_percentage_difference_buy(entry_price, exit_price):
result = exit_price - entry_price
price_result = entry_price / 100
final_result = result / price_result
result = final_result * 40
return result
def calculate_percentage_difference_sell(sell_entry_price, sell_exit_price):
percentage_difference = sell_entry_price - sell_exit_price
price_result = sell_entry_price / 100 # price result = 1%
price_percent_difference = percentage_difference / price_result
result = price_percent_difference * 40
return result
while True:
if df is not None:
# Get balance function
balance = client.balance()
#Get USDT balance function
for asset in balance:
if asset['asset'] == 'USDT':
balance_usdt = float(asset['balance'])
balance_usdt_futures = balance_usdt * 40
#Constant
price_bch = mark_price
dollars = balance_usdt_futures
#Counting Balance : BCH price
bch_amount = dollars / price_bch
bch_amount_rounded = round(bch_amount, 2)
quantity = bch_amount_rounded / 2
signals = signal_generator(df)
mark_price_data = client.ticker_price(symbol=symbol)
mark_price = float(mark_price_data['price']) if 'price' in mark_price_data else 0.0
if signals == ['buy'] or signals == ['sell']:
print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}, Price {mark_price} - Signals: {signals}")
if 'buy' in signals and active_signal != 'buy':
try:
buy_entry_price = mark_price
print(f"Buy Entry Price: {buy_entry_price}")
print(f"Long order executed!")
except binance.error.ClientError as e:
print(f"Error executing long order: ")
if sell_entry_price is not None and buy_entry_price is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_sell(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
print(f"sell entry price {sell_entry_price}, sell exit price {sell_exit_price} , Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
else:
print("Sell Entry price or Buy Entry price is not defined.")
israel = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
if signals == ['buy_exit']:
active_signal = None
israel.append("Long !!! EXIT !!!")
if buy_entry_price is not None and israel is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
try:
client.cancel_open_orders(symbol=symbol)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Long position successfully exited! ")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} buy entry price {buy_entry_price}, buy exit price: {mark_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
buy_entry_price = None
buy_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
israel.append('')
elif 'sell' in signals and active_signal != 'sell':
try:
active_signal = 'sell'
sell_entry_price = mark_price # Record the sell entry price
print(f"Sell Entry Price: {sell_entry_price}")
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
print("Short order executed!")
except binance.error.ClientError as e:
print(f"Error executing short order: ")
if buy_entry_price is not None and sell_entry_price is not None:
buy_exit_price = mark_price
difference_buy = calculate_percentage_difference_buy(buy_entry_price, buy_exit_price)
profit_buy = difference_buy
total_profit_buy = profit_buy
profit_buy_percent = total_profit_buy - 4
print(f"buy entry price {buy_entry_price}, buy exit price: {sell_entry_price}, Buy P&L: {round(total_profit_buy, 2)}% with fee {round(profit_buy_percent, 2)}%")
else:
print("Buy Entry price or Sell Entry price is not defined.")
jerusalem = []
depth_data = client.depth(symbol=symbol)
bid_depth = depth_data['bids']
ask_depth = depth_data['asks']
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_qty = float(bid_depth[0][1]) if bid_depth else 0.0
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
executed_orders_buy = 0.0
for order in bid_depth:
if float(order[0]) == mark_price:
executed_orders_buy += float(order[1])
else:
break
buy_result = buy_qty - executed_orders_buy
executed_orders_sell = 0.0
for order in ask_depth:
if float(order[0]) == mark_price:
executed_orders_sell += float(order[1])
else:
break
sell_result = sell_qty - executed_orders_sell
# Subtract executed order quantity from sell_qty
sell_qty = float(ask_depth[0][1]) if ask_depth else 0.0
sell_price = float(ask_depth[0][0]) if ask_depth else 0.0
buy_price = float(bid_depth[0][0]) if bid_depth else 0.0
if signals == ['sell_exit']:
active_signal = None
jerusalem.append("Short !!! EXIT !!!")
if sell_entry_price is not None and jerusalem is not None:
sell_exit_price = mark_price
difference_sell = calculate_percentage_difference_buy(sell_entry_price, sell_exit_price)
profit_sell = difference_sell
total_profit_sell = profit_sell
profit_sell_percent = total_profit_sell - 4
try:
client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
except binance.error.ClientError as e:
print(f"Short position successfully exited!")
print(" !!! EXIT !!! ")
print(f"Time was : {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} sell entry price {sell_entry_price}, sell exit price: {mark_price}, Sell P&L: {round(total_profit_sell, 2)}% with fee {round(profit_sell_percent, 2)}%")
sell_entry_price = None
sell_exit_price = None
else:
print("Buy Entry price or Sell Entry price is not defined.") # Print israel when condition is met
else:
jerusalem.append('')
time.sleep(1)
In this code you need to add my algorithm : if if 'buy' in signals and active_signal != 'buy'
it need to execute order via this comand: client.cancel_order(symbol=symbol, orderId=orderId, origClientOrderId=clientOrderId) and get orderId and clientOrderId after it, if 'sell' in signals and active_signal != 'sell': firstly it need to close buy trade through this comand : close_order(symbol=symbol, orderId= order, clientOrderId= clientOrderId )
|
31783b9e6609d8d7164fe6ecc6aefe5e
|
{
"intermediate": 0.34703949093818665,
"beginner": 0.44773539900779724,
"expert": 0.2052251100540161
}
|
31,846
|
Make instructions for Debian+systemd to run a bash script right before shutting down each time the system is told to shut down. Be very concise.
|
20697f4737f35c35c98373b82bd1dc14
|
{
"intermediate": 0.4259325861930847,
"beginner": 0.22914589941501617,
"expert": 0.3449215292930603
}
|
31,847
|
Write a Bash function that parses a Terraform map and extracts keys at the second level
|
d732441f759746c263b53dd515d73b17
|
{
"intermediate": 0.4187368154525757,
"beginner": 0.2955890893936157,
"expert": 0.2856740951538086
}
|
31,848
|
Write a Bash function that parses a Terraform map and extracts keys at the second level
|
8a27cc940cfb7300cd9323d654d50270
|
{
"intermediate": 0.4187368154525757,
"beginner": 0.2955890893936157,
"expert": 0.2856740951538086
}
|
31,849
|
how to fetch the custom settings in lwc
|
2f114f02e15731cd8f248828feecf8fa
|
{
"intermediate": 0.5340368151664734,
"beginner": 0.1887122392654419,
"expert": 0.2772509753704071
}
|
31,850
|
I have those comands: to cancel_order : client.cancel_order(symbol=symbol, orderId=orderId, origClientOrderId=clientOrderId)
to open order: order = client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
You need to give me code based on this algorithm: if 'buy' in signals and active_signal != 'buy': it need to execute order and get orderId and clientOrderId, if active_signal is buy and signal == sell it need to cancel_order and open new order sell and get orderId and clientOrderId
|
3ce5c96e5a7fa4ceaf781140916af3da
|
{
"intermediate": 0.21926748752593994,
"beginner": 0.1170034185051918,
"expert": 0.6637291312217712
}
|
31,851
|
what is the function of user.slice of the Linux systemd
|
7565cf5c622dd690c2528ca50faeb3a4
|
{
"intermediate": 0.3365481495857239,
"beginner": 0.5540838241577148,
"expert": 0.1093679890036583
}
|
31,852
|
if ($chat_id == ADMIN_CHAT_ID) {
if ($this->data['message']['voice']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$voice = $this->data['message']['voice'];
$file_id = $voice['file_id'];
file_put_contents("modules/templates/admin/file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_voice"),
],
];
$this->sendVoice(ADMIN_CHAT_ID, $file_id, $buttons);
return;
}
//отправка фотографий
if ($this->data['message']['photo']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$photo = end($this->data['message']['photo']);
$file_id = $photo['file_id'];
file_put_contents("modules/templates/admin/photo_file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_photo"),
],
];
$this->sendPhoto(ADMIN_CHAT_ID, $file_id, "", $this->buildInlineKeyBoard($buttons));
return;
}
...
switch ($command[0]) {
case "/reply":
file_put_contents("modules/templates/admin/user_voice_reply.txt", "$command[1] $message_id");
$this->sendMessage(ADMIN_CHAT_ID, "Для ответа запишите голосове сообщение");
return;
case "/send_voice":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_voice_reply.txt");
$full = explode(" ", $reply_to);
$this->sendVoice($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
case "/send_photo":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/photo_file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_reply.txt");
$full = explode(" ", $reply_to);
$this->sendPhoto($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
мне надо сделать так, чтобы админ мог отвечать пользователю фотографией или голосовым сообщением, но пока что у меня это не работает, мне нужно чтобы при получении смс была не одна кнопка ответить, а отправить фото или голосовое, так как когда там написано ответить, он просит ввести голосовое сообщение
|
81ae5a0ce7cd98447dc96e8d4b21b320
|
{
"intermediate": 0.34543105959892273,
"beginner": 0.4689697325229645,
"expert": 0.185599222779274
}
|
31,853
|
How to set desired hash suffix to git repository branch?
|
404e58414ae39dd65088170e95297cd5
|
{
"intermediate": 0.45128488540649414,
"beginner": 0.20579597353935242,
"expert": 0.34291914105415344
}
|
31,854
|
hello
|
59758723c1e717639bdbe406ecfd575c
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
31,855
|
if ($chat_id == ADMIN_CHAT_ID) {
if ($this->data['message']['voice']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$voice = $this->data['message']['voice'];
$file_id = $voice['file_id'];
file_put_contents("modules/templates/admin/file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_voice"),
],
];
$this->sendVoice(ADMIN_CHAT_ID, $file_id, $buttons);
return;
}
//отправка фотографий
if ($this->data['message']['photo']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$photo = end($this->data['message']['photo']);
$file_id = $photo['file_id'];
file_put_contents("modules/templates/admin/photo_file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_photo"),
],
];
$this->sendPhoto(ADMIN_CHAT_ID, $file_id, "", $this->buildInlineKeyBoard($buttons));
return;
}
...
switch ($command[0]) {
case "/reply":
file_put_contents("modules/templates/admin/user_voice_reply.txt", "$command[1] $message_id");
$this->sendMessage(ADMIN_CHAT_ID, "Для ответа запишите голосове сообщение");
return;
case "/send_voice":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_voice_reply.txt");
$full = explode(" ", $reply_to);
$this->sendVoice($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
case "/send_photo":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/photo_file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_reply.txt");
$full = explode(" ", $reply_to);
$this->sendPhoto($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
мне надо сделать так, чтобы админ мог отвечать пользователю фотографией или голосовым сообщением, но пока что у меня это не работает, мне нужно чтобы при получении смс была не одна кнопка ответить, а отправить фото или голосовое, так как когда там написано ответить, он просит ввести голосовое сообщение
|
997d667f40a6c9580ecf970b6b787ba0
|
{
"intermediate": 0.34543105959892273,
"beginner": 0.4689697325229645,
"expert": 0.185599222779274
}
|
31,856
|
if ($chat_id == ADMIN_CHAT_ID) {
if ($this->data['message']['voice']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$voice = $this->data['message']['voice'];
$file_id = $voice['file_id'];
file_put_contents("modules/templates/admin/file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_voice"),
],
];
$this->sendVoice(ADMIN_CHAT_ID, $file_id, $buttons);
return;
}
//отправка фотографий
if ($this->data['message']['photo']){
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$photo = end($this->data['message']['photo']);
$file_id = $photo['file_id'];
file_put_contents("modules/templates/admin/photo_file_id.txt", $file_id);
$buttons = [
[
$this->buildInlineKeyBoardButton("Отправить", "/send_photo"),
],
];
$this->sendPhoto(ADMIN_CHAT_ID, $file_id, "", $this->buildInlineKeyBoard($buttons));
return;
}
...
switch ($command[0]) {
case "/reply":
file_put_contents("modules/templates/admin/user_voice_reply.txt", "$command[1] $message_id");
$this->sendMessage(ADMIN_CHAT_ID, "Для ответа запишите голосове сообщение");
return;
case "/send_voice":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_voice_reply.txt");
$full = explode(" ", $reply_to);
$this->sendVoice($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
case "/send_photo":
$this->DelMessageText(ADMIN_CHAT_ID, $message_id);
$file_id = file_get_contents("modules/templates/admin/photo_file_id.txt");
$reply_to = file_get_contents("modules/templates/admin/user_reply.txt");
$full = explode(" ", $reply_to);
$this->sendPhoto($full[0], $file_id);
$this->sendMessage(ADMIN_CHAT_ID, "Сообщение отправлено");
$this->DelMessageText(ADMIN_CHAT_ID, $full[1]);
return;
мне надо сделать так, чтобы админ мог отвечать пользователю фотографией или голосовым сообщением, но пока что у меня это не работает, мне нужно чтобы при получении смс была не одна кнопка ответить, а отправить фото или голосовое, так как когда там написано ответить, он просит ввести голосовое сообщение
|
22990eb6a2b000980dab9150b4acc45b
|
{
"intermediate": 0.34543105959892273,
"beginner": 0.4689697325229645,
"expert": 0.185599222779274
}
|
31,857
|
how can I make so it takes a snapshot of the video stream each cycle?:
url = "http://192.168.127.124:8080/shot.jpg"
window_match_threshold = 0.8 # Adjust according to your needs
dot_match_threshold = 0.6 # Adjust according to your needs
found_weight = False
# Initialize background subtractor
# url = "http://10.30.225.127:8080/shot.jpg"
while True:
img_resp = requests.get(url)
img_arr = np.frombuffer(img_resp.content, np.uint8)
frame = cv2.imdecode(img_arr, -1)
current_pic = frame
combined_result = []
# Ensure the trackbars do not exceed the
|
e69eac92f0905ae5933aef825cb9cb9a
|
{
"intermediate": 0.6495780348777771,
"beginner": 0.13707253336906433,
"expert": 0.21334943175315857
}
|
31,858
|
public function custom_pre_get_posts( $q ) {
// get terms of this taxonomy
$imagesCollection = get_terms( 'ext_images_collections', array("hide_empty" => false) );
// get the term slug and make array
$termIds = array();
foreach ($imagesCollection as $key => $value) {
$termIds[] = $value->slug;
}
// remove the products
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() && is_shop() ) {
$q->set( 'tax_query', array(array(
'taxonomy' => 'ext_images_collections',
'field' => 'slug',
'terms' => $termIds,
'operator' => 'NOT IN'
)));
}
remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
}
Warning: Attempt to read property "slug" on array in /data/web/virtuals/321947/virtual/www/domains/fotofilipensky.cz/wp-content/plugins/woocommerce-photography-plugin/woocommerce-photography-plugin.php on line 75
|
28d2884947494ba9d31e9fc3e7f7a9d4
|
{
"intermediate": 0.3244946002960205,
"beginner": 0.4192078709602356,
"expert": 0.2562975287437439
}
|
31,859
|
how to return to specific state in event sourcing code?
|
42026f7d4c1565a471c643c0736b2c36
|
{
"intermediate": 0.21794097125530243,
"beginner": 0.25202229619026184,
"expert": 0.5300368070602417
}
|
31,860
|
rewrite this so it works:
import ctypes
from ctypes import wintypes
import win32con
import win32gui
import win32api
LLKHF_INJECTED = 0x00000010
LLKHF_LOWER_IL_INJECTED = 0x00000002
WH_KEYBOARD_LL = 13
WM_KEYDOWN = 0x0100
WM_KEYUP = 0x0101
# Define virtual key codes for various media keys
VK_MEDIA_PLAY_PAUSE = 0xB3
VK_MEDIA_NEXT_TRACK = 0xB0
VK_MEDIA_PREV_TRACK = 0xB1
VK_VOLUME_UP = 0xAF
VK_VOLUME_DOWN = 0xAE
# Define a callback function for the low level keyboard hook
def LowLevelKeyboardProc(nCode, wParam, lParam):
# Check if the key is being pressed
if wParam == WM_KEYDOWN:
# Get the virtual keycode of the pressed key
vkCode = ctypes.cast(
lParam, ctypes.POINTER(win32con.KBDLLHOOKSTRUCT)
).contents.vkCode
# Check if the key is one of the media keys
if vkCode == VK_MEDIA_PLAY_PAUSE:
print("Play/Pause media key pressed")
elif vkCode == VK_MEDIA_NEXT_TRACK:
print("Next Track media key pressed")
elif vkCode == VK_MEDIA_PREV_TRACK:
print("Previous Track media key pressed")
elif vkCode == VK_VOLUME_UP:
print("Volume Up media key pressed")
elif vkCode == VK_VOLUME_DOWN:
print("Volume Down media key pressed")
# Call the next hook in the chain
return win32api.CallNextHookEx(None, nCode, wParam, lParam)
# Define a hook procedure handler
def SetHook(hookProc):
# Get the handle to the current module
hModule = ctypes.windll.kernel32.GetModuleHandleW(None)
# Set a hook for all keyboard events
return ctypes.windll.user32.SetWindowsHookExW(
win32con.WH_KEYBOARD_LL, hookProc, hModule, 0
)
# Unhook the procedure
def UnHook(hook):
win32api.UnhookWindowsHookEx(hook)
# Create a hook for keyboard events and enter message loop
keyboard_hook = SetHook(LowLevelKeyboardProc)
win32gui.PumpMessages() # This will block until win32gui.PostQuitMessage is called
# Unhook the procedure when done
UnHook(keyboard_hook)
|
dd88a6b3a9d0a811f42bf406a4e5c0ff
|
{
"intermediate": 0.25119537115097046,
"beginner": 0.5531798601150513,
"expert": 0.19562475383281708
}
|
31,861
|
1) Regarding systemd in Debian and adjacent contexts, where does one store a service file, what are the necessary permissions and what is multi-user.targer?
2) What's the difference between service, target and whatever other types of files?
Be very concise for everything.
|
b3773d8a62c9f2676b2b87bb87a7fb26
|
{
"intermediate": 0.35237300395965576,
"beginner": 0.36325252056121826,
"expert": 0.284374475479126
}
|
31,862
|
Как модифицировать модель, чтобы проект не падал с ошибкой при некорректном вводе поля дата, а просто ничего не выдавал в поиске <?php
namespace frontend\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use frontend\models\Store;
/**
* StoreSearch represents the model behind the search form of `frontend\models\Store`.
*/
class StoreSearch extends Store
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id'], 'integer'],
[['name', 'created_at'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Store::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'created_at' => $this->created_at,
]);
$query->andFilterWhere(['like', 'name', $this->name]);
return $dataProvider;
}
}
|
bfcf0bb1aa23bce567d042f504109c47
|
{
"intermediate": 0.31507766246795654,
"beginner": 0.49877864122390747,
"expert": 0.18614375591278076
}
|
31,863
|
Could You prepare for me 3 microservices in yaml file for kubernetes?
|
93db2f6a242169edbdbc22884c33a11e
|
{
"intermediate": 0.5881268978118896,
"beginner": 0.1587982326745987,
"expert": 0.25307491421699524
}
|
31,864
|
Hi
|
904e7d40e29e2e7ec486ff62193b4522
|
{
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
}
|
31,865
|
Is it possible to have conditional branching in /etc/fstab?
|
f28851a08787b44509ca48bd61216737
|
{
"intermediate": 0.3238135576248169,
"beginner": 0.2523679733276367,
"expert": 0.4238184988498688
}
|
31,866
|
如何将这个层(代码如下:class DimensionReduction(nn.Module):
def __init__(self, i, j, k):
super(DimensionReduction, self).__init__()
self.net = nn.Conv2d(in_channels=1, out_channels=k, kernel_size=(i, j))
def forward(self, X, Y):
# 先用X和Y做矩阵乘法构成i*j矩阵,
# 再用卷积层快捷地实现计算功能
matrix = torch.bmm(x, torch.transpose(y, 1, 2))
matrix = matrix.unsqueeze(1) # B*1*i*j
return self.net(matrix) # B*5*i*j)加入以下的多层感知机网络中:import torch
from torch import nn
from d2l import torch as d2lbatch_size = 256
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)num_inputs, num_outputs, num_hiddens = 784, 10, 256
W1 = nn.Parameter(torch.randn(
num_inputs, num_hiddens, requires_grad=True) * 0.01)
b1 = nn.Parameter(torch.zeros(num_hiddens, requires_grad=True))
W2 = nn.Parameter(torch.randn(
num_hiddens, num_outputs, requires_grad=True) * 0.01)
b2 = nn.Parameter(torch.zeros(num_outputs, requires_grad=True))
params = [W1, b1, W2, b2]def relu(X):
a = torch.zeros_like(X)
return torch.max(X, a)def net(X):
X = X.reshape((-1, num_inputs))
H = relu(X@W1 + b1) # 这里“@”代表矩阵乘法
return (H@W2 + b2)loss = nn.CrossEntropyLoss()num_epochs, lr = 10, 0.1
updater = torch.optim.SGD(params, lr=lr)
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, updater)d2l.predict_ch3(net, test_iter)。
|
e7983f7ee970a155eaace9cc2a94774c
|
{
"intermediate": 0.4091336131095886,
"beginner": 0.2986854016780853,
"expert": 0.29218101501464844
}
|
31,867
|
how to run locally containers by kubectl?
|
13404532c457d0775b6d30e315ff2b0f
|
{
"intermediate": 0.3266960382461548,
"beginner": 0.23364312946796417,
"expert": 0.43966084718704224
}
|
31,868
|
<button type="button" class="btn btn-default btn-sm dropdown-toggle ss-btn button-border" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-display="static" data-role="ss-btn">Тип: <span class="badge badge-pill badge-info">Дебиторы</span></button>
Тип:
<span class="badge badge-pill badge-info">Дебиторы</span>
I need to secet another option from dropdown. Write selenium python script
|
81bca16bf04b62ace5462cf0ff36c124
|
{
"intermediate": 0.4369760751724243,
"beginner": 0.2101975977420807,
"expert": 0.352826327085495
}
|
31,869
|
Write a java project on scientific calculator having at least 2 classes, methods,constructors,loops ,conditional statements and it should show the parameter passing
|
9e04651e4c13d06b58d5fed7996feb1f
|
{
"intermediate": 0.23493796586990356,
"beginner": 0.6846341490745544,
"expert": 0.0804278776049614
}
|
31,870
|
I need to select options from list based on attributes data-index. Use selenium python
|
a1f28f9285d26d68f6f995628a703da7
|
{
"intermediate": 0.4246353805065155,
"beginner": 0.22753211855888367,
"expert": 0.34783250093460083
}
|
31,871
|
$flow_data=$this->input->post('flow_data',true);
Ao receber os dados abaixo, no "Via PIX com 5% de desconto" por exemplo as vezes não funciona devido o "%". Como resolver? Estou usando CodeIgniter 3
{"id":"xitFB@0.0.1","nodes":{"1":{"id":1,"data":{"title":"Flow","postbackId":"0VqV_FSCMuCDVPG","xitFbpostbackId":"1O-c5iCzcEJfSIDaw1wGHKZC47Qv8AcOuy6j","labelIds":[],"labelIdTextsArray":[],"sequenceIdValue":"","sequenceIdText":"Selecione+uma+Sequência"},"inputs":{"referenceInput":{"connections":[{"node":2,"output":"triggerOutput","data":{}}]},"referenceInputActionButton":{"connections":[]}},"outputs":{"referenceOutput":{"connections":[{"node":3,"input":"textInput","data":{}}]},"referenceOutputSequence":{"connections":[]}},"position":[-163.9130678372852,-16.956524552634768],"name":"Start+Bot+Flow"},"2":{"id":2,"data":{"triggerKeyword":"flow","triggerMatchingType":"exact"},"inputs":{"triggerInput":{"connections":[]}},"outputs":{"triggerOutput":{"connections":[{"node":1,"input":"referenceInput","data":{}}]}},"position":[-383.47826086956525,3.91304347826087],"name":"Trigger"},"3":{"id":3,"data":{"uniqueId":"8HMMvQi0B7qqg_h","textMessage":"Via+PIX+com+5%+de+desconto","delayReplyFor":"0","IsTypingOnDisplayChecked":false},"inputs":{"textInput":{"connections":[{"node":1,"output":"referenceOutput","data":{}}]}},"outputs":{"textOutput":{"connections":[]},"textOutputQuickreply":{"connections":[]}},"position":[92.17391304347827,-24.78260883139141],"name":"Text"}}}
|
94dec629a6b6d9363e2139d07b767d4f
|
{
"intermediate": 0.5763089060783386,
"beginner": 0.2534973919391632,
"expert": 0.17019376158714294
}
|
31,872
|
How to select date from calendar? Use selenium python
|
63d91194f5a3f2c173b8b022c0bf1e67
|
{
"intermediate": 0.4175567626953125,
"beginner": 0.2925954759120941,
"expert": 0.28984779119491577
}
|
31,873
|
How to select a date using Selenium Python. See the following html code
<div class="col-auto p-1 filter-item filter-period-head">
<script type="text/json">{"start":{"date":"2022-02-01 00:00:00.000000","timezone_type":3,"timezone":"Europe\/Minsk"},"end":{"date":"2022-02-01 23:59:59.000000","timezone_type":3,"timezone":"Europe\/Minsk"}}</script>
<input type="hidden" name="filters[period]">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text ion-ios-calendar">
</span>
</div>
<input type="text" class="dates-container form-control" value="" placeholder="Интервал дат" aria-label="Интервал дат">
</div>
<script>
report.filters.add('period', function(filters){
/** Filter this */
let dates = $('.dates-container', this.el);
let options = $.dtpGetOptions({
linkedCalendars: false
});
let moment = filters.moment;
if (this.options.start) {
options.startDate = moment(this.options.start.date, 'YYYYMMDD');
}
if (this.options.end) {
options.endDate = moment(this.options.end.date, 'YYYYMMDD');
}
this.picker = dates;
let self = this;
dates.daterangepicker(options, function(start, end, label) {
});
this.getResult = function($){
let picker = this.picker.data('daterangepicker');
return {
start: picker.startDate.format('YYYYMMDD'),
end: picker.endDate.format('YYYYMMDD')
}
}
} );
</script>
</div>
|
d7bca0b9b47a2d1721e29317400baacf
|
{
"intermediate": 0.33280232548713684,
"beginner": 0.41932275891304016,
"expert": 0.24787487089633942
}
|
31,874
|
show me the code for a javascript request with parameters authorize no-cors methods . For disable the allow cross origin error in console
|
49c17bc829af2234a124bbe6b17164aa
|
{
"intermediate": 0.6514818072319031,
"beginner": 0.16773496568202972,
"expert": 0.18078327178955078
}
|
31,875
|
give me some three act plot ideas for a story about a teenage girl finding herself switching involuntarily between different multiverses.
|
cfd47da455f70b2169878a0b4173c9bc
|
{
"intermediate": 0.3780817985534668,
"beginner": 0.349128782749176,
"expert": 0.2727893590927124
}
|
31,876
|
profile picture
Design an app with two tabs for car rental in Android Studio in Java Code:
The first tab will display 3 radio buttons for car options as sedan, suv, minivan for rental. Add setOnCheckedChangeListener to radio group, or add setOnClickListener to each radio button. The
selection will be saved in a shared ViewModel. The selection will be saved in a shared ViewModel.
• The second tab shows an online reservation UI, including a TextField to input number of days to rent, a Button to confirm the reserve process, and a TextView to display the total cost. Assume sedan is
$30 per day, suv is $40 per day, and minivan is $50 per day.
|
69169e60cb594ea2f5105b3ac2828a6f
|
{
"intermediate": 0.36321449279785156,
"beginner": 0.30146822333335876,
"expert": 0.33531731367111206
}
|
31,877
|
Design an app with two tabs for car rental in Android Studio in Java Code:
The first tab will display 3 radio buttons for car options as sedan, suv, minivan for rental. Add setOnCheckedChangeListener to radio group, or add setOnClickListener to each radio button. The
selection will be saved in a shared ViewModel. The selection will be saved in a shared ViewModel.
• The second tab shows an online reservation UI, including a TextField to input number of days to rent, a Button to confirm the reserve process, and a TextView to display the total cost. Assume sedan is
$30 per day, suv is $40 per day, and minivan is $50 per day.
Here's MainActivity.java as a starting point:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabLayout tabLayout = findViewById(R.id.tabs);
ViewPager2 viewPager = findViewById(R.id.viewpager);
ViewPagerAdapter adapter = new ViewPagerAdapter(this);
viewPager.setAdapter(adapter);
TabLayoutMediator.TabConfigurationStrategy tabConfig = new TabLayoutMediator.TabConfigurationStrategy() {
@Override
public void onConfigureTab(TabLayout.Tab tab, int position) {
switch(position) {
case 0:
tab.setIcon(R.drawable.car_icon);
tab.setText("Car Type");
break;
case 1:
tab.setIcon(R.drawable.rental_icon);
tab.setText("Rent Info");
break;
}
}
};
TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewPager, tabConfig);
tabLayoutMediator.attach();
}
}
|
57759612e6368583019dd9d507fb7a82
|
{
"intermediate": 0.507149338722229,
"beginner": 0.29810887575149536,
"expert": 0.19474175572395325
}
|
31,878
|
package com.example.viewmodelhw;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioButton;
import androidx.lifecycle.ViewModelProvider;
public class CarOptionsFragment extends Fragment {
private SharedViewModel sharedViewModel;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_car_options, container, false);
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
RadioButton sedanRadioButton = view.findViewById(R.id.Sedan);
RadioButton suvRadioButton = view.findViewById(R.id.Suv);
RadioButton minivanRadioButton = view.findViewById(R.id.Minivan);
RadioButton.OnClickListener radioButtonClickListener = new RadioButton.OnClickListener() {
@Override
public void onClick(View view) {
String carType = "";
switch (view.getId()) {
case R.id.Sedan:
carType = "Sedan";
break;
case R.id.Suv:
carType = "SUV";
break;
case R.id.Minivan:
carType = "Minivan";
break;
}
sharedViewModel.setCarType(carType);
}
};
sedanRadioButton.setOnClickListener(radioButtonClickListener);
suvRadioButton.setOnClickListener(radioButtonClickListener);
minivanRadioButton.setOnClickListener(radioButtonClickListener);
return view;
}
}
R.id.Sedan, Suv and Minivan is giving me errors. How can i fix this?
|
6ea9ad61ff84b7b4b043ce3a5522fbc0
|
{
"intermediate": 0.3726995587348938,
"beginner": 0.471185564994812,
"expert": 0.15611490607261658
}
|
31,879
|
import os
import imageio
from PIL import Image
# Define the directory where your .eps files are located
eps_directory = 'tempo'
# Define the directory where you want to save temporary images
temp_image_directory = 'tempimg'
# Create the directory for temporary images if it doesn't exist
if not os.path.exists(temp_image_directory):
os.makedirs(temp_image_directory)
# List all .eps files in the directory
eps_files = [f for f in os.listdir(eps_directory) if f.endswith('.eps')]
# Sort the files if necessary
eps_files.sort()
# Convert each .eps file to an image format such as PNG
images = []
total_files = len(eps_files)
for index, eps_filename in enumerate(eps_files):
# Define the full path to the .eps file and the output image file
eps_path = os.path.join(eps_directory, eps_filename)
image_path = os.path.join(temp_image_directory, f'image_{index}.png')
# Open the .eps file and convert to RGB (necessary for .mp4)
image = Image.open(eps_path).convert('RGB')
# Save the image as .png
image.save(image_path)
# Append the image to the list of images
images.append(image_path)
# Print the progress status
print(f"Converting file {index+1} of {total_files} ({(index + 1) / total_files * 100:.2f}%)")
# Define the output .mp4 file path
output_video_path = 'output_video.mp4'
# Create the .mp4 video from the images
fps = 24 # Frames per second (you can change this according to your needs)
writer = imageio.get_writer(output_video_path, fps=fps)
for i, image_path in enumerate(images):
# Read each image and append it to the video
image = imageio.imread(image_path)
writer.append_data(image)
# Print the video creation progress
print(f"Adding image {i+1} of {total_files} to video ({(i + 1) / total_files * 100:.2f}%)")
# Close the writer
This code seem incomplete, can you finish it and make it delete every images in tempo and tempimpg
|
9f00a6a2d48d667e049e3af60c0d1caf
|
{
"intermediate": 0.4072384536266327,
"beginner": 0.34096240997314453,
"expert": 0.2517991065979004
}
|
31,880
|
Hi i'm trying to embed a typeform survey into my discord server, how would I do this?
|
1c612965cced9810f4b26e44ceea5e2d
|
{
"intermediate": 0.6107103228569031,
"beginner": 0.1893215775489807,
"expert": 0.1999680995941162
}
|
31,881
|
How to pull all git subprojects, not submodules?
|
3167b338e16d7a2d201e00a5a0cdbce2
|
{
"intermediate": 0.4212868809700012,
"beginner": 0.2891017198562622,
"expert": 0.2896113991737366
}
|
31,882
|
import cv2
import os
import pickle
import face_recognition
def recognize_faces_from_webcam(db_path):
# Load face embeddings from the database
db_dir = sorted(os.listdir(db_path))
embeddings_db = []
for file_name in db_dir:
path = os.path.join(db_path, file_name)
with open(path, ‘rb’) as file:
embeddings = pickle.dumps(file.read())
embeddings_db.append(embeddings)
# Open the webcam
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
# Convert the frame from BGR color (used by OpenCV) to RGB color (used by face_recognition)
rgb_frame = frame[:, :, ::-1]
# Find all face locations and their encodings in the current frame
face_locations = face_recognition.face_locations(rgb_frame)
face_encodings = face_recognition.face_encodings(rgb_frame, face_locations)
for face_encoding in face_encodings:
# Compare the face encoding with the faces in the database
matches = face_recognition.compare_faces(embeddings_db, face_encoding)
# Check if there is a match
if any(matches):
# Get the index of the matched face in the database
matched_face_index = matches.index(True)
# Get the name of the person from the database file name
matched_face_name = db_dir[matched_face_index][:-7]
# Print the name of the matched person
print(‘Matched person:’, matched_face_name)
# Display the resulting image
cv2.imshow(‘Video’, frame)
# Press ‘q’ to quit
if cv2.waitKey(1) & 0xFF == ord(‘q’):
break
# Release the video capture and close the window
video_capture.release()
cv2.destroyAllWindows()
# Replace ‘db_path’ with the path to your database directory
db_path = ‘D:\Borodin\opencv\code\known_people’
recognize_faces_from_webcam(db_path)
я сделал такой вот код для распознавания лиц, теперь моя задача дополнить программу так, чтобы окно с веб камерой находилось не просто отдельно, а внутри оконного приложения с помощью библиотеки tinker чтобы можно было в дальнейшем добавлять в это же окно кнопки и с помощью которых программировать команды на пополнение базы данных новыми лицами
|
91149f22c86ae32c1e3295fd6df0806f
|
{
"intermediate": 0.255395770072937,
"beginner": 0.5684185028076172,
"expert": 0.176185742020607
}
|
31,883
|
Generate with python code to convert string to confirming url
|
fb8b6963cd65032e67764a144c547533
|
{
"intermediate": 0.39969974756240845,
"beginner": 0.21197985112667084,
"expert": 0.3883203864097595
}
|
31,884
|
Analyse various forms of AI available now.
• What AI services can you find that enhance your life and work?
• How do you expect to gain by using those services?
|
b085878da952b075b2d70d09a1057d47
|
{
"intermediate": 0.3414469361305237,
"beginner": 0.20025670528411865,
"expert": 0.45829635858535767
}
|
31,885
|
Can you make this programm work using ffmpeg instead of imageio
import os
import imageio
from PIL import Image
from tqdm import tqdm
def anim():
# Define the directory where your .eps files are located
eps_directory = 'tempo'
# Define the directory where you want to save temporary images
temp_image_directory = 'tempimg'
# Create the directory for temporary images if it doesn’t exist
if not os.path.exists(temp_image_directory):
os.makedirs(temp_image_directory)
# List all .eps files in the directory
eps_files = [f for f in os.listdir(eps_directory) if f.endswith('.eps')]
# Sort the files if necessary
eps_files.sort()
# Convert each .eps file to an image format such as PNG
images = []
total_files = len(eps_files)
for index, eps_filename in tqdm(enumerate(eps_files), desc='Converting Files', total=total_files):
# Define the full path to the .eps file and the output image file
eps_path = os.path.join(eps_directory, eps_filename)
image_path = os.path.join(temp_image_directory, f'image_{index}.png')
# Open the .eps file and convert to RGB (necessary for .mp4)
image = Image.open(eps_path).convert('RGB')
# Save the image as .png
image.save(image_path)
# Append the image to the list of images
images.append(image_path)
# Define the output .mp4 file path
output_video_path = 'output_video.mp4'
# Create the .mp4 video from the images
fps = 24 # Frames per second (you can change this according to your needs)
writer = imageio.get_writer(output_video_path, fps=fps)
for i, image_path in tqdm(enumerate(images), desc='Creating Video', total=total_files):
# Read each image and append it to the video
image = imageio.imread(image_path)
writer.append_data(image)
# Close the writer
writer.close()
# Remove temporary image files
for image_path in images:
os.remove(image_path)
# Remove EPS files
for eps_file in eps_files:
eps_path = os.path.join(eps_directory, eps_file)
os.remove(eps_path)
# Print completion message
print('Video creation complete. Temporary files removed.')
|
684ccad3e362430a3bd96c41e7eb3a2c
|
{
"intermediate": 0.563285231590271,
"beginner": 0.28232574462890625,
"expert": 0.15438896417617798
}
|
31,886
|
Проверь мою функцию на ошибки. Я хочу для _all_occurs сравнивать каждое значение в строке с _val, и если каждое значение в строке _all_occurs больше, то я записываю соответствующую троку _all_codes в файл . Вот мой код:std::vector<std::vector<size_t>> filterOccur(std::vector<std::vector<size_t>> _all_codes, std::vector<std::vector<size_t>> _all_occurs, int _val)
{
std::ofstream outputFile("_____outputFilename.txt");
if (!outputFile.is_open())
{
std::cout << "Cannot open output file: " << "_____outputFilename.txt" << std::endl;
return {};
}
std::vector<std::vector<size_t>> new_codes{};
for (size_t i = 0; i < _all_occurs.size(); ++i) {
bool allGreater = true;
for (const auto& element : _all_occurs[i]) {
if (element <= _val) {
allGreater = false;
break;
}
}
if (allGreater) {
for (const auto& element : _all_codes[i]) {
outputFile << element << " ";
}
std::cout << std::endl;
}
}
outputFile.close();
return new_codes;
}
|
5478bea7bc3b92c44edf5e57aed8742e
|
{
"intermediate": 0.3715023994445801,
"beginner": 0.3912794888019562,
"expert": 0.23721806704998016
}
|
31,887
|
can you give an example of Employee form in ms word
|
e26302fed99186cbbc30f4d9c9610dee
|
{
"intermediate": 0.31016018986701965,
"beginner": 0.3668515384197235,
"expert": 0.32298827171325684
}
|
31,888
|
can you help me with python linked list? I have 4 nodes and i need to delete one node by index number?
|
cb5fe480d152d8fb17c8f9d28cefb06d
|
{
"intermediate": 0.5389909744262695,
"beginner": 0.10206737369298935,
"expert": 0.3589416444301605
}
|
31,889
|
create autocomplete in search string with any pyhton libraries
|
5197034b2d9f12c180556f63e76dda24
|
{
"intermediate": 0.6283590793609619,
"beginner": 0.10777789354324341,
"expert": 0.26386308670043945
}
|
31,890
|
hello
|
41c92b023dfa1295116ba45a651d3a22
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
31,891
|
create a vue3 js script setup a lightbox component without a bugs
|
416f07f56a93227993cd419076718cc8
|
{
"intermediate": 0.44055992364883423,
"beginner": 0.2955353260040283,
"expert": 0.26390472054481506
}
|
31,892
|
استادم در دانشگاه به ما یک پروژه ی پایگاه داده داد و بهمون سه تا از چهار جدولشو داده و گفته که جدول چهارمشو شما باید بسازین.جدول اول جدول دانش اموزانه که دارای 4سطر هستش که شامل Sstudent_ID,FIRSTNAME,LASTNAME و PAST COURSE هستش. جدول دوم برای معلمان هستش و دارای 4 سطر شامل : Teacher_ID,FIRSTNAME,LASTNAME و TEACHING COURSE هستش.جدول سوم برای درس ها هستش ودارای سه سطر شامل : Course_ID,COURSENAME و UNIT هستش. جدول چهارم چی میتونه باشه و دارای چه سطر هایی هستش که جمع بندی از این سه جدول هستش
|
b3d46c94cfccdb294b62993b05a880b2
|
{
"intermediate": 0.3448391556739807,
"beginner": 0.3535141944885254,
"expert": 0.30164670944213867
}
|
31,893
|
void tRead(const char *filename, uint16_t *pWidth, uint16_t *pHeight, uint8_t *pChannelCount, uint8_t *pTexture) {
FILE *pFile = fopen(filename, "r");
if (pFile == NULL) {
pTexture = NULL;
return;
}
fread(pWidth, sizeof(uint16_t), 1, pFile);
fread(pHeight, sizeof(uint16_t), 1, pFile);
fread(pChannelCount, sizeof(uint8_t), 1, pFile);
size_t textureSize = *pWidth * *pHeight * *pChannelCount;
pTexture = malloc(textureSize * sizeof(uint8_t));
fread(pTexture, sizeof(uint8_t), textureSize, pFile);
fclose(pFile);
}
What's wrong with this texture reading function?
|
afb789edac88e7fc1e3d7c3e8d5232a4
|
{
"intermediate": 0.4539889097213745,
"beginner": 0.3143770396709442,
"expert": 0.2316340059041977
}
|
31,894
|
help me set this up so it generates a random room with height map :
extends Node
var max_rooms = 10
var room_min_size = Vector2(5, 5)
var room_max_size = Vector2(10, 10)
var map_size = Vector2(100, 100)
var rooms = []
var room_scene: PackedScene = preload("res://Scenes/rooms/Room.tscn")
func _ready():
print("Preloaded room_scene is: ", room_scene)
# Check that the room_scene variable is indeed a PackedScene
if room_scene is PackedScene:
print("Confirmed that room_scene is a PackedScene")
generate_dungeon()
else:
print("room_scene is not a PackedScene, it is: ", room_scene.get_class())
func generate_dungeon():
var rng = RandomNumberGenerator.new()
rng.randomize()
for i in range(max_rooms):
var room_width = rng.randi_range(room_min_size.x, room_max_size.x)
var room_height = rng.randi_range(room_min_size.y, room_max_size.y)
var x = rng.randi_range(0, map_size.x - room_width)
var y = rng.randi_range(0, map_size.y - room_height)
var room_pos = Vector2(x, y)
var room_size = Vector2(room_width, room_height)
create_room(room_pos, room_size)
# Optional code for hallways – not included here for simplicity
func create_room(position, size):
var room_instance = room_scene.instance()
room_instance.set_room_size(size * 32) # Dynamically set the room size.
room_instance.position = position * 32 # Set position appropriately.
add_child(room_instance)
rooms.append(room_instance)
func create_hallway(room1, room2):
# Simple hallway creation logic.
# For this example, we’ll just draw a straight horizontal line between the rooms.
var hallway_start = room1.position + Vector2(room1.size.x / 2, room1.size.y / 2)
var hallway_end = room2.position + Vector2(room2.size.x / 2, room2.size.y / 2)
var hallway = Path2D.new()
var curve = Curve2D.new() # Change this line to use Curve2D
curve.add_point(hallway_start) # Add the start point to the curve
curve.add_point(hallway_end) # Add the end point to the curve
hallway.curve = curve # Assign the Curve
class Room:
var position
var size
func init(p_position, p_size):
position = p_position
size = p_size
# Room class represents a single room in the dungeon.
func create_platformer_view_for_room(room):
var platformer_room = room_scene.instance()
platformer_room.position = room.position * 32
platformer_room.size = room.size * 32
# Here you should populate the room with platforms and obstacles
# Platform and obstacle creation is skipped for simplicity.
add_child(platformer_room)
return platformer_room
func on_room_entered(room):
var platformer_view = create_platformer_view_for_room(room)
# Adapt the room entrance logic to your game’s requirements.
# Maybe you’ll have a fade-in effect or disable the player’s movement momentarily.
func on_room_exited(room):
# Adapt the room exit logic to your game’s requirements.
pass
# Again, you might handle the transition effect or clean-up here.
|
7a680723d13ceba6d9411b94c6448ab6
|
{
"intermediate": 0.37900465726852417,
"beginner": 0.3878297805786133,
"expert": 0.23316559195518494
}
|
31,895
|
you gave an error but here is the message before it crashed:
It looks like you have a good setup for generating random rooms with various sizes and positioning them within a given map size. However, your script seems to lack several key aspects to make it fully functional. For instance, the provided Room class is not actually created as a Node (so it doesn’t integrate with Godot’s node system), and there are method calls for setting up rooms which do not exist in the provided Room class (set_room_size and the like).
Also, the way you are instantiating the rooms suggests that Room.tscn should have a script attached to it which can handle methods like set_room_size. Here’s an assumption on how Room.tscn’s attached script may look like:
extends Node2D
var size = Vector2()
func set_room_size(new_size):
size = new_size
# Here, you would add your logic to use the provided size to shape the room node
# typically this would imply resizing sprites, collision shapes, etc.
To get your script running, you’d also need to ensure the class Room code uses Godot’s node system, which your current pseudo-code does not yet. Let’s adjust the Room definition within your script to make sure it matches the structure expected by a PackedScene (which Room.tscn is):
Since your script expects to generate a “height map,” you need additional logic to create a height map for each room or the entire dungeon. However, without a clearer understanding of how you want to handle the height map (e.g., as a visual or collision element, as a fully 3D height map or a 2D representation), I’ll provide a general setup to include a 2D height map for each room, which can be expanded upon for more complex use cases.
Let’s adjust the code to work with a simple version of Room.tscn that can handle size settings:
extends Node
var max_rooms = 10
var room_min_size = Vector2(5, 5)
var room_max_size = Vector2(10, 10)
var map_size = Vector2(100, 100)
var rooms = []
var room_scene: PackedScene = preload(“res://Scenes/Room.tscn”)
func _ready():
print("Preloaded room_scene is: ", room_scene)
if room_scene is PackedScene:
print(“Confirmed that room_scene is a PackedScene”)
generate_dungeon()
else:
print("room_scene is not a PackedScene, it is: ", room_scene.get_class())
func generate_dungeon():
var rng = RandomNumberGenerator.new()
rng.randomize()
for i in range(max_rooms):
var room_width = rng.randi_range(int(room_min_size.x), int(room_max_size.x))
var room_height = rng.randi_range(int(room_min_size.y), int(room_max_size.y))
var x = rng.randi_range(0, int(map_size.x) - room_width)
var y = rng.randi_range(0, int(map_size.y) - room_height)
var room_pos = Vector2(x, y)
var room_size = Vector2(room_width, room_height)
create_room(room_pos, room_size)
func create_room(position, size):
var room_instance = room_scene.instance()
room_instance.set_room_size(size) # Assume Room.tscn’s script handles the size and visual representation.
room_instance.position = position # Assume the position in the script is handled in grid units or directly in pixels.
# Generate a height map for the room here and apply it to the room_instance
# For a simple height map, just assign random heights to a 2D array or to visual elements within the room.
add_child(room_instance)
rooms.append(room_instance)
In the create_room function, there’s a comment suggesting where you would actually create and apply a height map for the room. You’ll need additional logic for generating and representing your height map within the Room.tscn scene.
The code block provided here is a starting point. You will need a concrete implementation of the height map logic as per your game’s design. The representation of the height map and its usage could greatly vary based on whether you’re making a 2D platformer, a top-down game, or a 3D dungeon crawler, so you should adjust the code according to your specific needs.
Also, methods such as create_platformer_view_for_room, on_room_entered, and on_room_exited are placeholders for you to expand upon. Depending on the complexity of your dungeon and how you want to handle room transitions, you’d fill in these methods with relevant code. For example, create_platformer_view_for_room might add platforms and obstacles within the room using procedural generation or by placing pre-built elements based on the room’s size.
show me the script for the room.tsc
|
df76a515fecdd0f4b853c3b57289a5ce
|
{
"intermediate": 0.24856263399124146,
"beginner": 0.5687876343727112,
"expert": 0.18264971673488617
}
|
31,896
|
can you create an application letter template for word
|
4904005ceea9485c78f9d13e7df35eb1
|
{
"intermediate": 0.42794862389564514,
"beginner": 0.35884106159210205,
"expert": 0.2132103443145752
}
|
31,897
|
How to store data in nested specified slot in solidity
|
09d0dfc54c5f39364de70fa81b30b415
|
{
"intermediate": 0.5589993000030518,
"beginner": 0.13775025308132172,
"expert": 0.30325040221214294
}
|
31,898
|
can you make a brick breaker game?
|
acbe643cd645109f8adcf27bad65e8e7
|
{
"intermediate": 0.3113638758659363,
"beginner": 0.3342030644416809,
"expert": 0.3544330298900604
}
|
31,899
|
this is example to store and retrieve data in specific slot in solidity
library Test {
struct Uint256Checkpoint {
uint256 fromBlock;
uint256 value;
}
struct Layout {
mapping(bytes32 => Uint256Checkpoint[]) uint256Checkpoints;
}
bytes32 internal constant STORAGE_SLOT =
keccak256('storage');
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
function _writeCheckpoint(
Uint256Checkpoint[] storage ckpts,
uint256 newValue
) private {
uint256 pos = ckpts.length;
if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
ckpts[pos - 1].value = newValue;
} else {
ckpts.push(Uint256Checkpoint({fromBlock: block.number, value: newValue}));
}
}
function _checkpointsLookup(Uint256Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
uint256 high = ckpts.length;
uint256 low = 0;
while (low < high) {
uint256 mid = Math.average(low, high);
if (ckpts[mid].fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? 0 : ckpts[high - 1].value;
}
}
How to store and retrieve data in votingTokens variable in the following example
library Test {
struct VotingToken {
uint256 chainId;
address token;
address balanceType;
}
struct VotingSystemTokenCheckpoint {
uint256 fromBlock;
VotingToken[] votingTokens;
}
struct VotingSystemLayout {
VotingSystemTokenCheckpoint[] checkpoints;
}
}
|
3148fadb3cdd2d1d287556d016d4404c
|
{
"intermediate": 0.40002089738845825,
"beginner": 0.38121575117111206,
"expert": 0.21876336634159088
}
|
31,900
|
As a discord bot developer using JDA, is there a way to include a button to retry the same command quickly?
|
a2935df540ab4ebc3f09370831150a75
|
{
"intermediate": 0.6598294973373413,
"beginner": 0.070912666618824,
"expert": 0.2692577838897705
}
|
31,901
|
change this program to python language
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double e=exp(-1);
for(int i=1; i<=20; i++){
cout << "E" << i << "=" << e << endl;
e=1-(i+1)*e;
}
return 0;
}
|
02562f43ec35a724ec97abc01dc3c705
|
{
"intermediate": 0.30277398228645325,
"beginner": 0.5079673528671265,
"expert": 0.18925869464874268
}
|
31,902
|
I'm getting this error: - BUTTON_COMPONENT_CUSTOM_ID_REQUIRED: A custom id is required, when adding this: action.addActionRow(new ButtonImpl("customid", "Try Again", ButtonStyle.PRIMARY, "https://www.balls.com", false, null)) to my MessageCreateAction chain to send a message to a text channel in Discord as a bot written in JDA
|
f2998e0ec000981b25cde83ff735ba88
|
{
"intermediate": 0.4749378561973572,
"beginner": 0.30103394389152527,
"expert": 0.22402822971343994
}
|
31,903
|
; Example 1.1:
; Writes "Hello World!" to the text display
JMP boot
stackTop EQU 0xFF ; Initial SP
txtDisplay EQU 0x2E0
hello: DB "Hello World!" ; Output string
DB 0 ; String terminator
boot:
MOV SP, stackTop ; Set SP
MOV C, hello ; Point register C to string
MOV D, txtDisplay ; Point register D to output
CALL print
HLT ; Halt execution
print: ; Print string
PUSH A
PUSH B
MOV B, 0
.loop:
MOVB AL, [C] ; Get character
MOVB [D], AL ; Write to output
INC C
INC D
CMPB BL, [C] ; Check if string terminator
JNZ .loop ; Jump back to loop if not
POP B
POP A
RET
на основе этого примера напиши код с телом: mov rax, 1
mov rbx, 2
mov rcx, 2
m:inc rbx
add rax, rbx
loop m
|
f1486b9475e95a8bb79150a890001181
|
{
"intermediate": 0.2287331521511078,
"beginner": 0.6279901266098022,
"expert": 0.14327672123908997
}
|
31,904
|
How can I force the full name of a subpackage or its beginning in an rpm .spec file?
|
ca69c47d8e2673922238617b56ea876d
|
{
"intermediate": 0.4692860543727875,
"beginner": 0.2582404613494873,
"expert": 0.27247345447540283
}
|
31,905
|
how about vat , why and whe they set it up in history? its a type of txt
|
5f92b1103004b7626e5dc2c940bdb72f
|
{
"intermediate": 0.3015182912349701,
"beginner": 0.4314987361431122,
"expert": 0.26698291301727295
}
|
31,906
|
JDA discord bot. After a ButtonInteractionEvent is fired, how do I delete the message and send a new one?
|
6f762faec292851a8eead793cd3fe7dd
|
{
"intermediate": 0.5530400276184082,
"beginner": 0.1558181345462799,
"expert": 0.2911418676376343
}
|
31,907
|
JDA discord bot. After a ButtonInteractionEvent is fired, how do I delete the message and send a new one? More specifically, I need to acknowledge the button press in JDA, delete the message, and then send a new message
|
c8a0b7884a824ad53ed32b9e11feda9e
|
{
"intermediate": 0.6256759762763977,
"beginner": 0.13625501096248627,
"expert": 0.238069087266922
}
|
31,908
|
using antd and typescript how to hide the buttons of the footer
|
533e454d76070fd249acbbc8137b9a9a
|
{
"intermediate": 0.3113819658756256,
"beginner": 0.2478732168674469,
"expert": 0.4407448172569275
}
|
31,909
|
give step by step how to use this
Skip to content
Product
Solutions
Open Source
Pricing
Search or jump to...
Sign in
Sign up
yonggekkk
/
Cloudflare-workers-pages-vless
Public
Code
Issues
4
Pull requests
1
Actions
Projects
Security
Insights
yonggekkk/Cloudflare-workers-pages-vless
1 branch
0 tags
Latest commit
@yonggekkk
yonggekkk Update README.md
3845ae5
3 days ago
Git stats
80 commits
Files
Type
Name
Latest commit message
Commit time
CDN preferred domain name V23.8.18 (computer win64).exe
Add files via upload
3 months ago
CF preferred anti-generation IP.zip
Add files via upload
3 months ago
README.md
Update README.md
3 days ago
_worker.js
Update _worker.js
last week
README.md
Cloudflare proxy script
Supports deployment in two forms: workers and pages.
There are two types of proxy nodes: vless+ws+tls and vless+ws.
For detailed tutorials, please refer to Yongge’s blog and video tutorials
CF vless code default modification content
1. UUID must be customized
2. proxyIP has been updated to support chatgpt IP, which can be used directly and customized.
3. The disguised webpage has been updated to Microsoft www.bing.com and can be customized.
4. Focus on optimizing the display of node sharing in workers and pages, with domain names and without domain names, so that novices can understand the operation more easily.
CF-CDN preferred domain name one-click script, dedicated to Apple Android phones and tablets (please refer to the tutorial to run in the local network environment):
curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/CFcdnym.sh -o CFcdnym.sh && chmod +x CFcdnym.sh && bash CFcdnym.sh
CF-Preferred anti-generation IP one-click script, dedicated to Apple Android phones and tablets (please refer to the tutorial to run in the local network environment):
curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/cfip.sh -o cfip.sh && chmod +x cfip.sh && bash cfip.sh
Thanks to: CF-vless code author 3Kmfi6HP CF preferred IP program author badafans , XIU2
Thank you for the star in the upper right corner🌟
Stargazers over time
About
The cf-worker-pages-vless script supports Chatgpt by default and supports deployment in workers and pages. CF preferred domain names, preferred anti-generation IP multi-platform one-click scripts. A must-have vless proxy tool for lazy noobs
Topics
cdn proxy domain cloudflare v2ray xray cloudflare-workers vless cloudflare-pages chatgpt yyyyyyyyyyyyyyyyyy edgetunnel edtunnel
Resources
Readme
Activity
Stars
815 stars
Watchers
18 watching
Forks
649 forks
Report repository
Languages
JavaScript
100.0%
Footer
© 2023 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
|
6f298673d066beb8a1f02a794462d7d8
|
{
"intermediate": 0.4567195177078247,
"beginner": 0.32490888237953186,
"expert": 0.2183716595172882
}
|
31,910
|
C# get resolution size in x and y
|
0a4ec90c9c5be376f998ca7a44e8b005
|
{
"intermediate": 0.47987109422683716,
"beginner": 0.2847737669944763,
"expert": 0.23535513877868652
}
|
31,911
|
make a python script that will enumerate a .json file and take in the "student_number" and "holder_name" fields and put them into their own new json object. make sure every "holder_name" is evalulated with a regex expression that swaps the string to the following: Golden, Devin James will turn into Devin Golden
an example json object that will be found in the .json file will be:
{
"id":"5395834",
"deviceid":"5395823",
"studentid":"15666",
"abbreviation":"WRHS",
"student_number":"775004705",
"student_dcid":"15575",
"users_dcid":"",
"teacher_dcid":"",
"holder_name":"Fish, Matthew Ryan",
"end_of_ownership":"",
"start_of_ownership":"10\/03\/2021",
"policy_start_date":"",
"policy_end_date":"",
"insurance_start_date":"",
"insurance_end_date":"",
"notes":"",
"usage_policy_name":"",
"insurance_policy_name":"",
"insurance_cost":"",
"policy_signed": "0",
"insurance_signed": "0"
},
|
f8fcc39907989077cf0759b8ae23ca18
|
{
"intermediate": 0.3835142254829407,
"beginner": 0.2626686096191406,
"expert": 0.3538171648979187
}
|
31,912
|
C# how to open new form on system.thread
|
6a4ee8cf7f303dc605a1376267e23e83
|
{
"intermediate": 0.4232885539531708,
"beginner": 0.3622107207775116,
"expert": 0.21450065076351166
}
|
31,913
|
Explain in painstakingly detail the following code for solving the Game of 24:
|
dd861a80d74d30acb8692d30b2f58d33
|
{
"intermediate": 0.16383925080299377,
"beginner": 0.25554946064949036,
"expert": 0.5806112289428711
}
|
31,914
|
edit the following script to make it enumerate a .txt file instead of a .json file, but make sure the output is still a json file
|
03f4b389e037650a3255e787b7e8b67b
|
{
"intermediate": 0.4525401294231415,
"beginner": 0.21896538138389587,
"expert": 0.32849451899528503
}
|
31,915
|
将伪代码转化为代码for k<-1 to n do xk<-0
y<-b,k<-n
j<-ik(y)
xk<-1
y<-y<-Wk
while ik(y)=k do
y<-y-wk
xk<-xk+1
if ik(y)≠0 then goto 4
|
fb29ac705db68a895853f7b7873852a5
|
{
"intermediate": 0.2787012457847595,
"beginner": 0.4295680820941925,
"expert": 0.29173070192337036
}
|
31,916
|
I want to find a way to record data in three columns: x, y, and z. This is for storing the data for a map for a video game and putting it into a grid/table. What is the best way to do this? Do you understand this task?
|
8152271068a84b6d6544cc7903d86d7a
|
{
"intermediate": 0.43896523118019104,
"beginner": 0.19407965242862701,
"expert": 0.36695513129234314
}
|
31,917
|
C# show new form on another thread
|
eca6bf488f3e40415e27edffb6aca001
|
{
"intermediate": 0.39681175351142883,
"beginner": 0.38459616899490356,
"expert": 0.21859203279018402
}
|
31,918
|
C# new form and that window shows on top of every other window even over fullscreen games
|
810283c63197cf4d0b0a0d63b8120352
|
{
"intermediate": 0.42708641290664673,
"beginner": 0.2764188349246979,
"expert": 0.2964947521686554
}
|
31,919
|
def Revise_settings():
self.QCheck.setChecked(False)
global QL_values
QL_values = [
self.QL1.text(),
self.QL2.text(),
self.QL3.text(),
self.QL4.text(),
self.QL5.text(),
self.QL6.text(),
self.QL7.text(),
self.QL8.text(),
self.QL11.text(),
self.QL12.text(),
self.QL13.text(),
self.QL14.text(),
self.QL15.text(),
self.QL16.text(),
self.QL17.text(),
self.QL18.text(),
self.QL20.text(),
self.QL21.text(),
self.QL22.text(),
self.QL23.text(),
self.QL24.text(),
self.QL25.text(),
self.QL26.text(),
self.QL27.text(),
self.QL28.text(),
self.QL29.text()
]
settings.setValue("vlookup配置参数", QL_values)
return QL_values
pass 修改这段代码,实现QL1-QL29的参数与名称相对应,如何设置并方便后面读取这个文件
|
5cb5ff677c9f7452bec76bc958d297d4
|
{
"intermediate": 0.27887123823165894,
"beginner": 0.3853488564491272,
"expert": 0.3357798755168915
}
|
31,920
|
I have a separate Java program compiled to a jar file with packaged libraries included in the jar required for the jar to run. I can java -jar it fine in the console, but I'm trying to run it within another java program ran as a jar file. I'm doing this by calling that jar file's main method from within my second java program. I'm getting NoClassDefFoundError errors when trying to run the jar from within the second program this way, what could I be doing wrong? I am importing this jar into the modulepath. Should I include it somewhere else?
|
8fb4af6c1d02c1faa0d45a5f1acb71ad
|
{
"intermediate": 0.6297888159751892,
"beginner": 0.2320682555437088,
"expert": 0.1381429135799408
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.