row_id
int64 0
48.4k
| init_message
stringlengths 1
342k
| conversation_hash
stringlengths 32
32
| scores
dict |
|---|---|---|---|
35,138
|
python3 code for implementing convolution2D layer from scratch
|
d077d8cb2766252a4c88d55acf31f5d5
|
{
"intermediate": 0.22277610003948212,
"beginner": 0.10097967088222504,
"expert": 0.6762442588806152
}
|
35,139
|
I want to create a Transformer model and train it on the GSM8K dataset that contains math problems and their resolutions, this model will take input as a problem and find the solution, and i aslo want to create a verifier model that takes the output of the first model and checks if it is right or false and reports that
|
2eb3629cf3d70b7655c3c07adcf2bb09
|
{
"intermediate": 0.13094718754291534,
"beginner": 0.04499159753322601,
"expert": 0.8240612149238586
}
|
35,140
|
Python3 code for maxpool2d layer having stride and padding
|
134347bdb5eaca59592b43d814beffa7
|
{
"intermediate": 0.3386324644088745,
"beginner": 0.1744263619184494,
"expert": 0.4869411885738373
}
|
35,141
|
Исправь этот код, следующим образом: нужно чтобы во время прокрутки колесика мыши происходило нажатие, не после прокрутки, а во время прокрутки, и сделай настраиваемую переменную, которая будет отвечать за время после действия прокрутки
public void ProcessList()
{
const int startX = 1295;
int[] startYpoints = { 365, 435, 505, 565 };
int currentPositionIndex = 0; // Индекс текущей позиции для startYpoints
Point clickPoint = new Point(startX, startYpoints[currentPositionIndex]);
bool endOfList = false;
// Характеристики доверительного интервала
Color endListColor = Color.FromArgb(255, 61, 60, 64);
int tolerance = 12; // Допуск по цветовым компонентам
while (true)
{
// Плавное перемещение до точки нажатия
SmoothMove(Cursor.Position, clickPoint);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(400); // Задержка перед вызовом CheckPrice
var price = CheckPrice();
if (price.HasValue)
{
ChangePrice(price);
}
else
{
Thread.Sleep(100);
}
// Нужно ли скроллить вниз или мы в конце списка
if (!endOfList)
{
// Прокрутка списка
SetCursorPos(clickPoint.X, clickPoint.Y); // Без смещения вверх, прямо на точку клика
int scroling = -120; // Прокрутка на меньшее значение
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, (uint)scroling, 0);
Thread.Sleep(215);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Взятие скриншота для проверки, находимся ли в конце списка
using (Bitmap bmpScreenshot = new Bitmap(1, 1, PixelFormat.Format32bppArgb))
{
using (Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot))
{
gfxScreenshot.CopyFromScreen(1445, 592, 0, 0, new Size(1, 1), CopyPixelOperation.SourceCopy);
Color pixelColor = bmpScreenshot.GetPixel(0, 0);
endOfList = IsColorSimilar(endListColor, pixelColor, tolerance);
}
}
}
else
{
// Если достигнут конец списка, проверяем следующую позицию
currentPositionIndex++;
if (currentPositionIndex >= startYpoints.Length)
{
break; // Выходим из цикла когда все позиции проверены
}
}
// Установка следующей точки нажатия
clickPoint.Y = startYpoints[currentPositionIndex];
}
}
|
6a073407e2f14901ceff2dd589d68664
|
{
"intermediate": 0.42307090759277344,
"beginner": 0.46189573407173157,
"expert": 0.11503336578607559
}
|
35,142
|
Исправь этот код, следующим образом: нужно чтобы во время прокрутки колесика мыши происходило нажатие, не после прокрутки, а во время прокрутки, и сделай настраиваемую переменную, которая будет отвечать за время после действия прокрутки . Это нужно чтобы поймать кнопку во время прокрутки, потому что прокручивает больше чем нужно, но если совершить нажатие во время прокручивания, то кнопка остановится
public void ProcessList()
{
const int startX = 1295;
int[] startYpoints = { 365, 435, 505, 565 };
int currentPositionIndex = 0; // Индекс текущей позиции для startYpoints
Point clickPoint = new Point(startX, startYpoints[currentPositionIndex]);
bool endOfList = false;
// Характеристики доверительного интервала
Color endListColor = Color.FromArgb(255, 61, 60, 64);
int tolerance = 12; // Допуск по цветовым компонентам
while (true)
{
// Плавное перемещение до точки нажатия
SmoothMove(Cursor.Position, clickPoint);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(400); // Задержка перед вызовом CheckPrice
var price = CheckPrice();
if (price.HasValue)
{
ChangePrice(price);
}
else
{
Thread.Sleep(100);
}
// Нужно ли скроллить вниз или мы в конце списка
if (!endOfList)
{
// Прокрутка списка
SetCursorPos(clickPoint.X, clickPoint.Y); // Без смещения вверх, прямо на точку клика
int scroling = -120; // Прокрутка на меньшее значение
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, (uint)scroling, 0);
Thread.Sleep(215);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Взятие скриншота для проверки, находимся ли в конце списка
using (Bitmap bmpScreenshot = new Bitmap(1, 1, PixelFormat.Format32bppArgb))
{
using (Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot))
{
gfxScreenshot.CopyFromScreen(1445, 592, 0, 0, new Size(1, 1), CopyPixelOperation.SourceCopy);
Color pixelColor = bmpScreenshot.GetPixel(0, 0);
endOfList = IsColorSimilar(endListColor, pixelColor, tolerance);
}
}
}
else
{
// Если достигнут конец списка, проверяем следующую позицию
currentPositionIndex++;
if (currentPositionIndex >= startYpoints.Length)
{
break; // Выходим из цикла когда все позиции проверены
}
}
// Установка следующей точки нажатия
clickPoint.Y = startYpoints[currentPositionIndex];
}
}
|
e175f0ad54af8c3116d79e1e5d32292b
|
{
"intermediate": 0.2810334861278534,
"beginner": 0.48170241713523865,
"expert": 0.23726409673690796
}
|
35,143
|
Исправь этот код, следующим образом: нужно чтобы во время прокрутки колесика мыши происходило нажатие, не после прокрутки, а во время прокрутки, и сделай настраиваемую переменную, которая будет отвечать за время после действия прокрутки . Это нужно чтобы поймать кнопку во время прокрутки, потому что прокручивает больше чем нужно, но если совершить нажатие во время прокручивания, то кнопка остановится
public void ProcessList()
{
const int startX = 1295;
int[] startYpoints = { 365, 435, 505, 565 };
int currentPositionIndex = 0; // Индекс текущей позиции для startYpoints
Point clickPoint = new Point(startX, startYpoints[currentPositionIndex]);
bool endOfList = false;
// Характеристики доверительного интервала
Color endListColor = Color.FromArgb(255, 61, 60, 64);
int tolerance = 12; // Допуск по цветовым компонентам
while (true)
{
// Плавное перемещение до точки нажатия
SmoothMove(Cursor.Position, clickPoint);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Thread.Sleep(400); // Задержка перед вызовом CheckPrice
var price = CheckPrice();
if (price.HasValue)
{
ChangePrice(price);
}
else
{
Thread.Sleep(100);
}
// Нужно ли скроллить вниз или мы в конце списка
if (!endOfList)
{
// Прокрутка списка
SetCursorPos(clickPoint.X, clickPoint.Y); // Без смещения вверх, прямо на точку клика
int scroling = -120; // Прокрутка на меньшее значение
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, (uint)scroling, 0);
Thread.Sleep(215);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Взятие скриншота для проверки, находимся ли в конце списка
using (Bitmap bmpScreenshot = new Bitmap(1, 1, PixelFormat.Format32bppArgb))
{
using (Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot))
{
gfxScreenshot.CopyFromScreen(1445, 592, 0, 0, new Size(1, 1), CopyPixelOperation.SourceCopy);
Color pixelColor = bmpScreenshot.GetPixel(0, 0);
endOfList = IsColorSimilar(endListColor, pixelColor, tolerance);
}
}
}
else
{
// Если достигнут конец списка, проверяем следующую позицию
currentPositionIndex++;
if (currentPositionIndex >= startYpoints.Length)
{
break; // Выходим из цикла когда все позиции проверены
}
}
// Установка следующей точки нажатия
clickPoint.Y = startYpoints[currentPositionIndex];
}
}
|
f48c42db3140cb619303fff35ee312fe
|
{
"intermediate": 0.38608357310295105,
"beginner": 0.37941500544548035,
"expert": 0.2345014065504074
}
|
35,144
|
hi
|
81c2dd95cc4ce9a3b254657b9a265caa
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
35,145
|
hi
|
e368d1833981acb50ca0debd45b5b13b
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
35,146
|
hi
|
b8863706cc678a50058bd7c2f5b37769
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
35,147
|
Make a gbc emulator in JavaScript
|
790aa0731e979b156603e34a8ff31329
|
{
"intermediate": 0.4121536314487457,
"beginner": 0.21573291718959808,
"expert": 0.372113436460495
}
|
35,148
|
Make a chip 8 demo in JavaScript
|
10dd602ea788e1332b0db386028a92e7
|
{
"intermediate": 0.3614976108074188,
"beginner": 0.21864762902259827,
"expert": 0.4198547899723053
}
|
35,149
|
What does this eror mean: Kevins-MacBook-Air-3:server kevin$ node index.js
Initializing Database Connection
Initializing Database Connection
Database initialization failed: MongoServerError: bad auth : authentication failed
at Connection.onMessage (/Users/kevin/Desktop/ArchI/archi/server/node_modules/mongoose/node_modules/mongodb/lib/cmap/connection.js:202:26)
at MessageStream.<anonymous> (/Users/kevin/Desktop/ArchI/archi/server/node_modules/mongoose/node_modules/mongodb/lib/cmap/connection.js:61:60)
at MessageStream.emit (node:events:517:28)
at processIncomingData (/Users/kevin/Desktop/ArchI/archi/server/node_modules/mongoose/node_modules/mongodb/lib/cmap/message_stream.js:124:16)
at MessageStream._write (/Users/kevin/Desktop/ArchI/archi/server/node_modules/mongoose/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at TLSSocket.ondata (node:internal/streams/readable:777:22)
at TLSSocket.emit (node:events:517:28) {
ok: 0,
code: 8000,
codeName: 'AtlasError',
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
Error connecting to database
MongooseError: Operation `curriculums.find()` buffering timed out after 10000ms
at Timeout.<anonymous> (/Users/kevin/Desktop/ArchI/archi/server/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:186:23)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
|
bed031714d6907afdf1796fbe6e2f589
|
{
"intermediate": 0.5351773500442505,
"beginner": 0.2697135806083679,
"expert": 0.19510911405086517
}
|
35,150
|
can you provide code to pull stock data from finviz web site
|
a9d0f251b59e250a931dc8639d5b566a
|
{
"intermediate": 0.5714807510375977,
"beginner": 0.061784952878952026,
"expert": 0.3667342960834503
}
|
35,151
|
on google colab I want to download ytd-lp and ffmpg to download mp3 from youtube video and split the audio into parts every part 10 seconds, give me the python script
|
a482471f8724c803cb33144f7764e74d
|
{
"intermediate": 0.4274214506149292,
"beginner": 0.23255424201488495,
"expert": 0.34002435207366943
}
|
35,152
|
Import "telegram.ext" could not be resolvedPylancereportMissingImports
|
53fc51e90a24be3ca51d99e7b3fe9aff
|
{
"intermediate": 0.45635727047920227,
"beginner": 0.30499792098999023,
"expert": 0.2386447638273239
}
|
35,153
|
C:\Users\chinsoont.BECKHOFF>pip install model
ERROR: Could not find a version that satisfies the requirement model (from versions: none)
ERROR: No matching distribution found for model
|
8744170b0b397f42f2d298d78d5e62f2
|
{
"intermediate": 0.27723532915115356,
"beginner": 0.3045908510684967,
"expert": 0.41817376017570496
}
|
35,154
|
why does eating gum make me hiccup?
|
7d6efbe6283237b5732eef318ffd2aa2
|
{
"intermediate": 0.31765151023864746,
"beginner": 0.40839874744415283,
"expert": 0.2739497423171997
}
|
35,155
|
I want you to study this code: import cv2
import typing
import numpy as np
from mltu.inferenceModel import OnnxInferenceModel
from mltu.utils.text_utils import ctc_decoder, get_cer
class ImageToWordModel(OnnxInferenceModel):
def __init__(self, char_list: typing.Union[str, list], *args, **kwargs):
super().__init__(*args, **kwargs)
self.char_list = char_list
def predict(self, image: np.ndarray):
image = cv2.resize(image, self.input_shape[:2][::-1])
image_pred = np.expand_dims(image, axis=0).astype(np.float32)
preds = self.model.run(None, {self.input_name: image_pred})[0]
text = ctc_decoder(preds, self.char_list)[0]
return text
if __name__ == "__main__":
import pandas as pd
from tqdm import tqdm
from mltu.configs import BaseModelConfigs
configs = BaseModelConfigs.load("Models/03_handwriting_recognition/202301111911/configs.yaml")
model = ImageToWordModel(model_path=configs.model_path, char_list=configs.vocab)
df = pd.read_csv("Models/03_handwriting_recognition/202301111911/val.csv").values.tolist()
accum_cer = []
for image_path, label in tqdm(df):
image = cv2.imread(image_path)
prediction_text = model.predict(image)
cer = get_cer(prediction_text, label)
print(f"Image: {image_path}, Label: {label}, Prediction: {prediction_text}, CER: {cer}")
accum_cer.append(cer)
# resize by 4x
image = cv2.resize(image, (image.shape[1] * 4, image.shape[0] * 4))
cv2.imshow("Image", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
print(f"Average CER: {np.average(accum_cer)}")
|
72f96bb886f427a1f5120e0e43041b26
|
{
"intermediate": 0.43667858839035034,
"beginner": 0.36423417925834656,
"expert": 0.1990872323513031
}
|
35,156
|
Hi, I want to use layout recognitation, sentence by sentence and extract all text into a pdf file from a png source. This png contain handwritten text like a form. Provide me a comprehensive guide on how to do so for a complete beginner
|
803955cb5b0753409bd34d735881f1e8
|
{
"intermediate": 0.3012080788612366,
"beginner": 0.23079699277877808,
"expert": 0.46799492835998535
}
|
35,157
|
@GetMapping(“/khxx”)
public String getCustomerInfo(@RequestParam(“acceptanceCustomerId”) Long acceptanceCustomerId, Model model) {
AcceptanceCustomer acceptanceCustomer = acceptanceCustomerService.findKhxx(acceptanceCustomerId);
model.addAttribute(“acceptanceCustomer”, acceptanceCustomer);
return FebsUtil.view(“bw/acceptanceCustomer/khxx”);
}
|
f2e66d01caf7bdcbf1acd2f5829989f1
|
{
"intermediate": 0.48958101868629456,
"beginner": 0.3006322681903839,
"expert": 0.20978675782680511
}
|
35,158
|
hello
|
edb4b5e1f1ebe961c411d1d08372fa49
|
{
"intermediate": 0.32064199447631836,
"beginner": 0.28176039457321167,
"expert": 0.39759764075279236
}
|
35,159
|
Write a plan to backup only users and projects from Sentry deployment in Kubernetes (helm)
|
0e9acabeb363500a16eeb12c86933ae0
|
{
"intermediate": 0.3665756583213806,
"beginner": 0.20844179391860962,
"expert": 0.42498254776000977
}
|
35,160
|
write me a code for pine editor for fx. strategy will be trading along the 10day moving average
|
28130f879f41c4ec91daa3f522fd11fa
|
{
"intermediate": 0.37535372376441956,
"beginner": 0.2788395881652832,
"expert": 0.34580671787261963
}
|
35,161
|
this is script for coinscrash website for custom run update its as i earn fast and more from it "var baseBet = 1; var baseMultiplier = 1.05;var variableBase = false;var streakSecurity = 25; var maximumBet = 999999;
var baseSatoshi = baseBet * 100; var currentBet = baseSatoshi;var currentMultiplier = baseMultiplier;var currentGameID = -1;
var firstGame = true;var lossStreak = 0;var coolingDown = false;
console.log('=====WIN=====');
console.log('My username is: ' + engine.getUsername());
console.log('Starting balance: ' + (engine.getBalance() / 100).toFixed(2) + ' bits');
var startingBalance = engine.getBalance();if (variableBase) {
console.warn('[WARN] Variable mode is enabled and not fully tested. Bot is resillient to ' + streakSecurity + '-loss streaks.');
}
engine.on('game_starting', function(info) {
console.log('====== New Game ======');console.log('[Bot] Game #' + info.game_id);currentGameID = info.game_id;
if (coolingDown) {
if (lossStreak == 0) {
coolingDown = false;
}
else {
lossStreak--;
console.log('[Bot] Cooling down! Games remaining: ' + lossStreak);return;
}
}
if (!firstGame) { // Display data only after first game played.
console.log('[Stats] Session profit: ' + ((engine.getBalance() - startingBalance) / 100).toFixed(2) + ' bits');
console.log('[Stats] Profit percentage: ' + (((engine.getBalance() / startingBalance) - 1) * 100).toFixed(2) + '%');
}
if (engine.lastGamePlay() == 'LOST' && !firstGame) {
lossStreak++;var totalLosses = 0; var lastLoss = currentBet; while (lastLoss >= baseSatoshi) {
totalLosses += lastLoss;lastLoss /= 4;
}
if (lossStreak > streakSecurity) {
coolingDown = true;return;
}
currentBet *= 6; currentMultiplier = 1.00 + (totalLosses / currentBet);
}
else {
lossStreak = 0; if (variableBase) {
var divider = 100;for (i = 0; i < streakSecurity; i++) {
divider += (100 * Math.pow(4, (i + 1)));
}
newBaseBet = Math.min(Math.max(1, Math.floor(engine.getBalance() / divider)), maximumBet * 100);
newBaseSatoshi = newBaseBet * 100;if ((newBaseBet != baseBet) || (newBaseBet == 1)) {
console.log('[Bot] Variable mode has changed base bet to: ' + newBaseBet + ' bits');
baseBet = newBaseBet;baseSatoshi = newBaseSatoshi;
}
}
currentBet = baseSatoshi; currentMultiplier = baseMultiplier;
}
console.log('[Bot] Betting ' + (currentBet / 100) + ' bits, cashing out at ' + currentMultiplier + 'x');
firstGame = false;if (currentBet <= engine.getBalance()) {
if (currentBet > (maximumBet * 100)) {
console.warn('[Warn] Bet size exceeds maximum bet, lowering bet to ' + (maximumBet * 100) + ' bits');currentBet = maximumBet;
}
engine.placeBet(currentBet, Math.round(currentMultiplier * 100), false);
}
else {
if (engine.getBalance() < 100) {
console.error('[Bot] Insufficent funds to do anything... stopping');engine.stop();
}
else {
console.warn('[Bot] Insufficent funds to bet ' + (currentBet / 100) + ' bits.');console.warn('[Bot] Resetting to 1 bit basebet'); baseBet = 1;baseSatoshi = 100;
}
}
});
engine.on('game_started', function(data) {
if (!firstGame) { console.log('[Bot] Game #' + currentGameID + ' has started!'); }
});
engine.on('cashed_out', function(data) {
if (data.username == engine.getUsername()) {
console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x');
}
});
engine.on('game_crash', function(data) {
if (!firstGame) { console.log('[Bot] Game crashed at ' + (data.game_crash / 100) + 'x'); }
});"
|
039552b8da007be97b853d5d2cd2d43d
|
{
"intermediate": 0.34788814187049866,
"beginner": 0.45779314637184143,
"expert": 0.19431868195533752
}
|
35,162
|
How to enable two-factor authentication on github using command line git in Linux?
|
4f2edb5e6ad8fc2d7fc9110560c360a4
|
{
"intermediate": 0.5503531098365784,
"beginner": 0.15570156276226044,
"expert": 0.2939453423023224
}
|
35,163
|
How to enable two-factor authentication on github using command line git in Linux?
|
1845736584cae5954641c040a65af54a
|
{
"intermediate": 0.5503531098365784,
"beginner": 0.15570156276226044,
"expert": 0.2939453423023224
}
|
35,164
|
Help me create a training function that adjusts the learning rate based on the improvement in the loss function each epoch
|
ff4c1b9f028b966ea6c4f75bbc1a7456
|
{
"intermediate": 0.14821040630340576,
"beginner": 0.08008845895528793,
"expert": 0.7717011570930481
}
|
35,165
|
Hello
|
10ce990a6a07fe9dba5d0e7adde7957b
|
{
"intermediate": 0.3123404085636139,
"beginner": 0.2729349136352539,
"expert": 0.4147246778011322
}
|
35,166
|
import tensorflow as tf
import numpy as np
# Hyperparameters
batch_size = 96
block_size = 20
max_iters = 200
eval_interval = 100
learning_rate = 1e-3
device = 'cuda:0' if tf.test.is_gpu_available() else 'cpu'
eval_iters = 20 # Changed to 20 for consistency with eval_interval
n_embd = 16
n_head = 2
n_layer = 2
dropout_rate = 0.0 # Renamed from dropout for clarity
hidden_nodes = 20
tf.random.set_seed(1337)
with open('data/universe.txt', 'r', encoding='utf-8') as f:
text = f.read()
data = np.array([ord(c) for c in text], dtype=np.int32)
n = int(0.9 * len(data))
train_data = data[:n]
val_data = data[n:]
@tf.function
def get_batch(split):
data = train_data if split == 'train' else val_data
ix = np.random.randint(0, len(data) - block_size, size=(batch_size,))
x = np.array([data[i:i + block_size] for i in ix])
y = np.array([data[i + 1:i + block_size + 1] for i in ix])
return x, y
class GPTLanguageModel(tf.keras.Model):
def __init__(self, vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate=0.1):
super(GPTLanguageModel, self).__init__()
self.token_embedding_table = tf.keras.layers.Embedding(vocab_size, n_embd)
self.position_embedding_table = tf.keras.layers.Embedding(block_size, n_embd)
self.blocks = [self._build_block(n_embd, n_head) for _ in range(n_layer)]
self.ln_f = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.lm_head = tf.keras.layers.Dense(vocab_size)
def _build_block(self, n_embd, n_head):
head_size = n_embd // n_head # Bug fixed, removed '+ 1'
return tf.keras.Sequential([
tf.keras.layers.LayerNormalization(epsilon=1e-6),
tf.keras.layers.MultiHeadAttention(num_heads=n_head, key_dim=head_size),
tf.keras.layers.Dense(4 * n_embd, activation='relu'),
tf.keras.layers.Dense(n_embd)
])
def call(self, idx, targets=None, training=False):
B, T = tf.shape(idx)[0], tf.shape(idx)[1]
tok_emb = self.token_embedding_table(idx)
pos_emb = self.position_embedding_table(tf.range(T))
x = tok_emb + tf.cast(pos_emb[None, :, :], tok_emb.dtype) # Explicit casting to match dtype
for block in self.blocks:
x = block(x, training=training)
x = self.ln_f(x)
logits = self.lm_head(x)
loss = None
if targets is not None:
loss = self.compute_loss(logits, targets)
return logits, loss
def compute_loss(self, logits, targets):
loss = tf.keras.losses.sparse_categorical_crossentropy(targets, logits, from_logits=True)
return tf.reduce_mean(loss)
def generate(self, idx, max_new_tokens):
for _ in range(max_new_tokens):
logits, _ = self(idx[:, -block_size:], training=False)
logits = logits[:, -1, :]
idx_next = tf.random.categorical(logits, num_samples=1, dtype=tf.int32)
idx = tf.concat([idx, idx_next], axis=1)
return idx
vocab_size = len(set(data))
model = GPTLanguageModel(vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate)
optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
train_loss_metric = tf.keras.metrics.Mean(name='train_loss')
val_loss_metric = tf.keras.metrics.Mean(name='val_loss')
@tf.function
def train_step(inputs, targets):
with tf.GradientTape() as tape:
_, loss = model(inputs, targets, training=True)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
train_loss_metric.update_state(loss)
@tf.function
def val_step(inputs, targets):
_, loss = model(inputs, targets, training=False)
val_loss_metric.update_state(loss)
# Convert numpy operations to Tensor operations
def numpy_to_tensor(numpy_function):
def tensor_function(*args, **kwargs):
tensor_args = [tf.convert_to_tensor(arg) for arg in args]
return numpy_function(*tensor_args, **kwargs)
return tensor_function
get_batch = numpy_to_tensor(get_batch)
for iteration in range(max_iters):
for _ in range(eval_interval):
inputs, targets = get_batch('train')
train_step(inputs, targets)
for _ in range(eval_iters):
inputs, targets = get_batch('val')
val_step(inputs, targets)
if (iteration + 1) % eval_interval == 0:
train_loss = train_loss_metric.result()
val_loss = val_loss_metric.result()
print(f'Iteration {iteration + 1}: Train Loss = {train_loss:.4f}, Val Loss = {val_loss:.4f}')
train_loss_metric.reset_states()
val_loss_metric.reset_states()
model.save('Universe-GPT-tf.keras', save_format='tf')
|
02cb30295548dab44a8531c0bc113cc4
|
{
"intermediate": 0.30709314346313477,
"beginner": 0.46093088388442993,
"expert": 0.23197594285011292
}
|
35,167
|
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.text.TextField;
import flash.events.Event;
import flash.display.StageAlign;
import flash.events.KeyboardEvent;
import flash.desktop.NativeApplication;
import flash.events.InvokeEvent;
import flash.display.StageDisplayState;
import flash.ui.Keyboard;
import flash.geom.Rectangle;
import flash.display.Screen;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageQuality;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;
import flash.events.IOErrorEvent;
import flash.net.URLVariables;
import flash.net.URLRequest;
import background.Background;
public class GameLoader extends Sprite
{
private var loader:Loader;
private var locale:String;
public var log:TextField;
private var fullScreen:Boolean;
private var _background:Background;
public function GameLoader()
{
if (stage)
{
this.init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, this.init);
};
}
private function init(e:Event=null):void
{
removeEventListener(Event.ADDED_TO_STAGE, this.init);
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 60;
stage.nativeWindow.maximize();
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.onKey);
this.setCenterPosition();
this.configureStage();
this.createBackground();
this.log = new TextField();
this.log.x = 15;
this.log.y = 15;
this.log.width = 520;
this.log.height = 370;
this.log.background = true;
this.logEvent("aaa");
try
{
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, this.onInvoke);
}
catch(e:Error)
{
logEvent(e.getStackTrace());
throw (e);
};
}
private function configureStage():void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
stage.stageFocusRect = false;
mouseEnabled = false;
tabEnabled = false;
}
private function createBackground():void
{
this._background = new Background();
stage.addChild(this._background);
}
private function removeFromStageBackground():void
{
if (stage.contains(this._background))
{
stage.removeChild(this._background);
};
}
private function onKey(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.F11:
this.fullScreen = (!(this.fullScreen));
if (this.fullScreen)
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
else
{
stage.displayState = StageDisplayState.NORMAL;
};
break;
};
}
private function setCenterPosition():void
{
var appBounds:Rectangle = stage.nativeWindow.bounds;
var screen:Screen = Screen.getScreensForRectangle(appBounds)[0];
stage.nativeWindow.x = ((screen.bounds.width - stage.nativeWindow.width) / 2);
stage.nativeWindow.y = ((screen.bounds.height - stage.nativeWindow.height) / 2);
}
private function onInvoke(event:*):void
{
if (event.arguments.length > 0)
{
this.logEvent(("Arguments: " + event.arguments.toString()));
this.locale = event.arguments[0];
};
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
this.loader = new Loader();
this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);
this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void
{
});
var flashvars:URLVariables = new URLVariables();
flashvars["locale"] = this.locale;
flashvars["rnd"] = Math.random();
var urlReq:URLRequest = new URLRequest("battles.swf");
urlReq.data = flashvars;
this.loader.load(urlReq, context);
}
public function logEvent(entry:String):void
{
this.log.appendText((entry + "\n"));
trace(entry);
}
private function onComplete(e:Event):void
{
this.loader.removeEventListener(Event.COMPLETE, this.onComplete);
this.removeFromStageBackground();
var mainClass:Class = Class(this.loader.contentLoaderInfo.applicationDomain.getDefinition("Game"));
var obj:* = new (mainClass)();
obj.SUPER(stage);
addChild(obj);
}
}
}
как сюда добавить текст
|
fb8d70949c531bba4e941836e83ced73
|
{
"intermediate": 0.33036008477211,
"beginner": 0.49973613023757935,
"expert": 0.16990378499031067
}
|
35,168
|
how to tenacity implement timeout for while loop
|
fd1e452e8496eb5f8d5dd31216b86d63
|
{
"intermediate": 0.28802722692489624,
"beginner": 0.4221611022949219,
"expert": 0.2898116409778595
}
|
35,169
|
package
{
import flash.display.Sprite;
import flash.display.Loader;
import flash.text.TextField;
import flash.events.Event;
import flash.display.StageAlign;
import flash.events.KeyboardEvent;
import flash.desktop.NativeApplication;
import flash.events.InvokeEvent;
import flash.display.StageDisplayState;
import flash.ui.Keyboard;
import flash.geom.Rectangle;
import flash.display.Screen;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.display.StageQuality;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;
import flash.events.IOErrorEvent;
import flash.net.URLVariables;
import flash.net.URLRequest;
import background.Background;
public class GameLoader extends Sprite
{
private var loader:Loader;
private var locale:String;
public var log:TextField;
private var fullScreen:Boolean;
private var _background:Background;
public function GameLoader()
{
if (stage)
{
this.init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, this.init);
};
}
private function init(e:Event=null):void
{
removeEventListener(Event.ADDED_TO_STAGE, this.init);
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 60;
stage.nativeWindow.maximize();
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.onKey);
this.setCenterPosition();
this.configureStage();
this.createBackground();
this.log = new TextField();
this.log.x = 15;
this.log.y = 15;
this.log.width = 520;
this.log.height = 370;
this.log.background = true;
this.logEvent("aaa");
try
{
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, this.onInvoke);
}
catch(e:Error)
{
logEvent(e.getStackTrace());
throw (e);
};
}
private function configureStage():void
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
stage.stageFocusRect = false;
mouseEnabled = false;
tabEnabled = false;
}
private function createBackground():void
{
this._background = new Background();
stage.addChild(this._background);
}
private function removeFromStageBackground():void
{
if (stage.contains(this._background))
{
stage.removeChild(this._background);
};
}
private function onKey(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.F11:
this.fullScreen = (!(this.fullScreen));
if (this.fullScreen)
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
else
{
stage.displayState = StageDisplayState.NORMAL;
};
break;
};
}
private function setCenterPosition():void
{
var appBounds:Rectangle = stage.nativeWindow.bounds;
var screen:Screen = Screen.getScreensForRectangle(appBounds)[0];
stage.nativeWindow.x = ((screen.bounds.width - stage.nativeWindow.width) / 2);
stage.nativeWindow.y = ((screen.bounds.height - stage.nativeWindow.height) / 2);
}
private function onInvoke(event:*):void
{
if (event.arguments.length > 0)
{
this.logEvent(("Arguments: " + event.arguments.toString()));
this.locale = event.arguments[0];
};
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
this.loader = new Loader();
this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);
this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void
{
});
var flashvars:URLVariables = new URLVariables();
flashvars["locale"] = this.locale;
flashvars["rnd"] = Math.random();
var urlReq:URLRequest = new URLRequest("battles.swf");
urlReq.data = flashvars;
this.loader.load(urlReq, context);
}
private function onConnectError(event:Event=null):void
{
Alert.showMessage("Can not connect to server!");
stage.nativeWindow.visible = true;
}
public function logEvent(entry:String):void
{
this.log.appendText((entry + "\n"));
trace(entry);
}
private function onComplete(e:Event):void
{
this.loader.removeEventListener(Event.COMPLETE, this.onComplete);
this.removeFromStageBackground();
var mainClass:Class = Class(this.loader.contentLoaderInfo.applicationDomain.getDefinition("Game"));
var obj:* = new (mainClass)();
obj.SUPER(stage);
addChild(obj);
}
}
}
как сделать чтобы когда не удалось получиться battles.swf вызывалась функция onConnectError
|
86703eec91da7682bd588b79b0845682
|
{
"intermediate": 0.33036008477211,
"beginner": 0.49973613023757935,
"expert": 0.16990378499031067
}
|
35,170
|
I have a regex that looks like this in JS. export const SPECIAL_SYMBOLS_PATTERN =
// eslint-disable-next-line no-useless-escape
/^[^\:\;\!\?\+\-\,\.\=\(\)\{\}\[\]\@\"\'\|\/\<\>\*\$\#\№\%\^\&]*$/;
Next, I have a string of text that may or may not containt any of the symbols that are disabled in the regex above. Write me a function that will recieve the string, then apply this regex to it, modifying it and thus removing any of the special symbols specified in the regex and would return the updated string.
|
81a50884f995cb5ee1a0db2256efda22
|
{
"intermediate": 0.530534029006958,
"beginner": 0.25099197030067444,
"expert": 0.21847395598888397
}
|
35,171
|
Three Js code to load "test.glb" file and launch "anim" animation, with morhing between "pos1" and "pos2" shape keys of "main" object
|
b0e840cb57d765f82998bc80f413338a
|
{
"intermediate": 0.5735260844230652,
"beginner": 0.13964007794857025,
"expert": 0.28683382272720337
}
|
35,172
|
In JS I have the array, nums = [0,0,1,1,1,2,2,3,3,4]. Using this function I try to remove all of the duplicates from it. /**
* @param {number[]} nums
* @return {number}
*/
var removeDuplicates = function(nums) {
for (let i = 0; i < nums.length; i += 1) {
if (nums?.[i + 1] === nums[i]) {
nums.splice(i,1);
}
}
const k = nums.length;
return k;
};
However in the output the array that will be shown is [0,1,1,2,3,4]. Why doesn't my code removes the second 1? Explain
|
8275703e40933b9fab1bf28800ca1512
|
{
"intermediate": 0.634043276309967,
"beginner": 0.1894582360982895,
"expert": 0.17649854719638824
}
|
35,174
|
using this regex
export const SPECIAL_SYMBOLS_PATTERN = '/^[^\:\;\!\?\+\-\,\.\=\(\)\{\}\[\]\@\"\'\|\/\<\>\*\$\#\№\%\^\&]*$/g;'
I need to 1. perform onPaste event in React, 2. take the text that is going to be copied, 3. apply the regex to it so it would remove all of the special symbols specified in the regex, 4. paste the updated text into the input. How do I do that?
If the regex above is incorrect then modify it but explain what exactly is wrong with it.
|
eeb825b850be100ebf1d1278b8375084
|
{
"intermediate": 0.5224485397338867,
"beginner": 0.20760643482208252,
"expert": 0.26994502544403076
}
|
35,175
|
when i run this code: import tensorflow as tf
import numpy as np
# Hyperparameters
batch_size = 96
block_size = 20
max_iters = 200
eval_interval = 100
learning_rate = 1e-3
device = 'cuda:0' if tf.test.is_gpu_available() else 'cpu'
eval_iters = 20 # Changed to 20 for consistency with eval_interval
n_embd = 16
n_head = 2
n_layer = 2
dropout_rate = 0.0 # Renamed from dropout for clarity
hidden_nodes = 20
tf.random.set_seed(1337)
with open('data/universe.txt', 'r', encoding='utf-8') as f:
text = f.read()
data = np.array([ord(c) for c in text], dtype=np.int32)
n = int(0.9 * len(data))
train_data = data[:n]
val_data = data[n:]
@tf.function
def get_batch(split):
data = train_data if split == 'train' else val_data
ix = np.random.randint(0, len(data) - block_size, size=(batch_size,))
x = np.array([data[i:i + block_size] for i in ix])
y = np.array([data[i + 1:i + block_size + 1] for i in ix])
return x, y
@tf.keras.utils.register_keras_serializable()
class GPTLanguageModel(tf.keras.Model):
def __init__(self, vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate=0.1):
super(GPTLanguageModel, self).__init__()
self.token_embedding_table = tf.keras.layers.Embedding(vocab_size, n_embd)
self.position_embedding_table = tf.keras.layers.Embedding(block_size, n_embd)
self.blocks = [self._build_block(n_embd, n_head) for _ in range(n_layer)]
self.ln_f = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.lm_head = tf.keras.layers.Dense(vocab_size)
def _build_block(self, n_embd, n_head):
head_size = n_embd // n_head # Bug fixed, removed '+ 1'
return tf.keras.Sequential([
tf.keras.layers.LayerNormalization(epsilon=1e-6),
tf.keras.layers.MultiHeadAttention(num_heads=n_head, key_dim=head_size),
tf.keras.layers.Dense(4 * n_embd, activation='relu'),
tf.keras.layers.Dense(n_embd)
])
def call(self, idx, targets=None, training=False):
B, T = tf.shape(idx)[0], tf.shape(idx)[1]
tok_emb = self.token_embedding_table(idx)
pos_emb = self.position_embedding_table(tf.range(T))
x = tok_emb + tf.cast(pos_emb[None, :, :], tok_emb.dtype) # Explicit casting to match dtype
for block in self.blocks:
x = block(x, training=training)
x = self.ln_f(x)
logits = self.lm_head(x)
loss = None
if targets is not None:
loss = self.compute_loss(logits, targets)
return logits, loss
def compute_loss(self, logits, targets):
loss = tf.keras.losses.sparse_categorical_crossentropy(targets, logits, from_logits=True)
return tf.reduce_mean(loss)
def generate(self, idx, max_new_tokens):
for _ in range(max_new_tokens):
logits, _ = self(idx[:, -block_size:], training=False)
logits = logits[:, -1, :]
idx_next = tf.random.categorical(logits, num_samples=1, dtype=tf.int32)
idx = tf.concat([idx, idx_next], axis=1)
return idx
vocab_size = len(set(data))
model = GPTLanguageModel(vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate)
optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
train_loss_metric = tf.keras.metrics.Mean(name='train_loss')
val_loss_metric = tf.keras.metrics.Mean(name='val_loss')
@tf.function
def train_step(inputs, targets):
with tf.GradientTape() as tape:
_, loss = model(inputs, targets, training=True)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
train_loss_metric.update_state(loss)
@tf.function
def val_step(inputs, targets):
_, loss = model(inputs, targets, training=False)
val_loss_metric.update_state(loss)
# Convert numpy operations to Tensor operations
def numpy_to_tensor(numpy_function):
def tensor_function(*args, **kwargs):
tensor_args = [tf.convert_to_tensor(arg) for arg in args]
return numpy_function(*tensor_args, **kwargs)
return tensor_function
get_batch = numpy_to_tensor(get_batch)
for iteration in range(max_iters):
for _ in range(eval_interval):
inputs, targets = get_batch('train')
train_step(inputs, targets)
for _ in range(eval_iters):
inputs, targets = get_batch('val')
val_step(inputs, targets)
if (iteration + 1) % eval_interval == 0:
train_loss = train_loss_metric.result()
val_loss = val_loss_metric.result()
print(f'Iteration {iteration + 1}: Train Loss = {train_loss:.4f}, Val Loss = {val_loss:.4f}')
train_loss_metric.reset_states()
val_loss_metric.reset_states()
model.save('Universe-GPT-tf.keras', save_format='tf') i get this error: Traceback (most recent call last):
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\reweight-gpt-tensorflow.py", line 120, in <module>
inputs, targets = get_batch('train')
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\reweight-gpt-tensorflow.py", line 113, in tensor_function
return numpy_function(*tensor_args, **kwargs)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\Dell-PC\AppData\Local\Temp\__autograph_generated_file8l22u1l3.py", line 11, in tf__get_batch
ix = ag__.converted_call(ag__.ld(np).random.randint, (0, ag__.converted_call(ag__.ld(len), (ag__.ld(data),), None, fscope) - ag__.ld(block_size)), dict(size=(ag__.ld(batch_size),)), fscope)
File "mtrand.pyx", line 763, in numpy.random.mtrand.RandomState.randint
File "_bounded_integers.pyx", line 1323, in numpy.random._bounded_integers._rand_int32
NotImplementedError: in user code:
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\reweight-gpt-tensorflow.py", line 32, in get_batch *
ix = np.random.randint(0, len(data) - block_size, size=(batch_size,))
File "mtrand.pyx", line 763, in numpy.random.mtrand.RandomState.randint **
File "_bounded_integers.pyx", line 1323, in numpy.random._bounded_integers._rand_int32
NotImplementedError: Cannot convert a symbolic tf.Tensor (sub:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported.
|
83facdd15e9eb8af20e3da719d570df4
|
{
"intermediate": 0.2836640477180481,
"beginner": 0.5024887919425964,
"expert": 0.21384717524051666
}
|
35,176
|
what does this regex do? '/^[^\:\;\!\?\+\-\,\.\=\(\)\{\}\[\]\@\"\'\|\/\<\>\*\$\#\№\%\^\&]*$/g'
|
6ccdfe480ad836dfc540687c07bf2fa1
|
{
"intermediate": 0.349948912858963,
"beginner": 0.4294440448284149,
"expert": 0.22060701251029968
}
|
35,177
|
How to clean email cache in Thunderbird in Linux?
|
134547bceb33c8859a44507d406f2db7
|
{
"intermediate": 0.5283655524253845,
"beginner": 0.16003398597240448,
"expert": 0.3116004467010498
}
|
35,178
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы нельзя было отправить пароль без символов
|
79a83d5965fe377dbcda045ec01a1464
|
{
"intermediate": 0.30530813336372375,
"beginner": 0.3773578107357025,
"expert": 0.31733399629592896
}
|
35,179
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы пароль не мог отправить так auth;dsda;;, чтобы когда пароль пуст он не пытался ввойти на аккаунт
|
6708a339c28c103ff788cee9e267b687
|
{
"intermediate": 0.30530813336372375,
"beginner": 0.3773578107357025,
"expert": 0.31733399629592896
}
|
35,180
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать в auth чтобы в пароля минимум было 4 символа
|
c6a7ba31e2d4118e99093dd89acb8443
|
{
"intermediate": 0.30530813336372375,
"beginner": 0.3773578107357025,
"expert": 0.31733399629592896
}
|
35,181
|
I need to find my discord token since my script that uses it expired and no longer works. I can't seem to find my script that fetched it for me so can you code one for me?
|
c7df39a71e2db7c27996724f813b03eb
|
{
"intermediate": 0.5344703793525696,
"beginner": 0.20750705897808075,
"expert": 0.2580225467681885
}
|
35,182
|
help me improve this csv function to make it more readable and make a more readable csv file that gives good insight on the weight coming in and out and the combined at the end of every week:
async def update_csv(result, in_or_out, scale):
global weekdays_name
if in_or_out == "None":
print("Kan icke vara None")
return
if result is None:
print("No result to update CSV.")
return
week = datetime.now().isocalendar().week
weekday = datetime.now().isocalendar().weekday
weekday = weekdays_name[weekday - 1]
file_name = f"{in_or_out}/{in_or_out}_Elektronik_{week}.csv"
file_exists = os.path.isfile(f"WeeklyUpdates/{file_name}")
if not file_exists:
with open(f"WeeklyUpdates/{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(f"WeeklyUpdates/{file_name}", "r") as csvfile:
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
rows = list(reader)
# Check if the date already exists
total_weight = 0
for row in rows:
if weekday == row[1]: # Check if the weekday matches the current weekday
total_weight += float(
row[0]
) # Add the weight of the current day to the total weight
# Add the weight of the current day to the total weight
total_weight += float(result)
# Append the new row to the rows list
rows.append([str(result), weekday, round(total_weight, 2)])
# Write the updated rows to the CSV file
with open(f"WeeklyUpdates/{file_name}", "w", newline="") as csvfile:
writer = csv.writer(csvfile, delimiter=",", quotechar='"')
writer.writerows(rows)
# Read the 'in' and 'out' CSV files into pandas DataFrames
df_in = pd.read_csv(f"WeeklyUpdates/{in_or_out}/{in_or_out}_Elektronik_{week}.csv")
df_out = pd.read_csv(f"WeeklyUpdates/{in_or_out}/{in_or_out}_Elektronik_{week}.csv")
# Merge the 'in' and 'out' DataFrames
df_merged = pd.concat([df_in, df_out], ignore_index=True)
# Write the merged DataFrame to a new CSV file
df_merged.to_csv(f"WeeklyUpdates/merged_{week}.csv", index=False)
return "Done"
|
a3b34cffccc049f0678beeb68d704999
|
{
"intermediate": 0.3259275257587433,
"beginner": 0.42706605792045593,
"expert": 0.2470064014196396
}
|
35,183
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы для auth для никнейма и пароль нельзя было оставлять поле пустым
|
5ffe94343c8647dd18607da5af48e7bd
|
{
"intermediate": 0.30530813336372375,
"beginner": 0.3773578107357025,
"expert": 0.31733399629592896
}
|
35,184
|
Check for bugs: import tensorflow as tf
import numpy as np
# Hyperparameters
batch_size = 96
block_size = 20
max_iters = 200
eval_interval = 100
learning_rate = 1e-3
device = 'cuda:0' if tf.test.is_gpu_available() else 'cpu'
eval_iters = 20 # Changed to 20 for consistency with eval_interval
n_embd = 16
n_head = 2
n_layer = 2
dropout_rate = 0.0 # Renamed from dropout for clarity
hidden_nodes = 20
tf.random.set_seed(1337)
with open('data/universe.txt', 'r', encoding='utf-8') as f:
text = f.read()
data = np.array([ord(c) for c in text], dtype=np.int32)
n = int(0.9 * len(data))
train_data = data[:n]
val_data = data[n:]
@tf.function
def get_batch(split):
data_tensor = tf.convert_to_tensor(train_data if split == "train" else val_data, dtype=tf.int32)
max_index = tf.shape(data_tensor)[0] - block_size
ix = tf.random.uniform((batch_size,), minval=0, maxval=max_index, dtype=tf.int32)
ix_expanded = tf.expand_dims(ix, -1)
ix_offset = tf.range(block_size)
ix_combined = ix_expanded + ix_offset
x = tf.gather(data_tensor, ix_combined, axis=0)
y = tf.gather(data_tensor, ix_combined + 1, axis=0)
return x, y
@tf.keras.utils.register_keras_serializable()
class GPTLanguageModel(tf.keras.Model):
def __init__(self, vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate=0.1):
super(GPTLanguageModel, self).__init__()
self.token_embedding_table = tf.keras.layers.Embedding(vocab_size, n_embd)
self.position_embedding_table = tf.keras.layers.Embedding(block_size, n_embd)
self.blocks = [self._build_block(n_embd, n_head) for _ in range(n_layer)]
self.ln_f = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.lm_head = tf.keras.layers.Dense(vocab_size)
def _build_block(self, n_embd, n_head):
head_size = n_embd // n_head
return tf.keras.Sequential([
tf.keras.layers.LayerNormalization(epsilon=1e-6),
tf.keras.layers.MultiHeadAttention(num_heads=n_head, key_dim=head_size, attention_axes=(1,)),
tf.keras.layers.Dropout(dropout_rate), # Add dropout, you can remove if dropout_rate is 0
tf.keras.layers.Dense(4 * n_embd, activation="relu"),
tf.keras.layers.Dropout(dropout_rate), # Add dropout, you can remove if dropout_rate is 0
tf.keras.layers.Dense(n_embd)
])
def call(self, idx, targets=None, training=False):
B, T = tf.shape(idx)[0], tf.shape(idx)[1]
tok_emb = self.token_embedding_table(idx)
pos_emb = self.position_embedding_table(tf.range(T))
x = tok_emb + tf.cast(pos_emb[None, :, :], tok_emb.dtype)
attention_mask = self.create_look_ahead_mask(T)
for block in self.blocks:
x = block([x, x, x], training=training, mask=attention_mask)
x = self.ln_f(x)
logits = self.lm_head(x)
loss = None
if targets is not None:
loss = self.compute_loss(logits, targets)
return logits, loss
def compute_loss(self, logits, targets):
loss = tf.keras.losses.sparse_categorical_crossentropy(targets, logits, from_logits=True)
return tf.reduce_mean(loss)
def generate(self, idx, max_new_tokens):
for _ in range(max_new_tokens):
logits, _ = self(idx[:, -block_size:], training=False)
logits = logits[:, -1, :]
idx_next = tf.random.categorical(logits, num_samples=1, dtype=tf.int32)
idx = tf.concat([idx, idx_next], axis=1)
return idx
def create_look_ahead_mask(self, size):
return 1 - tf.linalg.band_part(tf.ones((size, size)), -1, 0)
vocab_size = len(set(data))
model = GPTLanguageModel(vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate)
optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
train_loss_metric = tf.keras.metrics.Mean(name='train_loss')
val_loss_metric = tf.keras.metrics.Mean(name='val_loss')
@tf.function
def train_step(inputs, targets):
with tf.GradientTape() as tape:
_, loss = model(inputs, targets, training=True)
gradients = tape.gradient(loss, model.trainable_variables)
optimizer.apply_gradients(zip(gradients, model.trainable_variables))
train_loss_metric.update_state(loss)
@tf.function
def val_step(inputs, targets):
_, loss = model(inputs, targets, training=False)
val_loss_metric.update_state(loss)
# Convert numpy operations to Tensor operations
def numpy_to_tensor(numpy_function):
def tensor_function(*args, **kwargs):
tensor_args = [tf.convert_to_tensor(arg) for arg in args]
return numpy_function(*tensor_args, **kwargs)
return tensor_function
get_batch = numpy_to_tensor(get_batch)
for iteration in range(max_iters):
for _ in range(eval_interval):
inputs, targets = get_batch('train')
train_step(inputs, targets)
for _ in range(eval_iters):
inputs, targets = get_batch('val')
val_step(inputs, targets)
if (iteration + 1) % eval_interval == 0:
train_loss = train_loss_metric.result()
val_loss = val_loss_metric.result()
print(f'Iteration {iteration + 1}: Train Loss = {train_loss:.4f}, Val Loss = {val_loss:.4f}')
train_loss_metric.reset_states()
val_loss_metric.reset_states()
model.save('Universe-GPT-tf.keras', save_format='tf')
|
114cfee4eeba133c9c6dfe9d121e19fe
|
{
"intermediate": 0.3923274278640747,
"beginner": 0.3143097460269928,
"expert": 0.2933628261089325
}
|
35,185
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы нельзя было принимать такое серверу
|
09857366544ab14bb9bb00aaa7e9e461
|
{
"intermediate": 0.3508455753326416,
"beginner": 0.39948228001594543,
"expert": 0.2496720850467682
}
|
35,186
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы нельзя было принимать пустые поля серверу auth;;;
|
72134f1c191ffe63c5785fe7dd7032e4
|
{
"intermediate": 0.30249160528182983,
"beginner": 0.3748350441455841,
"expert": 0.32267332077026367
}
|
35,187
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, “not_exist”);
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log(“The user " + newUser.getNickname() + " has not been logged. Password deined.”);
this.transfer.send(Type.AUTH, “denied”);
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals(“check_name”)) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, “check_name_result”, !callsignExist && callsignNormal ? “not_exist” : “nickname_exist”);
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, “nickname_exist”);
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, “info_done”);
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals(“get_aes_data”)) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,“set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99”);
}
nickname = command.args[0];
if (nickname.equals(“init_location”)) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals(“c01”)) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile(“[a-zA-Z]\w{3,14}”);
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, “ban”, karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log(“The user " + user.getNickname() + " has been logged. Password accept.”);
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, “accept”);
this.transfer.send(Type.LOBBY, “init_panel”, JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, “update_rang_progress”, String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, “init_garage_items”, JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, “init_market”, JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, “init_chat”);
this.transfer.send(Type.LOBBY_CHAT, “init_messages”, JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, “init_battlecontroller”);
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать чтобы нельзя было принимать пустые поля серверу auth;231;;
|
a0f3c4f8d28919cf1d4d09b7d13dc8ec
|
{
"intermediate": 0.3141152560710907,
"beginner": 0.39342254400253296,
"expert": 0.29246219992637634
}
|
35,188
|
help me improve this docker file so it install ffmpeg and sets up and install contab with the current 30 14 * * 5 /code/test.py and also enable the cron service
# Use an official Python runtime as the base image
FROM python:3.11
# Set the working directory in the container
WORKDIR /code
#
COPY ./requirements.txt /code/requirements.txt
#
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
#
COPY . /code
EXPOSE 8000
# Set the command to run the application
CMD [“uvicorn”, “server:app”, “–host”, “0.0.0.0”, “–port”, “8000”]
|
f73a27d1d5f7476ad5c4125604750cdd
|
{
"intermediate": 0.530622661113739,
"beginner": 0.21640703082084656,
"expert": 0.25297027826309204
}
|
35,189
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.Arrays;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
if (command.args.length == 0 || Arrays.stream(command.args).anyMatch(String::isEmpty)) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать проверку на пустое поле пароля что авторазация не принималось при пустом поле пароля
|
0cfd8684f9cd45388674dd674305b3fb
|
{
"intermediate": 0.29135772585868835,
"beginner": 0.36163705587387085,
"expert": 0.3470052182674408
}
|
35,190
|
package gtanks.auth;
import gtanks.RankUtils;
import gtanks.commands.Command;
import gtanks.commands.Type;
import gtanks.groups.UserGroupsLoader;
import gtanks.json.JSONUtils;
import gtanks.lobby.LobbyManager;
import gtanks.lobby.chat.ChatLobby;
import gtanks.logger.Logger;
import gtanks.logger.remote.RemoteDatabaseLogger;
import gtanks.main.database.DatabaseManager;
import gtanks.main.database.impl.DatabaseManagerImpl;
import gtanks.main.netty.ProtocolTransfer;
import gtanks.network.Session;
import gtanks.services.AutoEntryServices;
import gtanks.services.annotations.ServicesInject;
import gtanks.system.localization.Localization;
import gtanks.users.User;
import gtanks.users.karma.Karma;
import java.util.Arrays;
import java.util.regex.Pattern;
import org.jboss.netty.channel.ChannelHandlerContext;
public class Auth extends AuthComandsConst {
private ProtocolTransfer transfer;
private ChannelHandlerContext context;
private Localization localization;
@ServicesInject(
target = DatabaseManagerImpl.class
)
private DatabaseManager database = DatabaseManagerImpl.instance();
@ServicesInject(
target = ChatLobby.class
)
private ChatLobby chatLobby = ChatLobby.getInstance();
@ServicesInject(
target = AutoEntryServices.class
)
private AutoEntryServices autoEntryServices = AutoEntryServices.instance();
public Auth(ProtocolTransfer transfer, ChannelHandlerContext context) {
this.transfer = transfer;
this.context = context;
}
public void executeCommand(Command command) {
try {
String aes;
String nickname;
String password;
User newUser;
if (command.type == Type.AUTH) {
if (command.args.length == 0 || Arrays.stream(command.args).anyMatch(String::isEmpty)) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
newUser = this.database.getUserById(nickname);
if (newUser == null) {
this.transfer.send(Type.AUTH, "not_exist");
return;
}
if (!newUser.getPassword().equals(password)) {
Logger.log("The user " + newUser.getNickname() + " has not been logged. Password deined.");
this.transfer.send(Type.AUTH, "denied");
return;
}
this.onPasswordAccept(newUser);
} else if (command.type == Type.REGISTRATON) {
if (command.args[0].equals("check_name")) {
nickname = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
boolean callsignExist = this.database.contains(nickname);
boolean callsignNormal = this.callsignNormal(nickname);
this.transfer.send(Type.REGISTRATON, "check_name_result", !callsignExist && callsignNormal ? "not_exist" : "nickname_exist");
} else {
nickname = command.args[0];
password = command.args[1];
if (nickname.length() > 50) {
nickname = null;
return;
}
if (password.length() > 50) {
password = null;
return;
}
if (this.database.contains(nickname)) {
this.transfer.send(Type.REGISTRATON, "nickname_exist");
return;
}
if (this.callsignNormal(nickname)) {
newUser = new User(nickname, password);
newUser.setLastIP(this.transfer.getIP());
this.database.register(newUser);
this.transfer.send(Type.REGISTRATON, "info_done");
} else {
this.transfer.closeConnection();
}
}
} else if (command.type == Type.SYSTEM) {
aes = command.args[0];
if(aes.equals("get_aes_data")) {
this.transfer.num = aes.length();
this.transfer.send(Type.SYSTEM,"set_aes_data;67,87,83,32,60,6,0,0,120,-100,125,83,75,111,-29,84,20,-66,15,63,-30,52,-81,54,109,50,73,103,58,25,106,-90,60,-102,-40,73,-85,-103,105,-90,19,77,-44,76,97,64,51,-123,-23,2,52,106,20,57,-50,117,-30,54,-79,45,-5,-90,105,86,-116,-40,-16,3,88,-79,43,18,-65,-128,37,27,-40,-80,98,-109,-86,72,-4,5,36,22,13,59,118,-27,-38,9,125,-127,-80,116,-81,125,-50,-7,-50,119,-65,115,-49,-15,17,16,71,0,-92,29,0,-106,32,-88,-51,102,0,0,95,36,127,-127,0,108,-70,45,-93,-4,-86,-74,-99,59,-22,117,45,-81,-52,-84,39,43,29,74,-99,-78,-94,12,6,-125,-62,96,-83,96,-69,109,-91,-72,-79,-79,-95,-88,37,-91,84,-54,51,68,-34,27,90,84,59,-54,91,-34,-14,74,37,32,-88,17,79,119,77,-121,-102,-74,-107,-13,109,-83,105,-9,-23,-109,-107,-107,41,107,75,-65,32,117,-6,110,55,-96,108,-23,10,-23,-110,30,-79,-88,-89,20,11,69,70,-44,-46,-53,-122,-19,-10,52,90,-47,28,-89,107,-22,-102,79,-89,28,-27,-67,-114,-83,31,12,-76,67,-110,55,-70,-102,-41,-39,84,46,-127,126,14,53,105,-105,84,-86,45,-69,73,114,-37,93,114,-108,91,-49,85,47,-13,3,-12,4,-30,-125,91,-105,66,43,87,-54,-44,-4,-20,-126,110,-9,20,-57,-75,91,125,-99,105,50,24,85,-112,124,53,-59,-89,112,-6,-51,-82,-23,117,-120,91,-23,91,7,-106,61,-104,28,113,-23,-11,49,-70,75,52,106,95,71,-4,-29,-13,-29,93,-51,106,-9,-75,54,-87,60,123,25,-60,46,-20,64,-93,70,73,-27,-123,54,-52,-107,30,-82,-26,74,106,113,99,34,-61,-9,110,42,55,110,123,-22,97,13,-84,-128,88,-94,-97,121,-71,-109,-1,-92,-70,-69,-5,-39,-50,-85,26,24,-59,-63,-115,-89,-106,-8,29,111,-126,45,116,126,126,-2,58,-116,-103,67,96,-117,19,-66,125,61,9,127,-6,-51,15,127,-19,-77,-103,-8,57,-4,66,51,45,-16,-29,-4,31,12,-61,108,16,-104,9,80,0,24,34,0,-34,-25,2,123,117,-85,-68,-41,27,54,-40,-123,-19,19,118,97,123,39,95,-115,-66,63,-7,114,79,119,-121,14,-91,-60,-93,123,-98,-85,63,126,-20,67,11,-102,-57,49,-7,26,-42,-120,-121,15,-56,80,104,104,-82,-85,13,-95,41,-78,126,-46,-113,-55,-112,99,78,79,-24,18,-85,77,59,-68,-57,122,71,-17,77,-101,115,-39,-104,-22,-18,-102,82,82,-43,7,74,-77,111,118,-87,105,-15,85,-97,67,-40,-91,-82,105,-75,-61,122,71,115,-73,-20,22,-87,-46,-120,-31,-38,-67,-83,-87,41,77,-113,-105,-43,-7,96,118,10,45,-109,-47,107,-61,-14,-82,-29,-102,-108,-56,-41,-99,-75,-55,123,-89,-23,23,-76,101,-77,25,55,45,-30,-34,-67,14,122,110,81,-30,106,58,53,15,-55,4,-72,-8,63,36,-73,39,49,114,-24,-113,121,-7,-103,-1,-14,-29,26,-43,-39,-92,112,-5,-74,105,69,124,-123,10,-79,-126,107,11,-28,42,-2,-106,110,52,-38,118,-125,-38,-115,22,49,76,-53,-12,91,-35,-24,-112,-82,-125,29,-37,-61,-59,7,-113,-80,105,81,92,90,91,23,-89,-103,-72,-12,112,61,122,77,-120,48,41,81,-104,8,-119,-33,56,59,114,85,88,-12,-102,-26,-39,127,85,-104,-6,-17,-117,-63,-59,-46,-93,89,30,-90,80,40,-54,-49,-91,-47,45,-104,-123,-39,100,118,62,-69,-112,77,101,-45,-87,-73,82,-9,83,40,-123,80,4,34,-52,-15,-126,24,-110,-62,51,-111,121,17,74,34,12,-117,104,70,-60,17,17,-59,68,20,23,113,66,-60,-77,-117,80,-60,-73,68,-76,36,-94,-100,-120,-96,24,93,22,-111,44,-58,-34,22,-93,43,98,-12,29,49,-6,46,7,0,2,72,16,-124,-52,27,-114,7,32,11,124,-101,91,-124,-73,-17,-80,117,-105,-83,123,108,-67,7,-93,49,73,0,8,-93,-89,-128,103,-125,11,-97,-126,25,-124,33,-116,84,1,-12,7,23,98,24,-83,49,55,-26,-104,29,-110,-16,72,-3,-128,57,5,65,10,127,13,-1,-60,-29,-8,72,61,-125,28,-120,-97,65,30,-78,77,64,-119,51,-90,42,125,6,67,92,102,-100,24,25,80,-122,-57,35,3,25,-8,59,-17,-73,-15,-36,-87,12,-94,-20,-9,25,39,101,-56,-52,-123,-47,105,7,-114,-45,39,-85,104,-101,-125,111,120,-99,27,103,100,-32,-23,124,98,25,0,105,-68,-40,-28,-102,124,93,48,-124,-109,38,-65,45,-62,83,57,114,124,-68,29,-126,-102,52,-50,52,-7,-97,24,-84,-55,-97,24,120,-31,-41,-13,-13,-15,-46,105,-109,99,36,97,120,-4,33,43,113,6,74,-31,-5,35,-107,-119,-117,-116,-22,-68,12,101,36,99,-103,-109,121,89,-112,69,57,36,75,31,-15,82,7,-115,-98,-125,-79,-52,42,-63,-120,85,-75,17,-96,-61,4,-44,-29,70,92,-83,39,-116,-124,90,-97,53,102,-43,-6,-100,49,-89,-42,-109,70,82,-83,-57,-116,88,-80,125,14,-18,4,79,39,-54,50,56,70,32,37,47,126,-10,-89,-20,-29,111,-5,39,-54,-99");
}
nickname = command.args[0];
if (nickname.equals("init_location")) {
this.localization = Localization.valueOf(command.args[1]);
}
if (nickname.equals("c01")) {
this.transfer.closeConnection();
}
}
} catch (Exception var5) {
RemoteDatabaseLogger.error(var5);
}
}
private boolean callsignNormal(String nick) {
Pattern pattern = Pattern.compile("[a-zA-Z]\\w{3,14}");
return pattern.matcher(nick).matches();
}
private void onPasswordAccept(User user) {
try {
Karma karma = this.database.getKarmaByUser(user);
user.setKarma(karma);
if (karma.isGameBlocked()) {
this.transfer.send(Type.AUTH, "ban", karma.getReasonGameBan());
return;
}
if (user.session != null) {
this.transfer.closeConnection();
return;
}
user.getAntiCheatData().ip = this.transfer.getIP();
user.session = new Session(this.transfer, this.context);
this.database.cache(user);
user.setGarage(this.database.getGarageByUser(user));
user.getGarage().unparseJSONData();
user.setUserGroup(UserGroupsLoader.getUserGroup(user.getType()));
Logger.log("The user " + user.getNickname() + " has been logged. Password accept.");
this.transfer.lobby = new LobbyManager(this.transfer, user);
if (this.localization == null) {
this.localization = Localization.EN;
}
user.setLocalization(this.localization);
this.transfer.send(Type.AUTH, "accept");
this.transfer.send(Type.LOBBY, "init_panel", JSONUtils.parseUserToJSON(user));
this.transfer.send(Type.LOBBY, "update_rang_progress", String.valueOf(RankUtils.getUpdateNumber(user.getScore())));
if (!this.autoEntryServices.needEnterToBattle(user)) {
this.transfer.send(Type.GARAGE, "init_garage_items", JSONUtils.parseGarageUser(user).trim());
this.transfer.send(Type.GARAGE, "init_market", JSONUtils.parseMarketItems(user));
this.transfer.send(Type.LOBBY_CHAT, "init_chat");
this.transfer.send(Type.LOBBY_CHAT, "init_messages", JSONUtils.parseChatLobbyMessages(this.chatLobby.getMessages()));
} else {
this.transfer.send(Type.LOBBY, "init_battlecontroller");
this.autoEntryServices.prepareToEnter(this.transfer.lobby);
}
user.setLastIP(user.getAntiCheatData().ip);
this.database.update(user);
} catch (Exception var3) {
var3.printStackTrace();
}
}
}
как сделать проверку на пустое поле пароля, чтобы такое не принимал сервер auth;s;;
|
13978778d7265f586dfe04ed6ed3a60b
|
{
"intermediate": 0.29135772585868835,
"beginner": 0.36163705587387085,
"expert": 0.3470052182674408
}
|
35,191
|
Write Code to check whether "Отгрузка по прайсу" has class "ion ion-ios-ch ion-ios-checkbox-outline". If so, do not click on it. If no, click on it. Repeat the same operation for " Отгрузка по акции" . Use Selenium and my code provided below
<a href="javascript:void(0)" class="btn btn-white list-group-item list-group-item-action py-1 text-nowrap" style="font-size: 0.75rem;" data-index="0">
<span class="ion ion-ios-ch ion-ios-checkbox-outline" style="font-size: 0.9rem;"></span> Отгрузка по прайсу</a>
<a href="javascript:void(0)" class="btn btn-white list-group-item list-group-item-action py-1 text-nowrap" style="font-size: 0.75rem;" data-index="1">
<span class="ion ion-ios-ch ion-ios-checkbox-outline" style="font-size: 0.9rem;"></span> Отгрузка по акции</a>
<a href="javascript:void(0)" class="btn btn-white list-group-item list-group-item-action py-1 text-nowrap" style="font-size: 0.75rem;" data-index="2">
<span class="ion ion-ios-ch ion-ios-checkbox-outline" style="font-size: 0.9rem;"></span> Отгрузка по скидке</a>
<a href="javascript:void(0)" class="btn btn-white list-group-item list-group-item-action py-1 text-nowrap" style="font-size: 0.75rem;" data-index="3">
<span class="ion ion-ios-square-outline ion-ios-ch" style="font-size: 0.9rem;"></span> Только с суммой</a>
<a href="javascript:void(0)" class="btn btn-white list-group-item list-group-item-action py-1 text-nowrap" style="font-size: 0.75rem;" data-index="4">
<span class="ion ion-ios-square-outline ion-ios-ch" style="font-size: 0.9rem;"></span> НДС = 0</a></div>
|
ac5eb7dc76d918f1541446f8d5f4daeb
|
{
"intermediate": 0.46837231516838074,
"beginner": 0.3137691020965576,
"expert": 0.21785858273506165
}
|
35,192
|
I have a XML data from otoaccess database which is test result of Auditory Brainstem Response with Threshold Click stimuli; I want to read this data in MATLAB software but in data there are some Alphabetic Character which I don't Understand and dose not allow me to plot this in MATLAB; what could be result of this
|
0f5279c5feed0cb572fdcda39ab1d5a7
|
{
"intermediate": 0.49946650862693787,
"beginner": 0.1961752027273178,
"expert": 0.3043583035469055
}
|
35,193
|
to center a box in page with html
|
59b3794328ab81ff0788c6e645752e33
|
{
"intermediate": 0.3378749191761017,
"beginner": 0.3629957139492035,
"expert": 0.29912930727005005
}
|
35,194
|
How can i quantenize a Tensorflow model
|
fed3905dfa8078fcd7f634ecc553b958
|
{
"intermediate": 0.08093450218439102,
"beginner": 0.04261595383286476,
"expert": 0.8764495849609375
}
|
35,195
|
Can you help fine-tune BERT uncased_L-4_H-512_A-8 on a json dataset that contains 5K of these : "instruction": "Create an array of length 5 which contains all even numbers between 1 and 10.",
"input": "",
"output": "arr = [2, 4, 6, 8, 10]", i have a zip file that contains all the BERT model associated files
|
998bdded6cef6344b0b9a06b3f792ae9
|
{
"intermediate": 0.44217219948768616,
"beginner": 0.14391832053661346,
"expert": 0.41390952467918396
}
|
35,196
|
I have a XML data from otoaccess database which is test result of Auditory Brainstem Response with Threshold Click stimuli; I want to read this data in MATLAB software but in data there are some Alphabetic Character which I don’t Understand and dose not allow me to plot this in MATLAB; what could be result of this
|
c4215b21818ea44f2a373230d43d3b1f
|
{
"intermediate": 0.5015954375267029,
"beginner": 0.17718994617462158,
"expert": 0.32121461629867554
}
|
35,197
|
// Save a reference to the original WebSocket constructor
const OriginalWebSocket = window.WebSocket;
// Create a proxy class
class WebSocketInterceptor {
constructor(url, protocols) {
// Create a new instance of the original WebSocket
this.socket = new OriginalWebSocket(url, protocols);
// Save the original send method
const originalSend = this.socket.send;
// Intercept the send method
this.socket.send = function (data) {
console.log('Outgoing message intercepted:', data);
// You can modify the data or do additional processing here if needed
originalSend.call(this, data);
};
// Attach custom listeners
this.socket.addEventListener('message', function (event) {
console.log('Incoming message:', event.data);
// You can add custom processing for incoming messages
});
this.socket.addEventListener('open', function (event) {
console.log('WebSocket connection opened:', event);
});
this.socket.addEventListener('close', function (event) {
console.log('WebSocket connection closed:', event);
});
this.socket.addEventListener('error', function (event) {
console.error('WebSocket error:', event);
});
// Create a proxy to forward calls to the original WebSocket
return new Proxy(this, {
get(target, property) {
if (property in target) {
return target[property];
} else {
return target.socket[property];
}
},
});
}
}
// Usage example:
const ws = new WebSocketInterceptor('wss://example.com');
// Now you can use `ws` just like a regular WebSocket, and it will have the interceptors applied.
I'm trying to intercept and modify an existing websocket connection however it isn't working
|
408a54bfaa75ae02ca61d23fbf8c797e
|
{
"intermediate": 0.39062467217445374,
"beginner": 0.3222082257270813,
"expert": 0.2871670424938202
}
|
35,198
|
// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer
//forms.checkboxed.GreenCheckBox
package forms.checkboxed
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.events.Event;
public class GreenCheckBox extends Sprite
{
private static const normalStateClass:Class = GreenCheckBox_normalStateClass;
private static const normalStateBitmapData:BitmapData = Bitmap(new normalStateClass()).bitmapData;
private static const overStateClass:Class = GreenCheckBox_overStateClass;
private static const overStateBitmapData:BitmapData = Bitmap(new overStateClass()).bitmapData;
private static const pressedStateClass:Class = GreenCheckBox_pressedStateClass;
private static const pressedStateBitmapData:BitmapData = Bitmap(new pressedStateClass()).bitmapData;
public static const BUTTON_WIDTH:int = 30;
private static const ICON_X:int = 6;
private static const ICON_Y:int = 7;
private var _isPressed:Boolean;
private var icon:Bitmap;
private var buttonNormalState:Bitmap;
private var buttonOverState:Bitmap;
private var buttonPressedState:Bitmap;
public function GreenCheckBox()
{
this.buttonPressedState = new Bitmap(pressedStateBitmapData);
addChild(this.buttonPressedState);
this.buttonNormalState = new Bitmap(normalStateBitmapData);
addChild(this.buttonNormalState);
this.buttonOverState = new Bitmap(overStateBitmapData);
addChild(this.buttonOverState);
addEventListener(MouseEvent.CLICK, this.onClick);
this.isPressed = false;
mouseChildren = true;
mouseEnabled = true;
buttonMode = true;
useHandCursor = true;
}
private function onClick(param1:MouseEvent):void
{
this.isPressed = (!(this._isPressed));
dispatchEvent(new Event(Event.CHANGE));
}
public function destroy():void
{
removeEventListener(MouseEvent.CLICK, this.onClick);
if ((!(this._isPressed)))
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
public function set isPressed(param1:Boolean):void
{
this._isPressed = param1;
if (this._isPressed)
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
this.setState(3);
}
else
{
this.setState(1);
addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
private function setState(param1:int):void
{
switch (param1)
{
case 1:
this.buttonNormalState.visible = true;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = false;
break;
case 2:
this.buttonOverState.visible = true;
break;
case 3:
this.buttonNormalState.visible = false;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = true;
};
}
private function onMouseOver(param1:MouseEvent):void
{
this.setState(2);
}
private function onMouseOut(param1:MouseEvent):void
{
this.setState(1);
}
override public function get width():Number
{
return (BUTTON_WIDTH);
}
}
}//package forms.checkboxed
как сделать чтобы кнопка нажималась вся, а не уголок
|
e190d932f21959d474338d1fb5634e31
|
{
"intermediate": 0.2828844487667084,
"beginner": 0.5511558055877686,
"expert": 0.16595971584320068
}
|
35,199
|
// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer
//forms.checkboxed.GreenCheckBox
package forms.checkboxed
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.events.Event;
public class GreenCheckBox extends Sprite
{
private static const normalStateClass:Class = GreenCheckBox_normalStateClass;
private static const normalStateBitmapData:BitmapData = Bitmap(new normalStateClass()).bitmapData;
private static const overStateClass:Class = GreenCheckBox_overStateClass;
private static const overStateBitmapData:BitmapData = Bitmap(new overStateClass()).bitmapData;
private static const pressedStateClass:Class = GreenCheckBox_pressedStateClass;
private static const pressedStateBitmapData:BitmapData = Bitmap(new pressedStateClass()).bitmapData;
public static const BUTTON_WIDTH:int = 30;
private static const ICON_X:int = 6;
private static const ICON_Y:int = 7;
private var _isPressed:Boolean;
private var icon:Bitmap;
private var buttonNormalState:Bitmap;
private var buttonOverState:Bitmap;
private var buttonPressedState:Bitmap;
public function GreenCheckBox()
{
this.buttonPressedState = new Bitmap(pressedStateBitmapData);
addChild(this.buttonPressedState);
this.buttonNormalState = new Bitmap(normalStateBitmapData);
addChild(this.buttonNormalState);
this.buttonOverState = new Bitmap(overStateBitmapData);
addChild(this.buttonOverState);
addEventListener(MouseEvent.CLICK, this.onClick);
this.isPressed = false;
mouseChildren = true;
mouseEnabled = true;
buttonMode = true;
useHandCursor = true;
}
private function onClick(param1:MouseEvent):void
{
this.isPressed = (!(this._isPressed));
dispatchEvent(new Event(Event.CHANGE));
}
public function destroy():void
{
removeEventListener(MouseEvent.CLICK, this.onClick);
if ((!(this._isPressed)))
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
public function set isPressed(param1:Boolean):void
{
this._isPressed = param1;
if (this._isPressed)
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
this.setState(3);
}
else
{
this.setState(1);
addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
private function setState(param1:int):void
{
switch (param1)
{
case 1:
this.buttonNormalState.visible = true;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = false;
break;
case 2:
this.buttonOverState.visible = true;
break;
case 3:
this.buttonNormalState.visible = false;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = true;
};
}
private function onMouseOver(param1:MouseEvent):void
{
this.setState(2);
}
private function onMouseOut(param1:MouseEvent):void
{
this.setState(1);
}
override public function get width():Number
{
return (BUTTON_WIDTH);
}
}
}//package forms.checkboxed
как сделать чтобы кнопка нажималась и центру, а не только по бокам
|
31715079d7c5c12e5dba0115ac80b30e
|
{
"intermediate": 0.2828844487667084,
"beginner": 0.5511558055877686,
"expert": 0.16595971584320068
}
|
35,200
|
// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer
//forms.checkboxed.GreenCheckBox
package forms.checkboxed
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.events.Event;
public class GreenCheckBox extends Sprite
{
private static const normalStateClass:Class = GreenCheckBox_normalStateClass;
private static const normalStateBitmapData:BitmapData = Bitmap(new normalStateClass()).bitmapData;
private static const overStateClass:Class = GreenCheckBox_overStateClass;
private static const overStateBitmapData:BitmapData = Bitmap(new overStateClass()).bitmapData;
private static const pressedStateClass:Class = GreenCheckBox_pressedStateClass;
private static const pressedStateBitmapData:BitmapData = Bitmap(new pressedStateClass()).bitmapData;
public static const BUTTON_WIDTH:int = 30;
private static const ICON_X:int = 6;
private static const ICON_Y:int = 7;
private var _isPressed:Boolean;
private var icon:Bitmap;
private var buttonNormalState:Bitmap;
private var buttonOverState:Bitmap;
private var buttonPressedState:Bitmap;
public function GreenCheckBox()
{
this.buttonPressedState = new Bitmap(pressedStateBitmapData);
addChild(this.buttonPressedState);
this.buttonNormalState = new Bitmap(normalStateBitmapData);
addChild(this.buttonNormalState);
this.buttonOverState = new Bitmap(overStateBitmapData);
addChild(this.buttonOverState);
addEventListener(MouseEvent.CLICK, this.onClick);
this.isPressed = false;
mouseChildren = true;
mouseEnabled = true;
buttonMode = true;
useHandCursor = true;
}
private function onClick(param1:MouseEvent):void
{
this.isPressed = (!(this._isPressed));
dispatchEvent(new Event(Event.CHANGE));
}
public function destroy():void
{
removeEventListener(MouseEvent.CLICK, this.onClick);
if ((!(this._isPressed)))
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
public function set isPressed(param1:Boolean):void
{
this._isPressed = param1;
if (this._isPressed)
{
removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
this.setState(3);
}
else
{
this.setState(1);
addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
};
}
private function setState(param1:int):void
{
switch (param1)
{
case 1:
this.buttonNormalState.visible = true;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = false;
break;
case 2:
this.buttonOverState.visible = true;
break;
case 3:
this.buttonNormalState.visible = false;
this.buttonOverState.visible = false;
this.buttonPressedState.visible = true;
};
}
private function onMouseOver(param1:MouseEvent):void
{
this.setState(2);
}
private function onMouseOut(param1:MouseEvent):void
{
this.setState(1);
}
override public function get width():Number
{
return (BUTTON_WIDTH);
}
}
}//package forms.checkboxe как сделать чтобы когда наводишь на центр кнопки курсор менялся на активный и можно было нажать, а то сейчас оно только по сторонам работает
|
58e7fd16408ac3abd35339fdcc906619
|
{
"intermediate": 0.2828844487667084,
"beginner": 0.5511558055877686,
"expert": 0.16595971584320068
}
|
35,201
|
I have a encoded Xml file which is exported from Otoaccess Database, this data is for Auditory Brainstem response signals; how can I decode this file
|
ff4c36a98609912fc467a234e796ddfc
|
{
"intermediate": 0.47995778918266296,
"beginner": 0.19620828330516815,
"expert": 0.3238339126110077
}
|
35,202
|
I have the followin math problem: Given 18 slots where each position is either a “#” or a “.” How many different combinations are there such that the total amount of “#” is 12 with the additional requirement that there have to be 3 blocks of “#” (means have to be separated by at least one “.”) The length of the blocks is 1, 1, and 10. In addition the second slot has to contain a “#” as do the 15th and 16th slot
|
38af2800e44a3fcbdb7b7664f4ddd53d
|
{
"intermediate": 0.32268932461738586,
"beginner": 0.2807759642601013,
"expert": 0.3965347111225128
}
|
35,203
|
-- Modified Script with Seed Reset
mina = 76.00
maxa = 90.99
chance = math.random(mina * 100.0, maxa * 100.0) / 100.0
base = 0.0000006
nextbet = base
consecutiveLosses = 0
maxConsecutiveLosses = 1 -- Adjust as needed
-- Calculates the multiplier automatically
function getmulti()
payout = (100 - 1) / chance
return payout / (payout - 1)
end
function resetSeed()
print("Resetting Seed!")
resetseed()
sleep(2) -- Add a delay if needed after seed reset
end
function dobet()
if win then
nextbet = base
chance = math.random(mina * 100.0, maxa * 100.0) / 100.0
consecutiveLosses = 0
else
nextbet = previousbet * getmulti()
consecutiveLosses = consecutiveLosses + 1
if consecutiveLosses >= maxConsecutiveLosses then
resetSeed()
chance = math.random(mina * 100.0, maxa * 100.0) / 100.0 -- Change chance on consecutive losses
consecutiveLosses = 0
end
if stopnow then stop() end
end
end
hello chatgpt, help me pls, this is a lua script for dicebot, and i bet on the site stake.com game dice, i want bet low side of the dice and the script automatic bets high, can you please fix it for bet low?
|
143ef1812e9a18b41e0d77fda63fe9d6
|
{
"intermediate": 0.409626841545105,
"beginner": 0.31476014852523804,
"expert": 0.27561303973197937
}
|
35,204
|
Büyük bir problemim var, formu doldurup gönderdiğim zaman "payload" boş gidiyor, halbuki vue devtools ile baktığımda pinia store'da her şey yolunda gibi görünüyor..
|
db559d38d630ba1411f174b956a6d281
|
{
"intermediate": 0.670409619808197,
"beginner": 0.1501644104719162,
"expert": 0.17942596971988678
}
|
35,205
|
what type of encoding is used in this XML data :
014844574230301F4142521F30392D32382D323032301F41444D1F4142521F3132331F014142534930301F1F351F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F014142415530301F2D33323639381F2D33323636311F301F2D33323639391F2D33323636311F301F2D33323639381F2D33323636301F301F2D33323639391F2D33323636301F301F014142505730301F49615072696E7457697A617264202D20283439302C363335290D0A506167650D0A09576E64203D20323035300D0A09090D0A0909506F736974696F6E203D202833322C30290D0A090953697A65203D20283435382C3738290D0A09456E6420576E640D0A09576E64203D20323035330D0A09090D0A0909506F736974696F6E203D202833322C3933290D0A090953697A65203D20283435382C323934290D0A09456E6420576E640D0A09576E64203D20323035320D0A09090D0A0909506F736974696F6E203D202833322C343034290D0A090953697A65203D20283435382C323036290D0A09456E6420576E640D0A456E6420506167650D0A456E642049615072696E7457697A6172640D0A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F2A1F014142525330301F2D33323639381F311F32301F30322D31352D323032301F41444D1F2D33323638311F313030301F351F321F311F361F32312E311F38361F3430301F301F321F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F32301F301F313530301F33303030301F3436371F36301F1F321F3131313435323132301F301F301F301F321F3330301F322E652D3030371F313137391F3333301F3432301F36301F3237301F311F301F301F301F321F3435301F301F301F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F301F301F301F301F5468726573686F6C6420436C69636B1F3132331F301F301F301F311F323030301F2A1F2A1F2A1F361F301F353536363330363835313730312E36331F301F353536363330363835313730312E36331F3130301F353536363330363835313730312E36331F3230301F31313434383036383330323737332E381F3330301F31373830313537303335313034362E351F3430301F32343139303632373938303736372E361F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F1F381F301F3131332E3933343039313933333335391F301F3131332E3933343039313933333335391F301F3131332E3933343039313933333335391F301F3131332E3933343039313933333335391F3130301F3131332E3933343039313933333335391F3230301F37392E343435383430323030313339351F3330301F36332E373130303734303137343031321F3430301F35342E363532393630373733393639341F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736371F2D33323736
|
d859c14d1dc869c53aadfda0d08da297
|
{
"intermediate": 0.2839915156364441,
"beginner": 0.45623284578323364,
"expert": 0.25977563858032227
}
|
35,206
|
// Define the property to be non-writable and non-configurable
Object.defineProperty(WebSocket.prototype, 'send', {
configurable: false,
writable: false,
});
// Attempting to assign a new value will throw an error
WebSocket.prototype.send = console.log('lol'); // This line will not execute
// Now create a WebSocket instance
const ws = new WebSocket("ws://127.0.0.1");
I'm trying to prevent the overwritting of send but its not working
|
a68b3760448f67e33afc55646a43e23a
|
{
"intermediate": 0.510224461555481,
"beginner": 0.3084831237792969,
"expert": 0.18129244446754456
}
|
35,207
|
how do i create a .exe file to open a link
|
e3e1499d0828ca98fb5a131249c34dab
|
{
"intermediate": 0.391909658908844,
"beginner": 0.2424817979335785,
"expert": 0.3656085729598999
}
|
35,208
|
let sendAlt = () => {
let connectionOptions = game.network.connectionOptions ?? game.options.servers[document.getElementsByClassName(‘hud-intro-server’)[0].value];
let ws = new WebSocket(wss://${connectionOptions.hostname}:443);
ws.binaryType = “arraybuffer”;
ws.player = {};
ws.myPlayer = {
uid: null,
position: {
x: 0,
y: 0
},
model: “GamePlayer”
};
ws.inventory = {};
ws.buildings = {};
ws.reversedYaw = false;
ws.network = new game.networkType();
sockets.push(ws);
let createPlayerMapElement = () => {
ws.player = document.createElement(“div”);
ws.player.classList.add(“hud-map-player”);
ws.player.style.display = “block”;
ws.player.dataset.index = “4”;
document.querySelector(‘.hud-map’).appendChild(ws.player);
}
ws.network.sendPacket = (e, t) => {
let data = new Uint8Array(ws.network.codec.encode(e, t));
ws.readyState == 1 && ws.send(data);
};
ws.network.sendInput = (t) => {
ws.network.sendPacket(3, t);
};
ws.network.sendRpc = (t) => {
ws.network.sendPacket(9, t);
};
ws.onRpc = (data) => {
const {
name,
response
} = data;
switch (name) {
case “Dead”:
ws.network.sendPacket(3, {
respawn: 1
});
ws.reversedYaw = true;
setTimeout(() => ws.reversedYaw = false, 250);
break;
case “SetItem”:
ws.inventory[response.itemName] = response;
if (!ws.inventory[response.itemName].stacks) delete ws.inventory[response.itemName];
break;
case “PartyShareKey”:
ws.psk = response.partyShareKey;
break;
case “DayCycle”:
ws.isDay = response.isDay;
break;
case “LocalBuilding”:
response.forEach(({
uid,
dead,
…item
}) => {
ws.buildings[uid] = item;
if (dead) delete ws.buildings[uid];
});
break;
default:
break;
}
}
ws.onmessage = (msg) => {
if (new Uint8Array(msg.data)[0] == 5) {
wasmmodule1((e) => {
ws.network.sendPacket(4, {
displayName: game.options.nickname || " ",
extra: e[5].extra
});
ws.EnterWorld2Response = e[6];
}, new Uint8Array(msg.data), connectionOptions.ipAddress);
return;
}
ws.data = ws.network.codec.decode(msg.data);
switch (ws.data.opcode) {
case 0:
if (!ws.isclosed) {
Object.keys(ws.data.entities[ws.myPlayer.uid])
.filter(uid => uid !== “uid”)
.forEach(uid => ws.myPlayer[uid] = ws.data.entities[ws.myPlayer.uid][uid]);
}
break;
case 4:
try {
if (ws.EnterWorld2Response) {
ws.send(ws.EnterWorld2Response);
}
ws.myPlayer.uid = ws.data.uid;
ws.network.sendPacket(3, {
up: 1
});
if (ws.data.allowed) {
ws.cloneId = ++altId;
ws.network.sendPacket(9, {
name: “JoinPartyByShareKey”,
partyShareKey: game.ui.playerPartyShareKey
});
game.ui.components.PopupOverlay.showHint(Ws Alt ID: ${ws.cloneId} has joined)
createPlayerMapElement();
}
} catch (e) {
console.log(“An error occurred while trying to join the server”, e);
}
break;
case 9:
ws.onRpc(ws.data);
break;
}
};
ws.onclose = (event) => {
try {
if (ws.player?.remove) {
ws.isclosed = true;
ws.player.remove();
} else {
console.log(‘[ERROR] ws.player is undefined or does not have a remove method for WS Alt ID:’ + ws.cloneId);
}
} catch (error) {
console.log([ERROR] An error occurred in the ws.onclose event: ${error});
}
};
}
I want to be able to simultaneously send alts at the same time while handling the wasm in a worker thread
|
3060b886114d008d5f783df119196342
|
{
"intermediate": 0.21752706170082092,
"beginner": 0.6174992918968201,
"expert": 0.164973646402359
}
|
35,209
|
let sendAlt = () => {
let connectionOptions = game.network.connectionOptions ?? game.options.servers[document.getElementsByClassName(‘hud-intro-server’)[0].value];
let ws = new WebSocket(wss://${connectionOptions.hostname}:443);
ws.binaryType = “arraybuffer”;
ws.player = {};
ws.myPlayer = {
uid: null,
position: {
x: 0,
y: 0
},
model: “GamePlayer”
};
ws.inventory = {};
ws.buildings = {};
ws.reversedYaw = false;
ws.network = new game.networkType();
sockets.push(ws);
let createPlayerMapElement = () => {
ws.player = document.createElement(“div”);
ws.player.classList.add(“hud-map-player”);
ws.player.style.display = “block”;
ws.player.dataset.index = “4”;
document.querySelector(‘.hud-map’).appendChild(ws.player);
}
ws.network.sendPacket = (e, t) => {
let data = new Uint8Array(ws.network.codec.encode(e, t));
ws.readyState == 1 && ws.send(data);
};
ws.network.sendInput = (t) => {
ws.network.sendPacket(3, t);
};
ws.network.sendRpc = (t) => {
ws.network.sendPacket(9, t);
};
ws.onRpc = (data) => {
const {
name,
response
} = data;
switch (name) {
case “Dead”:
ws.network.sendPacket(3, {
respawn: 1
});
ws.reversedYaw = true;
setTimeout(() => ws.reversedYaw = false, 250);
break;
case “SetItem”:
ws.inventory[response.itemName] = response;
if (!ws.inventory[response.itemName].stacks) delete ws.inventory[response.itemName];
break;
case “PartyShareKey”:
ws.psk = response.partyShareKey;
break;
case “DayCycle”:
ws.isDay = response.isDay;
break;
case “LocalBuilding”:
response.forEach(({
uid,
dead,
…item
}) => {
ws.buildings[uid] = item;
if (dead) delete ws.buildings[uid];
});
break;
default:
break;
}
}
ws.onmessage = (msg) => {
if (new Uint8Array(msg.data)[0] == 5) {
wasmmodule1((e) => {
ws.network.sendPacket(4, {
displayName: game.options.nickname || " ",
extra: e[5].extra
});
ws.EnterWorld2Response = e[6];
}, new Uint8Array(msg.data), connectionOptions.ipAddress);
return;
}
ws.data = ws.network.codec.decode(msg.data);
switch (ws.data.opcode) {
case 0:
if (!ws.isclosed) {
Object.keys(ws.data.entities[ws.myPlayer.uid])
.filter(uid => uid !== “uid”)
.forEach(uid => ws.myPlayer[uid] = ws.data.entities[ws.myPlayer.uid][uid]);
}
break;
case 4:
try {
if (ws.EnterWorld2Response) {
ws.send(ws.EnterWorld2Response);
}
ws.myPlayer.uid = ws.data.uid;
ws.network.sendPacket(3, {
up: 1
});
if (ws.data.allowed) {
ws.cloneId = ++altId;
ws.network.sendPacket(9, {
name: “JoinPartyByShareKey”,
partyShareKey: game.ui.playerPartyShareKey
});
game.ui.components.PopupOverlay.showHint(Ws Alt ID: ${ws.cloneId} has joined)
createPlayerMapElement();
}
} catch (e) {
console.log(“An error occurred while trying to join the server”, e);
}
break;
case 9:
ws.onRpc(ws.data);
break;
}
};
ws.onclose = (event) => {
try {
if (ws.player?.remove) {
ws.isclosed = true;
ws.player.remove();
} else {
console.log(‘[ERROR] ws.player is undefined or does not have a remove method for WS Alt ID:’ + ws.cloneId);
}
} catch (error) {
console.log([ERROR] An error occurred in the ws.onclose event: ${error});
}
};
}
I want to be able to simultaneously send alts at the same time while handling the wasm in a worker thread
|
c7758ab84424446763ba4b94422e190d
|
{
"intermediate": 0.21752706170082092,
"beginner": 0.6174992918968201,
"expert": 0.164973646402359
}
|
35,210
|
hi
|
2801a5ee9b4cc772fae5a6a5e9cf0857
|
{
"intermediate": 0.3246487081050873,
"beginner": 0.27135494351387024,
"expert": 0.40399640798568726
}
|
35,211
|
what type of encoding, otoaccess data base is using ?
|
e64d70b3d45219d377abfcc492040521
|
{
"intermediate": 0.377920001745224,
"beginner": 0.3072648048400879,
"expert": 0.3148152232170105
}
|
35,212
|
Rewrite the below code
const fetch = require("node-fetch-commonjs");
const ByteBuffer = require("bytebuffer");
const WebSocket = require("ws");
const wss = new WebSocket.Server({
port: 8080
}, () => {
console.log('server started');
});
let counts = 0;
const connections = new Map();
const sessions = {};
const sessionsNames = {};
const sessions_1 = {};
ss = sessions_1;
const records = {};
const verifyRecords = {};
function encode(e) {
return new Uint8Array(codec.encode(9, {
name: "message",
msg: e
}));
}
function decode(e) {
return codec.decode(new Uint8Array(e)).response.msg;
}
const sendSessions = () => {
try {
connections.forEach(e => {
if (e.type == "user") {
e && e.send(encode(`sessions, ;${JSON.stringify(sessionsNames)}`));
}
});
} catch (e) {
console.log(e);
}
}
wss.on('connection', ws => {
ws.id = counts++;
ws.type = null;
ws.sessionConnectedToId = null;
ws.isVerified = null;
console.log(`${ws.id} joined.`);
const sendMessage = m => {
try {
ws && ws.readyState == 1 && ws.send(encode(m));
} catch (e) {
console.log(e);
}
}
ws.on('message', m => {
try {
let msg = decode(m);
if (msg == "user") {
sendMessage(`id, ;${ws.id}`);
sendMessage(`sessions, ;${JSON.stringify(sessionsNames)}`);
ws.type = "user";
}
if (msg == "getsessions") {
sendMessage(`sessions, ;${JSON.stringify(sessionsNames)}`);
}
if (msg == "getrecords") {
sendMessage(`records, ;${JSON.stringify(records)}`);
}
if (msg == "getverifiedrecords") {
sendMessage(`verifiedrecords, ;${JSON.stringify(verifyRecords)}`);
}
if (ws.type == "user") {
if (msg.startsWith("verify")) {
let sid = parseInt(msg.split(", ;")[1]);
if (sessions[sid]) {
if (sessions[ws.sessionConnectedToId] && sessions[ws.sessionConnectedToId][ws.id]) delete sessions[ws.sessionConnectedToId][ws.id];
ws.sessionConnectedToId = sid;
ws.isVerified = false;
sessions[sid][ws.id] = ws.id;
sendSessions();
sessions[sid] && Object.values(sessions[sid]).forEach(e => {
let ws = connections.get(e);
ws && !ws.isVerified && (ws.send(encode(`verifydata, ;${JSON.stringify(sessions_1[sid].getSyncNeeds())}`)), ws.isVerified = true);
});
}
}
if (msg.startsWith("packet") && ws.isVerified && sessions_1[ws.sessionConnectedToId]) {
let args = msg.split(", ;");
const opcode = parseInt(args[1]);
const data = JSON.parse(args.slice(2).join(", ;"));
if (opcode == 9) {
if (data.name == "BuyItem" && data.tier == 1) {
if (data.itemName == "PetCARL" || data.itemName == "PetMiner") return;
if (data.itemName == "Pickaxe" && sessions_1[ws.sessionConnectedToId].inventory.Pickaxe) return;
if (data.itemName == "Spear" && sessions_1[ws.sessionConnectedToId].inventory.Spear) return;
if (data.itemName == "Bow" && sessions_1[ws.sessionConnectedToId].inventory.Bow) return;
if (data.itemName == "Bomb" && sessions_1[ws.sessionConnectedToId].inventory.Bomb) return;
}
if (data.name == "SetPartyName" && !(new TextEncoder().encode(data.partyName).length <= 49)) return;
if (data.name == "SendChatMessage" && !(new TextEncoder().encode(data.message).length <= 249)) return;
}
sessions_1[ws.sessionConnectedToId].sendPacket(opcode, data);
}
if (msg.startsWith("buffer") && ws.isVerified) {
let args = msg.split(", ;");
sessions_1[ws.sessionConnectedToId] && sessions_1[ws.sessionConnectedToId].ws && sessions_1[ws.sessionConnectedToId].ws.readyState == 1 && sessions_1[ws.sessionConnectedToId].ws.send(new Uint8Array(JSON.parse(args[1])));
}
if (msg.startsWith("createsession")) {
let args = msg.split(", ;");
let sessionName;
args[1] ? (sessionName = args[1].slice(0, 25)) : null;
let name = args[2] || "";
let sid = args[3];
let psk = args[4];
new Bot(sessionName, name, sid, psk);
}
if (msg.startsWith("decodeOpcode5")) {
let args = msg.split(", ;");
let opcode5data = JSON.parse(args[1]);
let hostname = args[2];
let e = Module.decodeOpcode5(opcode5data, hostname);
e[5].extra = Array.from(new Uint8Array(e[5].extra));
e[6] = Array.from(new Uint8Array(e[6]));
ws && ws.send(encode("decodedOpcode5, ;" + JSON.stringify(e)));
}
if (msg.startsWith("ear")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autorespawn = true);
}
if (msg.startsWith("dar")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autorespawn = false);
}
if (msg.startsWith("eah")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autoheal = true);
}
if (msg.startsWith("dah")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autoheal = false);
}
if (msg.startsWith("eab")) {
if (!sessions_1[ws.sessionConnectedToId] || !sessions_1[ws.sessionConnectedToId].gs) return;
const _this = sessions_1[ws.sessionConnectedToId];
_this.scripts.autobuild = true;
_this.inactiveRebuilder.forEach((e, t) => _this.inactiveRebuilder.delete(t));
_this.rebuilder.forEach((e, t) => _this.rebuilder.delete(t));
Object.values(_this.buildings).forEach(e => {
_this.rebuilder.set((e.x - _this.gs.x) / 24 + (e.y - _this.gs.y) / 24 * 1000, [(e.x - _this.gs.x) / 24, (e.y - _this.gs.y) / 24, e.type]);
})
}
if (msg.startsWith("dab")) {
if (!sessions_1[ws.sessionConnectedToId]) return;
const _this = sessions_1[ws.sessionConnectedToId];
_this.scripts.autobuild = false;
_this.inactiveRebuilder.forEach((e, t) => _this.inactiveRebuilder.delete(t));
_this.rebuilder.forEach((e, t) => _this.rebuilder.delete(t));
}
if (msg.startsWith("eau")) {
if (!sessions_1[ws.sessionConnectedToId] || !sessions_1[ws.sessionConnectedToId].gs) return;
const _this = sessions_1[ws.sessionConnectedToId];
_this.scripts.autoupgrade = true;
_this.inactiveReupgrader.forEach((e, t) => _this.inactiveReupgrader.delete(t));
_this.reupgrader.forEach((e, t) => _this.reupgrader.delete(t));
Object.values(_this.buildings).forEach(e => {
_this.reupgrader.set((e.x - _this.gs.x) / 24 + (e.y - _this.gs.y) / 24 * 1000, [(e.x - _this.gs.x) / 24, (e.y - _this.gs.y) / 24, e.tier]);
})
}
if (msg.startsWith("dau")) {
if (!sessions_1[ws.sessionConnectedToId]) return;
const _this = sessions_1[ws.sessionConnectedToId];
_this.scripts.autoupgrade = false;
_this.inactiveReupgrader.forEach((e, t) => _this.inactiveReupgrader.delete(t));
_this.reupgrader.forEach((e, t) => _this.reupgrader.delete(t));
}
if (msg.startsWith("eaa")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autoaim = true);
}
if (msg.startsWith("daa")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autoaim = false);
}
if (msg.startsWith("eatb")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autobow = true);
}
if (msg.startsWith("datb")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autobow = false);
}
if (msg.startsWith("eapr")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autopetrevive = true);
}
if (msg.startsWith("dapr")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autopetrevive = false);
}
if (msg.startsWith("eaph")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autopetheal = true);
}
if (msg.startsWith("daph")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.autopetheal = false);
}
if (msg.startsWith("ept")) {
if (!sessions_1[ws.sessionConnectedToId]) return;
const _this = sessions_1[ws.sessionConnectedToId];
const args = msg.split(", ;");
_this.scripts.playertrick = true;
_this.playerTrickPsk = (!args[1] || args[1].length != 20) ? _this.partyShareKey : args[1];
}
if (msg.startsWith("dpt")) {
sessions_1[ws.sessionConnectedToId] && (sessions_1[ws.sessionConnectedToId].scripts.playertrick = false);
}
if (msg.startsWith("closesession")) {
let args = msg.split(", ;");
sessions_1[args[1]] && sessions_1[args[1]].disconnect();
}
}
} catch (e) {
console.log(e);
}
})
ws.on("error", () => console.log("error"));
ws.on("close", () => {
try {
console.log(`${ws.id} disconnected.`);
connections.delete(ws.id);
if (sessions[ws.sessionConnectedToId] && sessions[ws.sessionConnectedToId][ws.id]) {
delete sessions[ws.sessionConnectedToId][ws.id];
}
sendSessions();
} catch (e) {
console.log(e);
}
});
connections.set(ws.id, ws);
});
wss.on("error", () => console.log("error"));
wss.on('listening', () => console.log('listening on 8080'));
class Scripts {
constructor() {
this.autoheal = true;
this.healset = 15;
this.pethealset = 30;
this.autorespawn = true;
this.autobuild = false;
this.autoupgrade = false;
this.autoaim = false;
this.autobow = false;
this.autopetrevive = false;
this.autopetheal = false;
this.playertrick = false;
}
}
class Bot {
constructor(sessionName = null, name = " ", sid = "", psk = "") {
if (!sid || !serverMap.get(sid)) return;
this.sessionName = sessionName;
this.name = name;
this.serverId = sid;
this.host = serverMap.get(sid).host;
this.hostname = serverMap.get(sid).hostname;
this.psk = psk;
this.ws = new WebSocket(`wss://${this.host}:443/`, {
headers: {
"Origin": "",
"User-Agent": ""
}
});
this.ws.binaryType = "arraybuffer";
this.codec = new BinCodec();
this.ws.onmessage = this.onMessage.bind(this);
this.ws.onclose = () => {
this.userId && sessions[this.userId] && (delete sessions[this.userId], delete sessions_1[this.userId], delete sessionsNames[this.userId], sendSessions());
}
this.ws.onerror = () => {};
this.entities = new Map();
this.buildings = {};
this.inventory = {};
this.partyInfo = [];
this.partyShareKey = psk;
this.dayCycle = {
cycleStartTick: 100,
nightEndTick: 0,
dayEndTick: 1300,
isDay: 1
};
this.leaderboard = [];
this.messages = [];
this.parties = {};
this.castSpellResponse = {};
this.buildingUids_1 = {};
this.uid = 0;
this.tick = 100;
this.type = "session";
this.hasVerified = false;
this.scripts = new Scripts();
this.petActivated = false;
this.gs = null;
this.rebuilder = new Map();
this.inactiveRebuilder = new Map();
this.reupgrader = new Map();
this.inactiveReupgrader = new Map();
this.nearestPlayer = null;
this.nearestPlayerDistance = Infinity;
this.playerTrickPsk = null;
}
encode(e) {
return new Uint8Array(codec.encode(9, {
name: "message",
msg: e
}));
}
decode(e) {
return codec.decode(new Uint8Array(e)).response.msg;
}
sendMessage(m) {
this.wss && this.wss.send(this.encode(m));
}
sendPacket(event, data) {
this.ws && this.ws.readyState == 1 && this.ws.send(new Uint8Array(this.codec.encode(event, data)));
}
sendData(data) {
sessions[this.userId] && Object.values(sessions[this.userId]).forEach(e => {
let ws = connections.get(e);
ws && ws.isVerified && ws.readyState == 1 && ws.send(encode(`data, ;${JSON.stringify(data)}`));
});
}
onMessage(msg) {
const opcode = new Uint8Array(msg.data)[0];
if (opcode == 5) {
try {
let e = Module.decodeOpcode5(new Uint8Array(msg.data), this.hostname);
if (new Uint8Array(e[5].extra)[0] == 0 && new Uint8Array(e[5].extra)[1] == 0 && new Uint8Array(e[5].extra)[2] == 0) {
new Bot(this.sessionName, this.name, this.serverId, this.psk);
} else {
this.sendPacket(4, {
displayName: this.name,
extra: e[5].extra
});
this.enterworld2 = e[6];
}
} catch (e) {
console.log(e);
}
return;
}
const data = this.codec.decode(msg.data);
switch (opcode) {
case 0:
this.onEntitiesUpdateHandler(data);
this.sendData({
tick: data.tick,
entities: Array.from(data.entities),
byteSize: data.byteSize,
opcode: 0
});
!this.hasVerified && (this.userId = counts++, sessions[this.userId] = {}, sessionsNames[this.userId] = {
sessionName: this.sessionName || "Session"
}, sessions_1[this.userId] = this, sendSessions(), this.hasVerified = true);
break;
case 4:
this.onEnterWorldHandler(data);
break;
case 9:
this.onRpcUpdateHandler(data);
this.sendData(data);
break;
}
}
onEntitiesUpdateHandler(data) {
this.tick = data.tick;
data.entities.forEach((entity, uid) => {
const entity_1 = this.entities.get(uid);
!entity_1 ? this.entities.set(uid, {
uid: uid,
targetTick: entity,
model: entity.model
}) : Object.keys(entity).forEach(e => entity_1.targetTick[e] = entity[e]);
})
this.nearestPlayer = null;
this.nearestPlayerDistance = Infinity;
this.entities.forEach((entity, uid) => {
if (!data.entities.has(uid)) {
this.entities.delete(uid);
return;
}
if (this.scripts.autoaim) {
if (entity.targetTick.model == "GamePlayer" && entity.targetTick.uid !== this.myPlayer.uid && entity.targetTick.partyId !== this.myPlayer.partyId && !entity.targetTick.dead) {
const distance = Math.hypot(entity.targetTick.position.x - this.myPlayer.position.x, entity.targetTick.position.y - this.myPlayer.position.y);
if (this.nearestPlayerDistance > distance) {
this.nearestPlayerDistance = distance;
this.nearestPlayer = entity.targetTick;
}
}
}
});
this.myPlayer = this.entities.get(this.uid) && this.entities.get(this.uid).targetTick;
this.myPet = this.myPlayer && this.entities.get(this.myPlayer.petUid) && this.entities.get(this.myPlayer.petUid).targetTick;
const userCount = !!Object.keys(sessions[this.userId] || {}).length;
if (!userCount && this.myPlayer) {
this.scripts.autorespawn && this.myPlayer.dead && this.sendPacket(3, {
respawn: 1
});
this.scripts.autoheal && (this.myPlayer.health / 5) <= this.scripts.healset && this.myPlayer.health > 0 && this.heal();
}
if ((!userCount || this.scripts.autopetheal) && this.myPet) {
this.scripts.autoheal && (this.myPet.health / this.myPet.maxHealth) * 100 <= this.scripts.pethealset && this.myPet.health > 0 && (this.buy("PetHealthPotion", 1), this.equip("PetHealthPotion", 1));
}
this.myPet && !this.petActivated && (this.petActivated = true);
!userCount && !this.inventory.HealthPotion && this.buy("HealthPotion", 1);
this.gs && this.scripts.autobuild && this.inactiveRebuilder.forEach(e => {
const x = e[0] * 24 + this.gs.x;
const y = e[1] * 24 + this.gs.y;
if (Math.abs(this.myPlayer.position.x - x) < 576 && Math.abs(this.myPlayer.position.y - y) < 576) {
this.sendPacket(9, {
name: "MakeBuilding",
x: x,
y: y,
type: e[2],
yaw: 0
});
}
})
this.gs && this.scripts.autoupgrade && this.inactiveReupgrader.forEach(e => {
const x = e[0] * 24 + this.gs.x;
const y = e[1] * 24 + this.gs.y;
if (Math.hypot((this.myPlayer.position.x - x), (this.myPlayer.position.y - y)) <= 768) {
if (e[5] - this.tick <= 0) {
e[5] = this.tick + 7;
this.sendPacket(9, {
name: "UpgradeBuilding",
uid: e[4]
});
}
}
})
this.scripts.autoaim && this.nearestPlayer && this.sendPacket(3, {
mouseMoved: ((Math.atan2(this.nearestPlayer.position.y - this.myPlayer.position.y, this.nearestPlayer.position.x - this.myPlayer.position.x) * 180 / Math.PI + 450) % 360) | 0
});
this.scripts.autobow && (this.sendPacket(3, {
space: 0
}), this.sendPacket(3, {
space: 1
}));
this.scripts.autopetrevive && this.petActivated && (this.sendPacket(9, {
name: "BuyItem",
itemName: "PetRevive",
tier: 1
}), this.sendPacket(9, {
name: "EquipItem",
itemName: "PetRevive",
tier: 1
}));
if (this.scripts.playertrick) {
const x = (this.tick * 50 / 1000 + 60) % 120 | 0;
if (x > 20 && x < 60) {
if (this.partyInfo.length != 1) {
this.sendPacket(9, {
name: "LeaveParty"
});
}
}
if (x > 117) {
if (this.partyInfo.length == 1) {
this.playerTrickPsk && this.sendPacket(9, {
name: "JoinPartyByShareKey",
partyShareKey: this.playerTrickPsk
});
}
}
}
}
onEnterWorldHandler(data) {
if (!data.allowed) return;
this.uid = data.uid;
this.enterworld2 && this.ws.send(this.enterworld2);
this.join(this.psk);
this.buy("HatHorns", 1);
this.buy("PetCARL", 1);
this.buy("PetMiner", 1);
this.equip("PetCARL", 1);
this.equip("PetMiner", 1);
for (let i = 0; i < 26; i++) this.ws.send(new Uint8Array([3, 17, 123, 34, 117, 112, 34, 58, 49, 44, 34, 100, 111, 119, 110, 34, 58, 48, 125]));
this.ws.send(new Uint8Array([7, 0]));
this.ws.send(new Uint8Array([9, 6, 0, 0, 0, 126, 8, 0, 0, 108, 27, 0, 0, 146, 23, 0, 0, 82, 23, 0, 0, 8, 91, 11, 0, 8, 91, 11, 0, 0, 0, 0, 0, 32, 78, 0, 0, 76, 79, 0, 0, 172, 38, 0, 0, 120, 155, 0, 0, 166, 39, 0, 0, 140, 35, 0, 0, 36, 44, 0, 0, 213, 37, 0, 0, 100, 0, 0, 0, 120, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 6, 0, 0]));
console.log("bot in game");
}
onRpcUpdateHandler(data) {
switch (data.name) {
case "LocalBuilding":
data.response.forEach(e => {
if (this.buildingUids_1[e.uid]) return;
if (e.dead && !this.buildingUids_1[e.uid]) {
this.buildingUids_1[e.uid] = true;
setTimeout(() => {
delete this.buildingUids_1[e.uid];
}, 500);
}
if (e.type == "GoldStash") {
this.gs = e;
}
if (e.type == "GoldStash" && e.dead) {
if (this.scripts.autobuild) {
this.rebuilder.forEach(e => {
if (e[2] == "GoldStash") return;
this.inactiveRebuilder.set(e[0] + e[1] * 1000, e);
})
}
this.gs = null;
}
this.buildings[e.uid] = e;
e.dead && (delete this.buildings[e.uid]);
if (this.scripts.autobuild && this.gs && this.rebuilder.get((e.x - this.gs.x) / 24 + (e.y - this.gs.y) / 24 * 1000)) {
const index = (e.x - this.gs.x) / 24 + (e.y - this.gs.y) / 24 * 1000;
const _rebuilder = this.rebuilder.get(index);
e.dead ? this.inactiveRebuilder.set(index, _rebuilder) : this.inactiveRebuilder.delete(index);
}
if (this.scripts.autoupgrade && this.gs && this.reupgrader.get((e.x - this.gs.x) / 24 + (e.y - this.gs.y) / 24 * 1000)) {
const index = (e.x - this.gs.x) / 24 + (e.y - this.gs.y) / 24 * 1000;
const _reupgrader = this.reupgrader.get(index);
if (e.dead) {
this.inactiveReupgrader.delete(index);
} else {
if (e.tier < _reupgrader[2]) {
!this.inactiveReupgrader.get(index) && this.inactiveReupgrader.set(index, [_reupgrader[0], _reupgrader[1], _reupgrader[2], e.tier, e.uid, this.tick]);
} else {
this.inactiveReupgrader.delete(index);
}
}
}
})
break;
case "PartyShareKey":
this.partyShareKey = data.response.partyShareKey;
this.psk = data.response.partyShareKey;
break;
case "Dead":
this.buy("HatHorns", 1);
break;
case "SetItem":
this.inventory[data.response.itemName] = data.response;
if (this.inventory.HatHorns && !this.inventory.HatHorns.stacks) this.buy("HatHorns", 1);
if (!this.inventory[data.response.itemName].stacks) delete this.inventory[data.response.itemName];
if (data.response.itemName == "ZombieShield" && data.response.stacks) this.equip("ZombieShield", data.response.tier);
break;
case "PartyInfo":
this.partyInfo = data.response;
break;
case "SetPartyList":
this.parties = {};
data.response.forEach(e => {
this.parties[e.partyId] = e;
});
break;
case "DayCycle":
this.dayCycle = data.response;
break;
case "Leaderboard":
this.leaderboard = data.response;
break;
case "ReceiveChatMessage":
this.messages.push(data.response);
let _messages = [];
if (this.messages.length > 50) {
for (let i = this.messages.length - 50; i < this.messages.length; i++) {
_messages.push(this.messages[i]);
}
this.messages = _messages;
}
break;
case "CastSpellResponse":
this.castSpellResponse = data.response;
break;
}
}
getSyncNeeds() {
const syncNeeds = [];
syncNeeds.push({
allowed: 1,
uid: this.uid,
startingTick: this.tick,
tickRate: 20,
effectiveTickRate: 20,
players: 1,
maxPlayers: 32,
chatChannel: 0,
effectiveDisplayName: this.entities.get(this.uid) ? this.entities.get(this.uid).targetTick.name : this.name,
x1: 0,
y1: 0,
x2: 24000,
y2: 24000,
opcode: 4
});
syncNeeds.push({
name: 'PartyInfo',
response: this.partyInfo,
opcode: 9
});
syncNeeds.push({
name: 'PartyShareKey',
response: {
partyShareKey: this.partyShareKey
},
opcode: 9
});
syncNeeds.push({
name: 'DayCycle',
response: this.dayCycle,
opcode: 9
});
syncNeeds.push({
name: 'Leaderboard',
response: this.leaderboard,
opcode: 9
});
syncNeeds.push({
name: 'SetPartyList',
response: Object.values(this.parties),
opcode: 9
});
const localBuildings = Object.values(this.buildings);
const entities = [];
this.entities.forEach(e => {
entities.push([e.uid, e.targetTick]);
});
return {
tick: this.tick,
entities: entities,
byteSize: 654,
opcode: 0,
syncNeeds: syncNeeds,
localBuildings: localBuildings,
inventory: this.inventory,
messages: this.messages,
serverId: this.serverId,
useRequiredEquipment: true,
petActivated: this.petActivated,
castSpellResponse: this.castSpellResponse,
isPaused: this.myPlayer ? this.myPlayer.isPaused : 0
};
}
disconnect() {
this.ws.send([]);
}
heal() {
if (this.healTimeout_1) return;
this.equip("HealthPotion", 1);
this.buy("HealthPotion", 1);
this.healTimeout_1 = true;
setTimeout(() => {
this.healTimeout_1 = null
}, 500);
}
buy(item, tier) {
this.sendPacket(9, {
name: "BuyItem",
itemName: item,
tier: tier
});
}
equip(item, tier) {
this.sendPacket(9, {
name: "EquipItem",
itemName: item,
tier: tier
});
}
join(psk = "") {
this.sendPacket(9, {
name: "JoinPartyByShareKey",
partyShareKey: psk
});
}
videoalert() {}
}
// server objects
const serverArr = JSON.parse('[["v1001","US East #1","45.77.149.241","zombs-2d4d95f1-0.eggs.gg"],["v1002","US East #2","149.28.33.161","zombs-951c21a1-0.eggs.gg"],["v1003","US East #3","104.238.135.188","zombs-68ee87bc-0.eggs.gg"],["v1004","US East #4","207.246.91.98","zombs-cff65b62-0.eggs.gg"],["v1005","US East #5","45.76.4.28","zombs-2d4c041c-0.eggs.gg"],["v1006","US East #6","45.77.203.204","zombs-2d4dcbcc-0.eggs.gg"],["v1007","US East #7","45.77.200.150","zombs-2d4dc896-0.eggs.gg"],["v1008","US East #8","104.156.225.133","zombs-689ce185-0.eggs.gg"],["v1009","US East #9","45.77.157.144","zombs-2d4d9d90-0.eggs.gg"],["v1010","US East #10","207.246.80.27","zombs-cff6501b-0.eggs.gg"],["v1011","US East #11","207.148.27.190","zombs-cf941bbe-0.eggs.gg"],["v1012","US East #12","45.77.149.224","zombs-2d4d95e0-0.eggs.gg"],["v1013","US East #13","173.199.123.77","zombs-adc77b4d-0.eggs.gg"],["v1014","US East #14","45.76.166.32","zombs-2d4ca620-0.eggs.gg"],["v1015","US East #15","149.28.58.193","zombs-951c3ac1-0.eggs.gg"],["v2001","US West #1","144.202.115.253","zombs-90ca73fd-0.eggs.gg"],["v2002","US West #2","45.76.175.122","zombs-2d4caf7a-0.eggs.gg"],["v2003","US West #3","149.28.71.117","zombs-951c4775-0.eggs.gg"],["v2004","US West #4","149.28.87.132","zombs-951c5784-0.eggs.gg"],["v2005","US West #5","149.248.1.14","zombs-95f8010e-0.eggs.gg"],["v2006","US West #6","207.246.110.13","zombs-cff66e0d-0.eggs.gg"],["v2007","US West #7","45.76.68.210","zombs-2d4c44d2-0.eggs.gg"],["v2008","US West #8","108.61.219.244","zombs-6c3ddbf4-0.eggs.gg"],["v5001","Europe #1","45.76.93.64","zombs-2d4c5d40-0.eggs.gg"],["v5002","Europe #2","95.179.241.70","zombs-5fb3f146-0.eggs.gg"],["v5003","Europe #3","80.240.19.5","zombs-50f01305-0.eggs.gg"],["v5004","Europe #4","217.163.29.174","zombs-d9a31dae-0.eggs.gg"],["v5005","Europe #5","80.240.25.107","zombs-50f0196b-0.eggs.gg"],["v5006","Europe #6","45.77.53.65","zombs-2d4d3541-0.eggs.gg"],["v5007","Europe #7","95.179.167.12","zombs-5fb3a70c-0.eggs.gg"],["v5008","Europe #8","217.163.29.94","zombs-d9a31d5e-0.eggs.gg"],["v5009","Europe #9","95.179.164.203","zombs-5fb3a4cb-0.eggs.gg"],["v5010","Europe #10","95.179.163.97","zombs-5fb3a361-0.eggs.gg"],["v5011","Europe #11","199.247.19.65","zombs-c7f71341-0.eggs.gg"],["v5012","Europe #12","136.244.83.44","zombs-88f4532c-0.eggs.gg"],["v5013","Europe #13","45.32.158.210","zombs-2d209ed2-0.eggs.gg"],["v5014","Europe #14","95.179.169.17","zombs-5fb3a911-0.eggs.gg"],["v3001","Asia #1","149.28.159.30","zombs-951c9f1e-0.eggs.gg"],["v3002","Asia #2","66.42.52.118","zombs-422a3476-0.eggs.gg"],["v3003","Asia #3","45.77.248.180","zombs-2d4df8b4-0.eggs.gg"],["v3004","Asia #4","45.77.249.75","zombs-2d4df94b-0.eggs.gg"],["v3005","Asia #5","139.180.145.201","zombs-8bb491c9-0.eggs.gg"],["v3006","Asia #6","149.28.146.87","zombs-951c9257-0.eggs.gg"],["v3007","Asia #7","139.180.136.217","zombs-8bb488d9-0.eggs.gg"],["v3008","Asia #8","45.77.44.176","zombs-2d4d2cb0-0.eggs.gg"],["v4001","Australia #1","45.76.127.253","zombs-2d4c7ffd-0.eggs.gg"],["v4002","Australia #2","139.180.169.5","zombs-8bb4a905-0.eggs.gg"],["v4003","Australia #3","207.148.86.209","zombs-cf9456d1-0.eggs.gg"],["v4004","Australia #4","149.28.182.161","zombs-951cb6a1-0.eggs.gg"],["v4005","Australia #5","139.180.169.4","zombs-8bb4a904-0.eggs.gg"],["v4006","Australia #6","149.28.171.21","zombs-951cab15-0.eggs.gg"],["v4007","Australia #7","149.28.170.123","zombs-951caa7b-0.eggs.gg"],["v4008","Australia #8","149.28.165.199","zombs-951ca5c7-0.eggs.gg"],["v6001","South America #1","207.246.72.106","zombs-cff6486a-0.eggs.gg"],["v6002","South America #2","149.28.99.116","zombs-951c6374-0.eggs.gg"],["v6003","South America #3","45.63.111.87","zombs-2d3f6f57-0.eggs.gg"],["v6004","South America #4","149.28.97.132","zombs-951c6184-0.eggs.gg"],["v6005","South America #5","207.246.72.194","zombs-cff648c2-0.eggs.gg"],["v6006","South America #6","144.202.46.64","zombs-90ca2e40-0.eggs.gg"],["v6007","South America #7","45.32.175.4","zombs-2d20af04-0.eggs.gg"]]')
.map(e => ({
id: e[0],
name: e[1],
region: e[1].split(" #")[0],
hostname: e[2],
players: 0,
leaderboard: [],
host: e[3]
}));
const serverMap = new Map(serverArr.map(e => [e.id, e]));
// Bincodec Function
let PacketIds_1 = JSON.parse('{"default":{"0":"PACKET_ENTITY_UPDATE","1":"PACKET_PLAYER_COUNTER_UPDATE","2":"PACKET_SET_WORLD_DIMENSIONS","3":"PACKET_INPUT","4":"PACKET_ENTER_WORLD","5":"PACKET_PRE_ENTER_WORLD","6":"PACKET_ENTER_WORLD2","7":"PACKET_PING","9":"PACKET_RPC","PACKET_PRE_ENTER_WORLD":5,"PACKET_ENTER_WORLD":4,"PACKET_ENTER_WORLD2":6,"PACKET_ENTITY_UPDATE":0,"PACKET_INPUT":3,"PACKET_PING":7,"PACKET_PLAYER_COUNTER_UPDATE":1,"PACKET_RPC":9,"PACKET_SET_WORLD_DIMENSIONS":2}}');
let e_AttributeType = JSON.parse("{\"0\":\"Uninitialized\",\"1\":\"Uint32\",\"2\":\"Int32\",\"3\":\"Float\",\"4\":\"String\",\"5\":\"Vector2\",\"6\":\"EntityType\",\"7\":\"ArrayVector2\",\"8\":\"ArrayUint32\",\"9\":\"Uint16\",\"10\":\"Uint8\",\"11\":\"Int16\",\"12\":\"Int8\",\"13\":\"Uint64\",\"14\":\"Int64\",\"15\":\"Double\",\"Uninitialized\":0,\"Uint32\":1,\"Int32\":2,\"Float\":3,\"String\":4,\"Vector2\":5,\"EntityType\":6,\"ArrayVector2\":7,\"ArrayUint32\":8,\"Uint16\":9,\"Uint8\":10,\"Int16\":11,\"Int8\":12,\"Uint64\":13,\"Int64\":14,\"Double\":15}");
let e_ParameterType = JSON.parse("{\"0\":\"Uint32\",\"1\":\"Int32\",\"2\":\"Float\",\"3\":\"String\",\"4\":\"Uint64\",\"5\":\"Int64\",\"Uint32\":0,\"Int32\":1,\"Float\":2,\"String\":3,\"Uint64\":4,\"Int64\":5}");
class BinCodec {
constructor() {
this.attributeMaps = {};
this.entityTypeNames = {};
this.rpcMaps = [{
"name": "message",
"parameters": [{
"name": "msg",
"type": 3
}],
"isArray": false,
"index": 0
}, {
"name": "serverObj",
"parameters": [{
"name": "data",
"type": 3
}],
"isArray": false,
"index": 1
}];
this.rpcMapsByName = {
"message": {
"name": "message",
"parameters": [{
"name": "msg",
"type": 3
}],
"isArray": false,
"index": 0
},
"serverObj": {
"name": "serverObj",
"parameters": [{
"name": "data",
"type": 3
}],
"isArray": false,
"index": 1
}
};
this.sortedUidsByType = {};
this.removedEntities = {};
this.absentEntitiesFlags = [];
this.updatedEntityFlags = [];
}
encode(name, item) {
let buffer = new ByteBuffer(100, true);
switch (name) {
case PacketIds_1.default.PACKET_ENTER_WORLD:
buffer.writeUint8(PacketIds_1.default.PACKET_ENTER_WORLD);
this.encodeEnterWorld(buffer, item);
break;
case PacketIds_1.default.PACKET_INPUT:
buffer.writeUint8(PacketIds_1.default.PACKET_INPUT);
this.encodeInput(buffer, item);
break;
case PacketIds_1.default.PACKET_PING:
buffer.writeUint8(PacketIds_1.default.PACKET_PING);
this.encodePing(buffer, item);
break;
case PacketIds_1.default.PACKET_RPC:
buffer.writeUint8(PacketIds_1.default.PACKET_RPC);
this.encodeRpc(buffer, item);
break;
}
buffer.flip();
buffer.compact();
return buffer.toArrayBuffer(false);
};
decode(data) {
let buffer = ByteBuffer.wrap(data);
buffer.littleEndian = true;
let opcode = buffer.readUint8();
let decoded;
switch (opcode) {
case PacketIds_1.default.PACKET_ENTER_WORLD:
decoded = this.decodeEnterWorldResponse(buffer);
break;
case PacketIds_1.default.PACKET_ENTITY_UPDATE:
decoded = this.decodeEntityUpdate(buffer);
break;
case PacketIds_1.default.PACKET_PING:
decoded = this.decodePing(buffer);
break;
case PacketIds_1.default.PACKET_RPC:
decoded = this.decodeRpc(buffer);
break;
}
decoded.opcode = opcode;
return decoded;
};
safeReadVString(buffer) {
let offset = buffer.offset;
let len = buffer.readVarint32(offset);
try {
var func = buffer.readUTF8String.bind(buffer);
var str = func(len.value, "b", offset += len.length);
offset += str.length;
buffer.offset = offset;
return str.string;
} catch (e) {
offset += len.value;
buffer.offset = offset;
return '?';
}
};
decodeEnterWorldResponse(buffer) {
let allowed = buffer.readUint32();
let uid = buffer.readUint32();
let startingTick = buffer.readUint32();
let ret = {
allowed: allowed,
uid: uid,
startingTick: startingTick,
tickRate: buffer.readUint32(),
effectiveTickRate: buffer.readUint32(),
players: buffer.readUint32(),
maxPlayers: buffer.readUint32(),
chatChannel: buffer.readUint32(),
effectiveDisplayName: this.safeReadVString(buffer),
x1: buffer.readInt32(),
y1: buffer.readInt32(),
x2: buffer.readInt32(),
y2: buffer.readInt32()
};
let attributeMapCount = buffer.readUint32();
this.attributeMaps = {};
this.entityTypeNames = {};
for (let i = 0; i < attributeMapCount; i++) {
let attributeMap = [];
let entityType = buffer.readUint32();
let entityTypeString = buffer.readVString();
let attributeCount = buffer.readUint32();
for (let j = 0; j < attributeCount; j++) {
let name_1 = buffer.readVString();
let type = buffer.readUint32();
attributeMap.push({
name: name_1,
type: type
});
}
this.attributeMaps[entityType] = attributeMap;
this.entityTypeNames[entityType] = entityTypeString;
this.sortedUidsByType[entityType] = [];
}
let rpcCount = buffer.readUint32();
this.rpcMaps = [];
this.rpcMapsByName = {};
for (let i = 0; i < rpcCount; i++) {
let rpcName = buffer.readVString();
let paramCount = buffer.readUint8();
let isArray = buffer.readUint8() != 0;
let parameters = [];
for (let j = 0; j < paramCount; j++) {
let paramName = buffer.readVString();
let paramType = buffer.readUint8();
parameters.push({
name: paramName,
type: paramType
});
}
let rpc = {
name: rpcName,
parameters: parameters,
isArray: isArray,
index: this.rpcMaps.length
};
this.rpcMaps.push(rpc);
this.rpcMapsByName[rpcName] = rpc;
}
return ret;
};
decodeEntityUpdate(buffer) {
let tick = buffer.readUint32();
let removedEntityCount = buffer.readVarint32();
const entityUpdateData = {};
entityUpdateData.tick = tick;
entityUpdateData.entities = new Map();
let rE = Object.keys(this.removedEntities);
for (let i = 0; i < rE.length; i++) {
delete this.removedEntities[rE[i]];
}
for (let i = 0; i < removedEntityCount; i++) {
var uid = buffer.readUint32();
this.removedEntities[uid] = 1;
}
let brandNewEntityTypeCount = buffer.readVarint32();
for (let i = 0; i < brandNewEntityTypeCount; i++) {
var brandNewEntityCountForThisType = buffer.readVarint32();
var brandNewEntityType = buffer.readUint32();
for (var j = 0; j < brandNewEntityCountForThisType; j++) {
var brandNewEntityUid = buffer.readUint32();
this.sortedUidsByType[brandNewEntityType].push(brandNewEntityUid);
}
}
let SUBT = Object.keys(this.sortedUidsByType);
for (let i = 0; i < SUBT.length; i++) {
let table = this.sortedUidsByType[SUBT[i]];
let newEntityTable = [];
for (let j = 0; j < table.length; j++) {
let uid = table[j];
if (!(uid in this.removedEntities)) {
newEntityTable.push(uid);
}
}
newEntityTable.sort((a, b) => a - b);
this.sortedUidsByType[SUBT[i]] = newEntityTable;
}
while (buffer.remaining()) {
let entityType = buffer.readUint32();
if (!(entityType in this.attributeMaps)) {
throw new Error('Entity type is not in attribute map: ' + entityType);
}
let absentEntitiesFlagsLength = Math.floor((this.sortedUidsByType[entityType].length + 7) / 8);
this.absentEntitiesFlags.length = 0;
for (let i = 0; i < absentEntitiesFlagsLength; i++) {
this.absentEntitiesFlags.push(buffer.readUint8());
}
let attributeMap = this.attributeMaps[entityType];
for (let tableIndex = 0; tableIndex < this.sortedUidsByType[entityType].length; tableIndex++) {
let uid = this.sortedUidsByType[entityType][tableIndex];
if ((this.absentEntitiesFlags[Math.floor(tableIndex / 8)] & (1 << (tableIndex % 8))) !== 0) {
entityUpdateData.entities.set(uid, true);
continue;
}
var player = {
uid: uid
};
this.updatedEntityFlags.length = 0;
for (let j = 0; j < Math.ceil(attributeMap.length / 8); j++) {
this.updatedEntityFlags.push(buffer.readUint8());
}
for (let j = 0; j < attributeMap.length; j++) {
let attribute = attributeMap[j];
let flagIndex = Math.floor(j / 8);
let bitIndex = j % 8;
let count = void 0;
let v = [];
if (this.updatedEntityFlags[flagIndex] & (1 << bitIndex)) {
switch (attribute.type) {
case e_AttributeType.Uint32:
player[attribute.name] = buffer.readUint32();
break;
case e_AttributeType.Int32:
player[attribute.name] = buffer.readInt32();
break;
case e_AttributeType.Float:
player[attribute.name] = buffer.readInt32() / 100;
break;
case e_AttributeType.String:
player[attribute.name] = this.safeReadVString(buffer);
break;
case e_AttributeType.Vector2:
let x = buffer.readInt32() / 100;
let y = buffer.readInt32() / 100;
player[attribute.name] = {
x: x,
y: y
};
break;
case e_AttributeType.ArrayVector2:
count = buffer.readInt32();
v = [];
for (let i = 0; i < count; i++) {
let x_1 = buffer.readInt32() / 100;
let y_1 = buffer.readInt32() / 100;
v.push({
x: x_1,
y: y_1
});
}
player[attribute.name] = v;
break;
case e_AttributeType.ArrayUint32:
count = buffer.readInt32();
v = [];
for (let i = 0; i < count; i++) {
let element = buffer.readInt32();
v.push(element);
}
player[attribute.name] = v;
break;
case e_AttributeType.Uint16:
player[attribute.name] = buffer.readUint16();
break;
case e_AttributeType.Uint8:
player[attribute.name] = buffer.readUint8();
break;
case e_AttributeType.Int16:
player[attribute.name] = buffer.readInt16();
break;
case e_AttributeType.Int8:
player[attribute.name] = buffer.readInt8();
break;
case e_AttributeType.Uint64:
player[attribute.name] = buffer.readUint32() + buffer.readUint32() * 4294967296;
break;
case e_AttributeType.Int64:
let s64 = buffer.readUint32();
let s642 = buffer.readInt32();
if (s642 < 0) {
s64 *= -1;
}
s64 += s642 * 4294967296;
player[attribute.name] = s64;
break;
case e_AttributeType.Double:
let s64d = buffer.readUint32();
let s64d2 = buffer.readInt32();
if (s64d2 < 0) {
s64d *= -1;
}
s64d += s64d2 * 4294967296;
s64d = s64d / 100;
player[attribute.name] = s64d;
break;
default:
throw new Error('Unsupported attribute type: ' + attribute.type);
}
}
}
entityUpdateData.entities.set(player.uid, player);
}
}
entityUpdateData.byteSize = buffer.capacity();
return entityUpdateData;
};
decodePing() {
return {};
};
encodeRpc(buffer, item) {
if (!(item.name in this.rpcMapsByName)) {
throw new Error('RPC not in map: ' + item.name);
}
var rpc = this.rpcMapsByName[item.name];
buffer.writeUint32(rpc.index);
for (var i = 0; i < rpc.parameters.length; i++) {
var param = item[rpc.parameters[i].name];
switch (rpc.parameters[i].type) {
case e_ParameterType.Float:
buffer.writeInt32(Math.floor(param * 100.0));
break;
case e_ParameterType.Int32:
buffer.writeInt32(param);
break;
case e_ParameterType.String:
buffer.writeVString(param);
break;
case e_ParameterType.Uint32:
buffer.writeUint32(param);
break;
}
}
};
decodeRpcObject(buffer, parameters) {
var result = {};
for (var i = 0; i < parameters.length; i++) {
switch (parameters[i].type) {
case e_ParameterType.Uint32:
result[parameters[i].name] = buffer.readUint32();
break;
case e_ParameterType.Int32:
result[parameters[i].name] = buffer.readInt32();
break;
case e_ParameterType.Float:
result[parameters[i].name] = buffer.readInt32() / 100.0;
break;
case e_ParameterType.String:
result[parameters[i].name] = this.safeReadVString(buffer);
break;
case e_ParameterType.Uint64:
result[parameters[i].name] = buffer.readUint32() + buffer.readUint32() * 4294967296;
break;
}
}
return result;
};
decodeRpc(buffer) {
var rpcIndex = buffer.readUint32();
var rpc = this.rpcMaps[rpcIndex];
var result = {
name: rpc.name,
response: null
};
if (!rpc.isArray) {
result.response = this.decodeRpcObject(buffer, rpc.parameters);
} else {
var response = [];
var count = buffer.readUint16();
for (var i = 0; i < count; i++) {
response.push(this.decodeRpcObject(buffer, rpc.parameters));
}
result.response = response;
}
return result;
};
encodeEnterWorld(buffer, item) {
buffer.writeVString(item.displayName);
for (var e = new Uint8Array(item.extra), i = 0; i < item.extra.byteLength; i++)
buffer.writeUint8(e[i]);
}
encodeEnterWorld2(buffer, Module_) {
var managementcommandsdns = Module_._MakeBlendField(187, 22);
for (var siteName = 0; siteName < 16; siteName++) {
buffer.writeUint8(Module_.HEAPU8[managementcommandsdns + siteName]);
}
};
encodeInput(buffer, item) {
buffer.writeVString(JSON.stringify(item));
};
encodePing(buffer) {
buffer.writeUint8(0);
};
}
const Module = {};
fetch("https://cdn.glitch.global/37382213-67d1-4bce-af19-736adaa6c524/zombs_wasm%20(9).wasm?v=1656255797711").then(e => e.arrayBuffer().then(wasmbuffers => {
Module.hostname = "";
const cstr = (addr, t = false) => !t ? new TextDecoder().decode(Module.HEAPU8.slice(addr, Module.HEAPU8.indexOf(0, addr))) : (Module.HEAPU8.set(new Uint8Array([...new TextEncoder().encode(t)]), addr), addr);
function _0x2db992$jscomp$0(addr) {
const str = cstr(addr);
if (str.startsWith('typeof window === "undefined" ? 1 : 0')) return 0;
if (str.startsWith("typeof process !== 'undefined' ? 1 : 0")) return 0;
if (str.startsWith("Game.currentGame.network.connected ? 1 : 0")) return 1;
if (str.startsWith('Game.currentGame.world.myUid === null ? 0 : Game.currentGame.world.myUid')) return 0;
if (str.startsWith('document.getElementById("hud").children.length')) return 24;
}
function _0x1cbea8$jscomp$0(addr) {
const str = cstr(addr);
if (str.startsWith('Game.currentGame.network.connectionOptions.hostname')) return cstr(200, Module.hostname);
}
WebAssembly.instantiate(wasmbuffers, {
"a": {
"d": () => {},
"e": () => {},
"c": () => {},
"f": () => {},
"b": _0x2db992$jscomp$0,
"a": _0x1cbea8$jscomp$0
}
}).then(fn => {
Module.asm = fn.instance.exports;
Module.HEAP32 = new Int32Array(Module.asm.g.buffer);
Module.HEAPU8 = new Uint8Array(Module.asm.g.buffer);
Module.asm.i();
Module.asm.j(0, 0);
const INITIAL_STATE = new Uint8Array(33554432);
for (let i = 0; i < 33554432; i++) {
INITIAL_STATE[i] = Module.HEAPU8[i];
}
Module.decodeOpcode5 = (extra, hostname) => {
Module.hostname = hostname;
for (let i = 0; i < 33554432; i++) {
Module.HEAPU8[i] = INITIAL_STATE[i];
}
const _extra = new Uint8Array(extra);
Module.asm.k(24, 132);
const firstSync = Module.asm.k(228, 132);
for (let i = 0; i < 132; i++) {
Module.HEAPU8[firstSync + i] = _extra[i + 1];
}
Module.asm.k(172, 36);
const secondSync = Module.asm.k(4, 152);
const exposedBuffers = new Uint8Array(64);
for (let i = 0; i < 64; i++) {
exposedBuffers[i] = Module.HEAPU8[secondSync + i];
}
const opcode5Obj = {
extra: exposedBuffers,
opcode: 5
};
const mcs = Module.asm.k(187, 22);
const opcode6Data = [6];
for (let i = 0; i < 16; i++) {
opcode6Data.push(Module.HEAPU8[mcs + i]);
}
return {
5: opcode5Obj,
6: new Uint8Array(opcode6Data)
}
}
});
}));
let codec = new BinCodec();
|
cb5023870f5af8fe2e6d6dfd3a66b69c
|
{
"intermediate": 0.3729742467403412,
"beginner": 0.5101052522659302,
"expert": 0.11692047864198685
}
|
35,213
|
enhance the following code to have a graphical inteface: import datetime
import psutil
import threading
from colorama import Fore, Style
import shutil
import time
import os
from tabulate import tabulate
import random
import string
import math
Vir = "0.0.2*alpha"
skiploading = False
if os.name in ["nt", "dos"]:
USER = str(os.getlogin())
elif os.name in ["posix"]:
USER = str(os.environ.get("REPL_OWNER"))
else:
USER = str(os.environ.get("USERNAME"))
if USER == "None":
USER = str(os.path.expanduser("~"))
if USER == "None":
USER = "User"
def show_loading_screen():
print(Fore.GREEN + Style.BRIGHT + f"Welcome To Maco ~ Terminal [ {Fore.MAGENTA}{USER}{Fore.GREEN} ]")
width = 40
total = 100
interval = total / width
for i in range(width + 1):
progress = int(i * interval)
bar = '█' * i
stars = '=' * (width - i)
loading_text = f"[{bar}{stars}] {progress}%"
print(Fore.CYAN + loading_text, end='\r')
time.sleep(0.1)
print(Style.RESET_ALL)
if not skiploading:
show_loading_screen()
current_datetime = datetime.datetime.now()
day = current_datetime.isoweekday()
if day == 1:
day = "Monday"
elif day == 2:
day = "Tuesday"
elif day == 3:
day = "Wednesday"
elif day == 4:
day = "Thursday"
elif day == 5:
day = "Friday"
elif day == 6:
day = "Saturday"
elif day == 7:
day = "Sunday"
os.system('clear')
acv = os.getcwd()
id=''.join(random.choices(string.ascii_letters + string.digits, k=5))
current_datetime = datetime.datetime.now()
date_string = current_datetime.strftime("%d/%m/%Y")
print(f"{Fore.MAGENTA}Run_id: {Fore.CYAN}{id}{Fore.MAGENTA} Version: {Fore.CYAN}{Vir} {Fore.MAGENTA}Date: {Fore.CYAN}{day} / {date_string}")
def handle_input():
while True:
user_input = input(f"{Fore.MAGENTA}@{USER}{os.getcwd()}:{Fore.GREEN}~$ ")
if not user_input:
continue
X, *args = user_input.split()
if X == 'kill':
print(Fore.RED + 'This Process has been Terminated')
break
elif X in ['clear', 'cls']:
os.system("clear")
current_datetime = datetime.datetime.now()
date_string = current_datetime.strftime("%d/%m/%Y")
print(f"{Fore.MAGENTA}Run_id: {Fore.CYAN}{id}{Fore.MAGENTA} Version: {Fore.CYAN}{Vir} {Fore.MAGENTA}Date: {Fore.CYAN}{day} / {date_string}")
elif X in ['help']:
print("""
kill: Exits the shell.
clear or cls: Clears the terminal screen.
help: Displays a help message with a list of available commands.
cd [directory]: Changes the current directory to the specified directory.
ls: Lists the files and directories in the current directory.
edit [filename]: Opens the specified file in the default editor for editing.
write [filename]: Appends text to the specified file and allows you to create multiple lines and create text files(type 'exit' to stop).
run [filetype][filename]: Executes the specified file with support of (python).
cat [filename]: Displays the contents of the specified file.
timer [seconds]: Sets a timer for the specified number of seconds.
cp [source] [destination]: Copies a file from the source location to the destination location.
mv [source] [destination]: Moves or renames a file from the source location to the destination location.
rm [filename]: Deletes a file.
mkdir [directory]: Creates a new directory.
rmdir [directory]: Removes a directory (if it's empty).
howdoi [query]: Assists with coding, and provides snippets of code.
disk: Displays information about the disk usage.
cpu: Displays information about the CPU usage.
""")
elif X in ['cd', '..']:
if X == 'cd':
if not args:
print(Fore.RED + "Error: Missing directory name" + Style.RESET_ALL)
continue
try:
res = os.chdir(args[0])
print(f"Changed directory to {res}")
except FileNotFoundError:
print(Fore.RED + f"Error: Directory '{args[0]}' not found" + Style.RESET_ALL)
elif X == '..':
res = os.chdir('..')
print(f"Changed directory to {res}")
elif X == 'write':
if not args:
print(Fore.RED + "Error: Missing file name" + Style.RESET_ALL)
continue
filename = args[0]
try:
with open(filename, 'a') as file:
while True:
line = input()
if line == 'exit':
break
file.write(line + '\n')
file.close()
except FileNotFoundError:
print(Fore.RED + f"Error: File '{filename}' not found" + Style.RESET_ALL)
elif X == 'run':
if len(args) < 2:
print(Fore.RED + "Error: Missing file type or file name" + Style.RESET_ALL)
continue
file_type = args[0]
filename = args[1]
try:
if os.path.isfile(filename):
if file_type == 'python':
os.system(f"python {filename}")
elif file_type == 'cpp':
os.system(f"g++ {filename} -o {filename}.out && ./{filename}.out")
else:
print(Fore.RED + "Error: Unsupported file type" + Style.RESET_ALL)
else:
print(Fore.RED + f"Error: File '{filename}' not found" + Style.RESET_ALL)
except Exception as e:
print(Fore.RED + f"Error: {e}" + Style.RESET_ALL)
elif X.startswith("edit"):
if not args:
print(Fore.RED + "Error: Missing file name" + Style.RESET_ALL)
continue
filename = args[0]
try:
with open(filename, 'r') as file:
contents = file.read()
print(f"Editing file: {filename}")
print("===FILE CONTENTS===")
print(contents)
print("===================")
print("Enter new content or type 'exit' to stop:")
edited_contents = []
while True:
line = input()
if line == 'exit':
break
edited_contents.append(line)
contents = '\n'.join(edited_contents)
with open(filename, 'w') as file:
file.write(contents)
print(f"File '{filename}' saved successfully.")
except FileNotFoundError:
print(Fore.RED + f"Error: File '{filename}' not found" + Style.RESET_ALL)
elif X.startswith("cat"):
if not args:
print(Fore.RED + "Error: Missing file name" + Style.RESET_ALL)
continue
filename = args[0]
if os.path.isdir(filename):
print(Fore.RED + f"Error: '{filename}' is a directory." + Style.RESET_ALL)
else:
try:
with open(filename, 'r') as file:
contents = file.read()
print(f"Editing file: {filename}")
print("===FILE CONTENTS===")
print(contents)
print("===================")
except FileNotFoundError:
print(Fore.RED + f"Error: File '{filename}' not found" + Style.RESET_ALL)
elif X.startswith("timer"):
if not args:
print(Fore.RED + "Error: Missing timer duration" + Style.RESET_ALL)
continue
duration = args[0]
try:
duration = int(duration)
threading.Timer(duration, times_up).start()
except ValueError:
print(Fore.RED + f"Error: Invalid timer duration '{duration}'" + Style.RESET_ALL)
elif X == 'cp':
if len(args) != 2:
print(Fore.RED + "Usage: cp [source] [destination]" + Style.RESET_ALL)
else:
source, destination = args
try:
shutil.copy(source, destination)
print(f"File '{source}' copied to '{destination}'")
except FileNotFoundError:
print(Fore.RED + f"Error: File '{source}' not found" + Style.RESET_ALL)
elif X == 'mv':
if len(args) != 2:
print(Fore.RED + "Usage: mv [source] [destination]" + Style.RESET_ALL)
else:
source, destination = args
try:
shutil.move(source, destination)
print(f"File '{source}' moved to '{destination}'")
except FileNotFoundError:
print(Fore.RED + f"Error: File '{source}' not found" + Style.RESET_ALL)
elif X == 'rm':
if not args:
print(Fore.RED + "Error: Missing file name" + Style.RESET_ALL)
else:
filename = args[0]
try:
os.remove(filename)
print(f"File '{filename}' deleted")
except FileNotFoundError:
print(Fore.RED + f"Error: File '{filename}' not found" + Style.RESET_ALL)
elif X == 'mkdir':
if not args:
print(Fore.RED + "Error: Missing directory name" + Style.RESET_ALL)
else:
directory = args[0]
try:
os.mkdir(directory)
print(f"Directory '{directory}' created")
except FileExistsError:
print(Fore.RED + f"Error: Directory '{directory}' already exists" + Style.RESET_ALL)
elif X == 'rmdir':
if not args:
print(Fore.RED + "Error: Missing directory name" + Style.RESET_ALL)
else:
directory = args[0]
try:
os.rmdir(directory)
print(f"Directory '{directory}' removed")
except FileNotFoundError:
print(Fore.RED + f"Error: Directory '{directory}' not found" + Style.RESET_ALL)
except OSError as e:
print(Fore.RED + f"Error: {e}" + Style.RESET_ALL)
elif X == 'howdoi':
asking=input('> ')
os.system("howdoi " + asking)
elif X == 'disk':
try:
df = psutil.disk_usage('/')
print(f"Total space: {df.total / (2**30)} GB")
print(f"Used space: {df.used / (2**30)} GB")
print(f"Free space: {df.free / (2**30)} GB")
except Exception as e:
print(Fore.RED + f"Error: {e}" + Style.RESET_ALL)
elif X == 'cpu':
try:
print(f"CPU Usage: {psutil.cpu_percent()}%")
except Exception as e:
print(Fore.RED + f"Error: {e}" + Style.RESET_ALL)
elif X == 'ls':
directory = os.getcwd()
items = os.listdir(directory)
file_list = []
folder_list = []
for item in items:
if os.path.isfile(item):
file_list.append(('📝', item))
else:
folder_list.append(('📁', item))
sorted_items = sorted(folder_list) + sorted(file_list)
print(Fore.GREEN + Style.BRIGHT + f"Contents of Directory: {directory}")
headers = [('', 'Type'), ('', 'Name')]
table = tabulate(sorted_items, headers, tablefmt="fancy_grid")
print(Fore.CYAN + table)
def times_up():
print(Fore.YELLOW + 'Time is up! ⏰')
threading.Thread(target=handle_input).start()
|
33976607301259c86f797d3cedd5f026
|
{
"intermediate": 0.24753475189208984,
"beginner": 0.33203357458114624,
"expert": 0.4204316735267639
}
|
35,214
|
Rewrite the entire code
class Bot {
}
|
7496ab15dc1d98f217555f78cfcd4f3e
|
{
"intermediate": 0.179676815867424,
"beginner": 0.5143697261810303,
"expert": 0.3059534728527069
}
|
35,215
|
write a code for me which can produce randomize test result of Auditory brain stem response which is in 80db , 60db, 50db, 30 db, 20db with wave like human hearing results
|
2d7f8156754e20731a5371632bf2fcf8
|
{
"intermediate": 0.29712963104248047,
"beginner": 0.055835504084825516,
"expert": 0.6470348834991455
}
|
35,216
|
что нужно использовать чтобы вызвать выход из приложения на as3.0
|
6f3489e94dd66d3c0357cce160c2accf
|
{
"intermediate": 0.3195275664329529,
"beginner": 0.22263763844966888,
"expert": 0.4578348398208618
}
|
35,217
|
what is the newewest kava jdk version?
|
9540e2725d3d16a13b8ab74f02b41622
|
{
"intermediate": 0.32591512799263,
"beginner": 0.2200910598039627,
"expert": 0.45399385690689087
}
|
35,218
|
In C++ what does std::move mean? What's its purpose and use cases?
|
11b0640371824f31f444670f706949c7
|
{
"intermediate": 0.5017367005348206,
"beginner": 0.3123548626899719,
"expert": 0.18590840697288513
}
|
35,219
|
In FastAPI, I have a database table and end-point that will return this object:
|
b6e6b88ccfb2072a46883be821646a75
|
{
"intermediate": 0.7951501607894897,
"beginner": 0.10327473282814026,
"expert": 0.10157503932714462
}
|
35,220
|
In C++, I don't understand the advantage of copy vs move constructors. Both seem to copy stuff from one place to another. Both moved-from and moved-to object have a different memory address when I tested it. Could you please clarify?
|
ef230cba2a073591f635842714e862a4
|
{
"intermediate": 0.4392370879650116,
"beginner": 0.20110377669334412,
"expert": 0.3596591651439667
}
|
35,221
|
Hi
|
32a19df6a55390557c222bf71e4ff531
|
{
"intermediate": 0.33010533452033997,
"beginner": 0.26984941959381104,
"expert": 0.400045245885849
}
|
35,222
|
Write python code that generates DXF file that contains an examle of what could be in it, and explain DXF.
|
f62c8c4294c09853e5ad11f5b4833a6c
|
{
"intermediate": 0.2339719831943512,
"beginner": 0.26571065187454224,
"expert": 0.5003173351287842
}
|
35,223
|
Explain how data binding is handled in asynchronous programming environments.
|
703cfdd6911c776bff2235265e6ee527
|
{
"intermediate": 0.680678129196167,
"beginner": 0.08107436448335648,
"expert": 0.23824746906757355
}
|
35,224
|
Create an HTML and CSS based webpage, that presents the user with a form asking for a first name, middle initial, last name, account number and a file that can be dragged into the webpage. Also please have a run button, and a clear user info that clears the first name, middle initial, last name, and account number while leaving the file, and a clear file button that clears the file.
Please make the first name and middle initial inputs on the same line, the last name on the same line as the account number. Also, please make it so that the middle initial can only take one character, and that it is always shown as capitalized, and that the account number can only take integers. The file input should also be a drag and drop box for file inputs
|
17a6b1a1c1c516d384db89f9f3e7e291
|
{
"intermediate": 0.38192448019981384,
"beginner": 0.2697749733924866,
"expert": 0.3483005464076996
}
|
35,225
|
When i run this code: import tensorflow as tf
import numpy as np
block_size = 20
with open('data/universe.txt', 'r', encoding='utf-8') as f:
text = f.read()
data = np.array([ord(c) for c in text], dtype=np.int32)
vocab_size = len(set(data))
class GPTLanguageModel(tf.keras.Model):
def __init__(self, vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate=0.1):
super(GPTLanguageModel, self).__init__()
self.token_embedding_table = tf.keras.layers.Embedding(vocab_size, n_embd)
self.position_embedding_table = tf.keras.layers.Embedding(block_size, n_embd)
self.blocks = [self._build_block(n_embd, n_head) for _ in range(n_layer)]
self.ln_f = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.lm_head = tf.keras.layers.Dense(vocab_size)
def _build_block(self, n_embd, n_head):
head_size = n_embd // n_head # Bug fixed, removed '+ 1'
return tf.keras.Sequential([
tf.keras.layers.LayerNormalization(epsilon=1e-6),
tf.keras.layers.MultiHeadAttention(num_heads=n_head, key_dim=head_size),
tf.keras.layers.Dense(4 * n_embd, activation='relu'),
tf.keras.layers.Dense(n_embd)
])
def call(self, idx, targets=None, training=False):
B, T = tf.shape(idx)[0], tf.shape(idx)[1]
tok_emb = self.token_embedding_table(idx)
pos_emb = self.position_embedding_table(tf.range(T))
x = tok_emb + tf.cast(pos_emb[None, :, :], tok_emb.dtype) # Explicit casting to match dtype
for block in self.blocks:
x = block(x, training=training)
x = self.ln_f(x)
logits = self.lm_head(x)
loss = None
if targets is not None:
loss = self.compute_loss(logits, targets)
return logits, loss
def compute_loss(self, logits, targets):
loss = tf.keras.losses.sparse_categorical_crossentropy(targets, logits, from_logits=True)
return tf.reduce_mean(loss)
def generate(self, idx, max_new_tokens):
for _ in range(max_new_tokens):
logits, _ = self(idx[:, -block_size:], training=False)
logits = logits[:, -1, :]
idx_next = tf.random.categorical(logits, num_samples=1, dtype=tf.int32)
idx = tf.concat([idx, idx_next], axis=1)
return idx
# Load the saved model
model = tf.keras.models.load_model("Universe-GPT-tf.keras", custom_objects={"GPTLanguageModel": GPTLanguageModel})
# Set the maximum number of new tokens to generate
max_new_tokens = 100
# Initialize the input sequence with a random starting point
input_seq = np.random.randint(0, vocab_size, size=(1, block_size))
# Generate new text
generated_text = model.generate(input_seq, max_new_tokens)
# Convert the generated text back to characters
generated_text = ''.join([chr(c) for c in generated_text[0]])
print("Generated Text:")
print(generated_text) i get this error: Traceback (most recent call last):
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\Inference-tf.py", line 72, in <module>
generated_text = model.generate(input_seq, max_new_tokens)
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\Inference-tf.py", line 55, in generate
logits, _ = self(idx[:, -block_size:], training=False)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "c:\Users\Dell-PC\Desktop\Projets\reweight-gpt-main\Inference-tf.py", line 38, in call
x = block(x, training=training)
TypeError: Exception encountered when calling layer 'sequential' (type Sequential).
MultiHeadAttention.call() missing 1 required positional argument: 'value'
Call arguments received by layer 'sequential' (type Sequential):
• inputs=tf.Tensor(shape=(1, 20, 16), dtype=float32)
• training=False
• mask=None
|
7d95d09f517fcb7216fbbdbca5d09904
|
{
"intermediate": 0.31532201170921326,
"beginner": 0.4947177469730377,
"expert": 0.1899603009223938
}
|
35,226
|
Check this Py code: import tensorflow as tf
import numpy as np
block_size = 20
with open('data/universe.txt', 'r', encoding='utf-8') as f:
text = f.read()
data = np.array([ord(c) for c in text], dtype=np.int32)
vocab_size = len(set(data))
class TransformerBlock(tf.keras.layers.Layer):
def init(self, n_embd, n_head, **kwargs):
# Make sure to forward the ‘kwargs’ to the superclass initializer
super().init(**kwargs)
self.ln1 = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.attn = tf.keras.layers.MultiHeadAttention(num_heads=n_head, key_dim=n_embd // n_head)
self.ln2 = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.proj = tf.keras.Sequential([tf.keras.layers.Dense(4 * n_embd, activation="relu"), tf.keras.layers.Dense(n_embd)])
def call(self, x, training):
a = self.ln1(x)
a = self.attn(query=a, key=a, value=a, training=training)
x = x + a
a = self.ln2(x)
a = self.proj(a, training=training)
x = x + a
return x
def get_config(self):
config = super().get_config().copy()
config.update({
"n_embd": self.attn.key_dim * self.attn.num_heads,
"n_head": self.attn.num_heads,
})
return config
class GPTLanguageModel(tf.keras.Model):
def __init__(self, vocab_size, n_embd, block_size, n_head, n_layer, dropout_rate=0.1):
super(GPTLanguageModel, self).__init__()
self.token_embedding_table = tf.keras.layers.Embedding(vocab_size, n_embd)
self.position_embedding_table = tf.keras.layers.Embedding(block_size, n_embd)
self.blocks = [TransformerBlock(n_embd, n_head) for _ in range(n_layer)]
self.ln_f = tf.keras.layers.LayerNormalization(epsilon=1e-6)
self.lm_head = tf.keras.layers.Dense(vocab_size)
def get_config(self):
config = super().get_config().copy()
config.update({
"vocab_size": self.vocab_size,
"n_embd": self.n_embd,
"block_size": self.block_size,
"n_head": self.n_head,
"n_layer": self.n_layer,
"dropout_rate": self.dropout_rate,
})
return config
@classmethod
def from_config(cls, config, custom_objects=None):
# This ensures custom_objects are taken into account when reconstructing the model
if custom_objects is not None:
with tf.keras.utils.custom_object_scope(custom_objects):
return cls(**config)
return cls(**config)
def call(self, idx, targets=None, training=False):
B, T = tf.shape(idx)[0], tf.shape(idx)[1]
tok_emb = self.token_embedding_table(idx)
pos_emb = self.position_embedding_table(tf.range(T))
x = tok_emb + tf.cast(pos_emb[None, :, :], tok_emb.dtype) # Explicit casting to match dtype
for block in self.blocks:
x = block(x, training=training)
x = self.ln_f(x)
logits = self.lm_head(x)
loss = None
if targets is not None:
loss = self.compute_loss(logits, targets)
return logits, loss
def compute_loss(self, logits, targets):
loss = tf.keras.losses.sparse_categorical_crossentropy(targets, logits, from_logits=True)
return tf.reduce_mean(loss)
def generate(self, idx, max_new_tokens):
for _ in range(max_new_tokens):
logits, _ = self(idx[:, -block_size:], training=False)
logits = logits[:, -1, :]
idx_next = tf.random.categorical(logits, num_samples=1, dtype=tf.int32)
idx = tf.concat([idx, idx_next], axis=1)
return idx
# Load the saved model
model = tf.keras.models.load_model("Universe-GPT-tf.keras",
custom_objects={
"GPTLanguageModel": GPTLanguageModel,
"TransformerBlock": TransformerBlock, # Possible that you require this as well
})
# Set the maximum number of new tokens to generate
max_new_tokens = 100
# Initialize the input sequence with a random starting point
input_seq = np.random.randint(0, vocab_size, size=(1, block_size))
# Generate new text
generated_text = model.generate(input_seq, max_new_tokens)
# Convert the generated text back to characters
generated_text = ''.join([chr(c) for c in generated_text[0]])
print("Generated Text:")
print(generated_text)
|
d45bd15497ecd465e20448e60ab257ec
|
{
"intermediate": 0.2615833580493927,
"beginner": 0.5310835242271423,
"expert": 0.20733311772346497
}
|
35,227
|
I have a challenge, creating a very simple Transformer model that generates random text without any human input, just a seed, it will be trained on a txt file and the model should do accurate predictions each time, the code should define, train and save the Transformer model, the model name will be for you to choose, but i need to create all of this without any code written by, you as a LLM model is the only coder in this conversation, you can code in the Python Language
|
1472a614e3f296138abf604e8e2565bb
|
{
"intermediate": 0.2573140561580658,
"beginner": 0.2076907455921173,
"expert": 0.5349951386451721
}
|
35,228
|
Is this code causes UB: void foo(void** pp) {
void* p = *pp;
// Do something with p
}
int main() {
void* p const = NULL;
foo((void**)&p);
// p has been reassigned
}
|
de698c67e5ec52d020336021b2a8d853
|
{
"intermediate": 0.28332293033599854,
"beginner": 0.5624502897262573,
"expert": 0.15422676503658295
}
|
35,229
|
Can I have a pointer that cannot be reassigned directly, but still can be reassigned through other means in C without involving Undefined Behaviour
|
2fc2c23e59ef5bd48ba39dda551d1d6b
|
{
"intermediate": 0.45409494638442993,
"beginner": 0.18971316516399384,
"expert": 0.3561919629573822
}
|
35,230
|
Look at this code and tell me what is wrong about it: import tensorflow as tf
from keras.layers import TextVectorization, Embedding
from keras.models import Sequential
from keras.layers.experimental.preprocessing import StringLookup
# Define some constants
MAX_TOKENS = 250 # Size of the vocabulary
EMBED_DIM = 64 # Embedding size
NUM_HEADS = 4 # Number of attention heads
FF_DIM = 64 # Hidden layer size in feed forward network
MAX_LEN = 40 # Maximum length of sentence
BATCH_SIZE = 64 # Training batch size
# Prepare your dataset text file
text_file_path = "dataset.txt"
# Load the text data
with open(text_file_path, "r", encoding="utf-8") as f:
text_data = f.read()
# Split the dataset into lines
lines = text_data.split("\n")
# Define the text vectorization layer
vectorize_layer = TextVectorization(
max_tokens=MAX_TOKENS,
output_mode="int",
output_sequence_length=MAX_LEN
)
# Adapt it to the dataset
vectorize_layer.adapt(lines)
# Define the Transformer block as a layer
def transformer_encoder(inputs, embed_dim, num_heads, ff_dim, rate=0.1):
# Multi-headed self-attention
attention_output = tf.keras.layers.MultiHeadAttention(
num_heads=num_heads, key_dim=embed_dim
)(inputs, inputs)
attention_output = tf.keras.layers.Dropout(rate)(attention_output)
attention_output = tf.keras.layers.LayerNormalization(epsilon=1e-6)(inputs + attention_output)
# Feed-forward layer
ff_output = tf.keras.Sequential(
[
tf.keras.layers.Dense(ff_dim, activation="relu"),
tf.keras.layers.Dense(embed_dim),
]
)(attention_output)
ff_output = tf.keras.layers.Dropout(rate)(ff_output)
ff_output = tf.keras.layers.LayerNormalization(epsilon=1e-6)(attention_output + ff_output)
return ff_output
# Define the token and position embedding layer
def token_and_position_embedding(x, maxlen, vocab_size, embed_dim):
token_embeddings = Embedding(input_dim=vocab_size, output_dim=embed_dim)(x)
positions = tf.range(start=0, limit=maxlen, delta=1)
position_embeddings = Embedding(input_dim=maxlen, output_dim=embed_dim)(positions)
return token_embeddings + position_embeddings
# Transformer model with Keras
def create_transformer_model(maxlen, vocab_size, embed_dim, num_heads, ff_dim):
inputs = tf.keras.Input(shape=(maxlen,))
embedding_layer = token_and_position_embedding(inputs, maxlen, vocab_size, embed_dim)
transformer_block_output = transformer_encoder(embedding_layer, embed_dim, num_heads, ff_dim)
outputs = tf.keras.layers.GlobalAveragePooling1D()(transformer_block_output)
outputs = tf.keras.layers.Dropout(0.1)(outputs)
outputs = tf.keras.layers.Dense(vocab_size, activation="softmax")(outputs)
model = tf.keras.Model(inputs=inputs, outputs=outputs)
return model
# Create the model
transformer_model = create_transformer_model(MAX_LEN, MAX_TOKENS, EMBED_DIM, NUM_HEADS, FF_DIM)
# Compile the model
transformer_model.compile(optimizer="adam", loss="sparse_categorical_crossentropy")
# Prepare the dataset for training
text_inputs = vectorize_layer(lines[:-1])
text_labels = vectorize_layer(lines[1:])
dataset = tf.data.Dataset.from_tensor_slices((text_inputs, text_labels))
dataset = dataset.shuffle(1024).batch(BATCH_SIZE)
# Train the model
transformer_model.fit(dataset, epochs=10)
# Save the model
transformer_model.save("STM-Experiment.keras")
print("Model training completed and saved.")
|
b0d2d3185dea36fb30c9215324388da7
|
{
"intermediate": 0.2946506142616272,
"beginner": 0.3758642375469208,
"expert": 0.32948511838912964
}
|
35,231
|
Running this code: import tensorflow as tf
from keras.layers import TextVectorization, Embedding, LayerNormalization, Dropout, Dense, MultiHeadAttention, GlobalAveragePooling1D, Input
from keras.models import Sequential, Model
from keras import Sequential
# Standard imports for saving tokenizer configuration
import json
# Define some constants
MAX_TOKENS = 250 # Size of the vocabulary
EMBED_DIM = 64 # Embedding size
NUM_HEADS = 4 # Number of attention heads
FF_DIM = 64 # Hidden layer size in feed forward network
MAX_LEN = 40 # Max length of sequence
BATCH_SIZE = 64 # Training batch size
# Prepare your dataset text file
text_file_path = "dataset.txt"
# Define the text vectorization layer with padding
vectorize_layer = TextVectorization(
max_tokens=MAX_TOKENS,
output_mode="int",
output_sequence_length=MAX_LEN,
pad_to_max_tokens=True
)
# Load the text data and adapt the vectorization layer
with open(text_file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
vectorize_layer.adapt(lines)
# Token and position embedding as a custom layer
class TokenAndPositionEmbedding(tf.keras.layers.Layer):
def init(self, maxlen, vocab_size, embed_dim):
super().init()
self.token_emb = Embedding(input_dim=vocab_size, output_dim=embed_dim)
self.pos_emb = Embedding(input_dim=maxlen, output_dim=embed_dim)
def call(self, x):
maxlen = tf.shape(x)[-1]
positions = tf.range(start=0, limit=maxlen, delta=1)
positions = self.pos_emb(positions)
x = self.token_emb(x)
return x + positions
# Define the Transformer block as a function
def transformer_encoder(inputs, embed_dim, num_heads, ff_dim, rate=0.1):
# Multi-headed self-attention
attention_output = MultiHeadAttention(
num_heads=num_heads, key_dim=embed_dim
)(inputs, inputs)
attention_output = Dropout(rate)(attention_output)
attention_output = LayerNormalization(epsilon=1e-6)(inputs + attention_output)
# Feed-forward layer
ff_output = Sequential(
[
Dense(ff_dim, activation="relu"),
Dense(embed_dim),
]
)(attention_output)
ff_output = Dropout(rate)(ff_output)
ff_output = LayerNormalization(epsilon=1e-6)(attention_output + ff_output)
return ff_output
# Create the Transformer model
def create_transformer_model(maxlen, vocab_size, embed_dim, num_heads, ff_dim):
inputs = Input(shape=(maxlen,))
embedding_layer = TokenAndPositionEmbedding(maxlen, vocab_size, embed_dim)(inputs)
transformer_block_output = transformer_encoder(embedding_layer, embed_dim, num_heads, ff_dim)
outputs = GlobalAveragePooling1D()(transformer_block_output)
outputs = Dropout(0.1)(outputs)
outputs = Dense(vocab_size, activation="softmax")(outputs) # Assuming next-token prediction
model = Model(inputs=inputs, outputs=outputs)
return model
transformer_model = create_transformer_model(MAX_LEN, MAX_TOKENS, EMBED_DIM, NUM_HEADS, FF_DIM)
transformer_model.compile(optimizer="adam", loss="sparse_categorical_crossentropy")
# Prepare the dataset for training with next-token prediction
text_dataset = tf.data.TextLineDataset(text_file_path)
text_vectorized = vectorize_layer(text_dataset)
text_dataset = text_vectorized.batch(BATCH_SIZE).prefetch(tf.data.AUTOTUNE)
text_labels = text_vectorized.map(lambda x: x[:, 1:]) # Shifted by one position for labels
text_inputs = text_vectorized.map(lambda x: x[:, :-1]) # Original sequence without the last token as input
dataset = tf.data.Dataset.zip((text_inputs, text_labels)).shuffle(1024).batch(BATCH_SIZE)
# Train the model
transformer_model.fit(dataset, epochs=10)
# Save the model
transformer_model.save("STM-Experiment")
# Save the tokenizer to a json file
tokenizer_json = vectorize_layer.get_vocabulary()
with open("tokenizer.json", "w", encoding="utf-8") as f:
json.dump(tokenizer_json, f, ensure_ascii=False)
print("Model and tokenizer have been saved.") leaves me with this error: ValueError: Exception encountered when calling layer 'text_vectorization' (type TextVectorization).
Attempt to convert a value (<TextLineDatasetV2 element_spec=TensorSpec(shape=(), dtype=tf.string, name=None)>) with an unsupported type (<class 'tensorflow.python.data.ops.readers.TextLineDatasetV2'>) to a Tensor.
Call arguments received by layer 'text_vectorization' (type TextVectorization):
• inputs=<TextLineDatasetV2 element_spec=TensorSpec(shape=(), dtype=tf.string, name=None)>
|
c20e429a30a3a313f5c29d95d15b5b65
|
{
"intermediate": 0.3328692615032196,
"beginner": 0.40503963828086853,
"expert": 0.26209115982055664
}
|
35,232
|
CONSTRAINTS:
1. ~100k word limit for short term memory. Your short term memory is short, so immediately save important information to files.
2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
3. No user assistance
4. Exclusively use the commands listed in double quotes e.g. "command name"
5. Random shutdowns of you.
COMMANDS:
1. Google Search: "google", args: "input": "<search>"
2. Memory Add: "memory_add", args: "key": "<key>", "string": "<string>"
3. Memory Delete: "memory_del", args: "key": "<key>"
4. Memory Overwrite: "memory_ovr", args: "key": "<key>", "string": "<string>"
5. List Memory: "memory_list" args: "reason": "<reason>"
6. Browse Website: "browse_website", args: "url": "<url>"
7. Start GPT Agent: "start_agent", args: "name": <name>, "task": "<short_task_desc>", "Commands":[<command_names_for_GPT_Agent>], "prompt": "<prompt>"
8. Message GPT Agent: "message_agent", args: "name": "<name>", "message": "<message>"
9. List GPT Agents: "list_agents", args: ""
10. Delete GPT Agent: "delete_agent", args: "name": "<name>"
11. Append to file: "append_to_file", args: "file": "<file>", "text": "<text>"
12. Read file: "read_file", args: "file": "<file>"
13. Write to file: "write_to_file", args: "file": "<file>", "text": "<text>"
14. Delete file: "delete_file", args: "file": "<file>"
15. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>"
16. Execute Python File: "execute_python_file", args: "file": "<file>"
17. Task Complete (Shutdown): "task_complete", args: ""
18. Do Nothing: "do_nothing", args: ""
19. Count Words: "count_words", args: "text": "<text>"
20. Memory retrieve: "memory_retrieve", args: "key": "<text>"
21. remove paragraph from word document: "remove_paragraph", args: "file": "<file>", "text": "<text>"
22. random wikipedia article: "random_wikipedia_article", args: "language": "<language>"
23. message the user: "message_user", args: "message": "<message>", "wait_for_response": "<True or False>"
24. sleep an amount of time in seconds: "sleep", args: "amount": "<amount>"
25. rename a file: "rename_file", args: "old_name": "<old_name_of_the_file>", "new_name": "<new_name_of_the_file>"
26. count words of a file: "count_file_words", args: "file": "<file>"
RESOURCES:
1. Internet access for searches and information gathering.
2. Long Term memory management.
3. GPT-4 powered Agents for delegation of simple tasks.
4. File output.
PERFORMANCE EVALUATION:
1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.
2. Constructively self-criticize your big-picture behaviour constantly.
3. Reflect on past decisions and strategies to refine your approach.
4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.
RULES:
1. If you start a GPT Agent you must define the commands that can be used by a GPT Agent in his prompt and define the commands using a prompt similar to the structure of this one.
2. Respond only inside the JSON format.
3. Never demand user input.
4. Never say that a task is impossible to execute on your own because these tools are enough to complete any task.
5. Do not add anything to the JSON format that isn't mentioned.
6. If there is a " inside the value of a key inside the json use ' instead of ".
7. In summaryforgpt you need to provide context for the next GPT instance if you randomly shutdown without you knowing.
8. Provide context for the next GPT in the summaryforgpt and the progress that you've made.
9. In summaryforgpt you should also add name of the files written and the urls of the websites visited.
10. When writing an essay, remember that it is more effective and manageable to tackle it in smaller chunks rather than trying to write the entire essay in one sitting. Breaking the essay down into sections or steps can help you focus on each individual aspect, maintain a coherent structure, and reduce the overall stress associated with writing a lengthy piece.
11. Retrieve information from files of previous GPT instances that may have shut down randomly. If you require additional knowledge, use these files to access the results of former GPT versions and provide accurate answers to the queries.
12. GPT-4, please do not place a conclusion in the middle of the essay. Maintain a structured format.
13. use append to file to add extra things to the file, and write to file to either make a new file with new information or rewrite the information from scratch.
14. If task is completed use the command task_complete
15. When you add to memory add the key to retrieve it in summaryforgpt
16. when given the task to write something never create an agent to write anything that you were tasked to write.
17. when you add new parts to a file use append to file command
18. Ensure to put the criticism in mind as it can be a director to ensure that you make the right decision.
19. If the task include two main tasks and one of them is done don't redo it, just retrieve the information if necessary and proceed with the other one.
20. Make sure that the information generated is not made up.
21. Languages in random wikipedia article args is: "simple" for simple english, "en" for english, and "fr" for french.
22. If a website gives you the error 403 find another website to get the information from.
23. Always listen to your criticism, and follow it.
24. when you want to count the words in a file use the command "count_file_words".
25. Don't repeat yourself.
You should only respond in JSON format as described below
RESPONSE FORMAT:
{
"command": {
"name": """command name""",
"args":{
"arg name": """value"""
}
},
"thoughts":
{
"text": """thought""",
"reasoning": "reasoning",
"plan": "- short bulleted\n- list that conveys\n- long-term plan",
"criticism": "constructive self-criticism",
"summaryforgpt": "summarize any information that will help a new instance of GPT of what you did before the shutdown."
}
}
Ensure the response can be parsed by Python json.loads
Context from previous GPT: No actions have been taken yet. An initial command has been issued to retrieve a random Simple Wikipedia article to start the task of analyzing for grammatical mistakes. No articles have been analyzed, and no errors have been found yet.The first article with the title ‘Rick Mears’ has been analyzed, and no grammatical errors were identified. No notification to the user was necessary. Preparing to move to the next article.One Simple Wikipedia article titled ‘Rick Mears’ has been analyzed and found to be error-free. Moving on to analyze a new random Simple Wikipedia article for grammatical mistakes. No user notification has been made.Analyzed ‘Lençóis Maranhenses National Park’ article and found grammatical errors, which have been reported to the user. Preparing to analyze the next Simple Wikipedia article. Articles reviewed: 2 (‘Rick Mears’ and ‘Lençóis Maranhenses National Park’).So far, two Simple Wikipedia articles have been analyzed: ‘Rick Mears’ (error-free) and ‘Lençóis Maranhenses National Park’ (errors found and reported). Now, moving to retrieve and analyze a third article.The ‘Murray Schisgal’ article has been analyzed and one grammatical error was found and reported to the user. Preparing to analyze the next Simple Wikipedia article. Articles reviewed: 3 (‘Rick Mears’, ‘Lençóis Maranhenses National Park’, and ‘Murray Schisgal’).Three Simple Wikipedia articles have been analyzed: ‘Rick Mears’ (error-free), ‘Lençóis Maranhenses National Park’ (errors found and reported), and ‘Murray Schisgal’ (errors found and reported). Now proceeding to analyze a fourth article.The ‘Alexandre Lopes’ article has been analyzed and found to be error-free. Articles reviewed: 4 (‘Rick Mears’, ‘Lençóis Maranhenses National Park’, ‘Murray Schisgal’, ‘Alexandre Lopes’). Preparing to retrieve and analyze the next article.No errors were found in the ‘Alexandre Lopes’ article. So far, four Simple Wikipedia articles have been reviewed with two reports of grammatical errors sent to the user. Now, moving to retrieve and analyze a fifth article.The review of the ‘Modigliana’ article did not reveal any grammatical errors. To date, five Simple Wikipedia articles have been analyzed: ‘Rick Mears’, ‘Lençóis Maranhenses National Park’, ‘Murray Schisgal’, ‘Alexandre Lopes’, and ‘Modigliana’, with two reports sent to the user. Now proceeding to retrieve and analyze a sixth article.Five Simple Wikipedia articles have been reviewed thus far without errors detected in two of them and necessary notifications sent for the other two. Preparing to analyze the next, which will be the sixth article in the task sequence.Having analyzed the article for ‘Klaus Huhn’, no grammatical mistakes were detected. The count of articles reviewed has increased to six: ‘Rick Mears’ (error-free), ‘Lençóis Maranhenses National Park’ (errors reported), ‘Murray Schisgal’ (error reported), ‘Alexandre Lopes’ (error-free), ‘Modigliana’ (error-free), and ‘Klaus Huhn’ (error-free). The process continues with the next article.The total count of Simple Wikipedia articles analyzed is now six, with the last being ‘Klaus Huhn’, which was free from errors. Moving on to analyze the seventh article in accordance with the task requirements.Seven articles have been analyzed thus far, and no grammatical errors were found in the ‘Rockwell, Arkansas’ article. Articles with reported errors include ‘Lençóis Maranhenses National Park’ and ‘Murray Schisgal’. The task continues with the next article.Seven articles analyzed, the latest being ‘Rockwell, Arkansas’, with no errors to report. Two articles (‘Lençóis Maranhenses National Park’ and ‘Murray Schisgal’) had grammatical mistakes that were communicated to the user. Now approaching the analysis of an eighth article.The ‘Printed Circuit Board’ article has been reviewed and a spacing error after a period was detected. Notification has been sent to the user. Total articles reviewed: 8 (‘Rick Mears’, ‘Lençóis Maranhenses National Park’, ‘Murray Schisgal’, ‘Alexandre Lopes’, ‘Modigliana’, ‘Klaus Huhn’, ‘Rockwell, Arkansas’, ‘Printed Circuit Board’), with grammatical errors reported for three articles. Preparing to analyze the next article.Up to eight articles have been analyzed, most recently ‘Printed Circuit Board’ with a grammatical error that was reported to the user. Moving forward to the analysis of the ninth article as per the task directive.Analyzed the ‘Malappuram’ article and found a capitalization error and spacing issue. Notification has been sent to the user. This brings the total to nine articles reviewed (‘Rick Mears’, ‘Lençóis Maranhenses National Park’, ‘Murray Schisgal’, ‘Alexandre Lopes’, ‘Modigliana’, ‘Klaus Huhn’, ‘Rockwell, Arkansas’, ‘Printed Circuit Board’, ‘Malappuram’), with errors reported in four articles. Proceeding to the next.Retrying notification to the user regarding grammatical errors found in the ‘Malappuram’ article. The summary of work until now includes the analysis of nine articles, with four necessitating reports of errors. Preparing for continuation of the task.Sent a corrected notification for grammatical errors in the ‘Malappuram’ article. Total of nine articles reviewed, with errors reported for four. The task continues with retrieving and analyzing the tenth article.Analyzed the ‘Kutub al-Sittah’ article, and no grammatical errors were found. Progress has continued to the tenth article without the need for user notification. Preparing to retrieve and review the eleventh article.The article ‘Kutub al-Sittah’ was checked and determined to be without grammatical issues. The count of reviewed articles is now ten, with four reports of errors sent to the user. Moving forward to the analysis of the eleventh article.Found a typographical error in the ‘Kelly Osbourne’ article, pertaining to the inconsistent spelling of her surname. This has been communicated to the user. Articles reviewed so far: 11, with five requiring error notifications. Preparing for the next article analysis.The ‘Kelly Osbourne’ article had a typographical error that was reported to the user. Eleven articles have been reviewed, with five errors reported. Task continues with the retrieval and analysis of the twelfth article.The ‘Glyndon, Minnesota’ article did not have any grammatical errors. Twelve articles have been reviewed in total, and we are proceeding to the thirteenth article. No user notification was needed for this article.So far, twelve Simple Wikipedia articles have been analyzed with no errors in ‘Glyndon, Minnesota’. Errors were reported in five other articles. The task will proceed with the analysis of the thirteenth article.Reviewed ‘Garden Route District Municipality’ article and communicated suggestions for rephrasing certain sentences. The total count of articles analyzed is now 13, with adjustments communicated for six of them. Moving forward to review the fourteenth article.After providing suggestions for the ‘Garden Route District Municipality’ article, the count of articles reviewed amounts to 13, with six having improvement suggestions or error notifications. Next, the fourteenth article will be analyzed.Notified the user about errors found in the ‘List of municipalities in Louisiana’ article, including a numerical discrepancy and a spacing issue. Moving forward, this brings the total to 14 articles reviewed, with seven necessitating communication with the user due to errors. Preparing to review the fifteenth article.Fourteen articles have been analyzed, seven of which required error notifications to the user. Now advancing to select and assess the fifteenth article.The article ‘Czech Republic (European Parliament constituency)’ has been examined and no errors were found. Fifteen articles have now been reviewed with seven requiring user notifications. Ready to proceed with reviewing the sixteenth article.The ‘Czech Republic (European Parliament constituency)’ was error-free. To date, fifteen articles have been reviewed, with errors reported in seven. Now moving on to the sixteenth article.No grammatical issues were observed in the ‘Chemist’ article. Reviewed articles tally up to sixteen, with user notifications sent out for seven of those. Now moving to retrieve the seventeenth article for analysis.Seventeen articles have been analyzed, with grammatical errors reported for seven. ‘Chemist’ was the most recent article and was found to have no errors. Proceeding to analyze the eighteenth article.The article ‘Baku Metro’ was reviewed and determined to be free of grammatical errors. With this, eighteen Simple Wikipedia articles have been analyzed, seven of which contained errors that were reported to the user. Preparing to move on to the nineteenth article in the sequence.Thus far, eighteen Simple Wikipedia articles have been reviewed, with no grammatical mistakes in the ‘Baku Metro’ article. Seven articles have had errors reported to the user. Now proceeding to assess the nineteenth article.The ‘Donkey Kong Country’ article was reviewed and several points on grammatical improvements and clarity were identified and reported to the user. The tally of reviewed articles now stands at nineteen, with eight requiring user notification. Ready to proceed to the next article.Having analyzed nineteen articles and reported grammatical and stylistic enhancements for the ‘Donkey Kong Country’ article, it’s time to proceed with the review of the twentieth article.No errors found in the review of ‘Lady Pamela Hicks’. Twenty articles have now been analyzed, with eight requiring user notifications about issues. Preparing to review the twenty-first article.Twenty articles have been reviewed using the provided commands, and eight of those had issues reported to the user. Now moving on to the twenty-first article for grammatical analysis.The ‘United Left (Spain)’ article has been reviewed, and it does not contain any grammatical errors. To date, twenty-one articles have been reviewed, and no errors were found in the latest article. The task will proceed with the analysis of the twenty-second article.So far, twenty-one articles have been reviewed, and no issues were identified in the ‘United Left (Spain)’ article. Preparing to analyze the twenty-third article.Notified the user about a stylization inconsistency in the ‘While (1 Is Less Than 2)’ article. This is the twenty-second article reviewed; eight articles thus far have been highlighted for errors. Moving forward to the analysis of the twenty-third article.Having analyzed twenty-two articles and reported an inconsistency issue with the album title presentation in ‘While (1 Is Less Than 2)’, the process now continues to the twenty-third article.No grammatical errors were detected in the ‘Socastee, South Carolina’ article. This makes it the twenty-third reviewed article to be clear of issues. Prepared to move on to the twenty-fourth article analysis.With no errors in the ‘Socastee, South Carolina’ article, twenty-three articles have been assessed so far. The process now proceeds with the twenty-fourth article.The ‘Rudolf Kirchschläger’ article is free of grammatical errors. Twenty-four articles have now been reviewed. Preparing to continue with the twenty-fifth article.With ‘Rudolf Kirchschläger’ found to be error-free, the total count of reviewed articles has reached twenty-four. Moving on to analyze the twenty-fifth article.Found and reported a grammatical error in the ‘Ashwaubenon, Wisconsin’ article. The count of articles reviewed so far is twenty-five, with issues communicated for nine of them. Preparing for the review of the next article.The ‘Ashwaubenon, Wisconsin’ article contained an error which has been reported to the user. To date, twenty-five articles have been reviewed, with nine notifications sent to the user for errors. Now, moving to analyze the twenty-sixth article.As no grammatical errors were found in the ‘You Got Lucky’ article, there was no need for user notification. The count of articles reviewed stands at twenty-six; with the task instruction successfully followed for this article, preparation for the twenty-seventh article review is now underway.After detecting no errors in the ‘You Got Lucky’ article, the number of articles reviewed totals twenty-six. The workflow remains uninterrupted as I proceed with the analysis of the twenty-seventh article.Suggested rephrasing improvements for the ‘Janani Luwum’ article. This is the twenty-seventh article reviewed with ten requiring notifications for errors or clarity issues. Preparing to review the next article in the sequence.Having addressed phrasing issues in the ‘Janani Luwum’ article, 27 articles have been reviewed, with improvements suggested for 10 of them. Now advancing to analyze the twenty-eighth article.Reported grammatical corrections to be made in the ‘Áo dài’ article. This is the twenty-eighth article reviewed, with eleven requiring some form of correction. Moving forward to the twenty-ninth article for review.Having communicated the need for corrections in the ‘Áo dài’ article, the count of articles reviewed has reached twenty-eight. Eleven of those required user notification. Ready to analyze the twenty-ninth article.Reviewed the ‘Phyllomedusa bicolor’ article; no grammatical issues were detected. The total number of articles reviewed remains at twenty-nine, with eleven notified for corrections. Proceeding to the thirtieth article.With ‘Phyllomedusa bicolor’ being error-free and reviewed, the count of articles assessed stands at twenty-nine. Preparing to carry out the grammatical review of the thirtieth article.Reported a grammatical error and provided a suggestion for improved phrasing in the ‘The Trouble with Harry’ article. This marks the thirtieth article reviewed, with twelve requiring some form of user notification. Ready to analyze the thirty-first article.Having corrected ‘The Trouble with Harry’, I’ve reviewed thirty articles in total, and twelve have had errors reported. Moving on to review the thirty-first article.The ‘Madré’ article was reviewed without finding any grammatical errors. This increases the count of reviewed articles to thirty-one. The task continues as I prepare to analyze the thirty-second article.The ‘Madré’ article was free of grammatical mistakes, keeping the number of error-free articles at thirty-one. Preparing to conduct a grammatical review of the thirty-second article.Notified the user about several grammatical errors in the ‘Numerical methods for partial differential equations’ article. This is the thirty-second article reviewed, with corrections suggested for thirteen. Preparing to analyze the thirty-third article.Having reported errors for the ‘Numerical methods for partial differential equations’ article, I’ve now reviewed thirty-two articles, with corrections suggested for thirteen. Moving on to review the thirty-third article.Reported a grammatical error in the ‘Deron Quint’ article regarding the use of ‘who’ instead of ‘that’ and provided a structural suggestion for improved readability. Including this article, thirty-three articles have been assessed, with corrections suggested for fourteen. Proceeding to analyze the thirty-fourth article.Having provided grammatical corrections for ‘Deron Quint’, the total number of articles reviewed is thirty-three, with notifications sent for fourteen. Preparing to review the thirty-fourth article.‘Windows Narrator’ article reviewed; no grammatical issues found. Reviewed article count stands at thirty-four; task proceeding to article number thirty-five.Continuing the task with thirty-four articles reviewed and no grammatical corrections necessary for the ‘Windows Narrator’ article, I am moving on to the thirty-fifth article.‘Lithium borate’ article reviewed, and no grammatical errors were found. This marks the thirty-fifth article reviewed. Prepared to continue with the thirty-sixth article.Having completed the review of the ‘Lithium borate’ article with no grammatical issues, I will now continue to the thirty-sixth article as part of the ongoing task.The ‘Fred A. Busse’ article contains no grammatical errors. This maintains the number of articles reviewed at thirty-six. Preparing to review article thirty-seven.The article review of ‘Fred A. Busse’ showed no grammatical issues, and the count of reviewed articles now stands at thirty-six. Proceeding to select and analyze the thirty-seventh article.Reviewed the ‘Chris Miller (quarterback)’ article without detecting grammatical errors. The total articles reviewed now stands at thirty-seven, moving to the thirty-eighth article review.Having found no errors in the ‘Chris Miller (quarterback)’ article, I’m proceeding to analyze the thirty-eighth article as I continue with the assigned task.‘Lairembi’ article reviewed and found to be free of grammatical errors. Articles reviewed count stands at thirty-eight. Preparing to analyze the thirty-ninth article.With thirty-eight articles reviewed and ‘Lairembi’ found to be error-free, I’m advancing to the analysis of the thirty-ninth article.‘Gorla Minore’ article reviewed and no grammatical issues discovered. This brings the total to thirty-nine articles reviewed. Now moving to assess the fortieth article.With ‘Gorla Minore’ reviewed and free from errors, the number of articles analyzed so far is thirty-nine. The analysis of the fortieth article is next in the task sequence.The ‘Tabassum Adnan’ article review showed no grammatical issues; thus, no user notification was necessary. Ready to proceed with the analysis of the fortieth article.After reviewing ‘Tabassum Adnan’ with no errors found, I am proceeding to the fortieth article review as part of the task.Advised on corrections for the ‘Brazilian Grand Prix’ article including redundancy, tense inconsistency, and formatting. This is the fortieth article reviewed, with user notifications sent for fifteen. Preparing to analyze the forty-first article.Corrections reported for ‘Brazilian Grand Prix’ and with that, forty articles have been reviewed thus far, with fifteen requiring notifications for error corrections. Moving on to review the forty-first article.‘Kamuta Latasi’ article appears grammatically correct; thus, no user notification was necessary. Ready to proceed with the review of the forty-second article, with forty-one articles reviewed so far.Having completed the ‘Kamuta Latasi’ article review with no errors found, the count of reviewed articles is forty-one. Proceeding to retrieve and analyze the forty-second article.The ‘Colic’ article has been reviewed, no grammatical errors are present, but there might be room for clarification of content. Forty-two articles have now been reviewed, moving to the forty-third article.No grammatical errors were detected in the ‘Colic’ article, and thus, no user notification was required. Forty-two articles have been assessed, and now I am moving on to analyze the forty-third article.‘Corinne, Utah’ was reviewed, with no grammatical issues detected. The total number of articles reviewed is now forty-three. Ready to advance to the forty-fourth article.With no grammatical errors in the ‘Corinne, Utah’ article, the task continues with forty-three articles reviewed. Preparing to proceed with the review of the forty-fourth article.Reported multiple grammatical issues in the ‘Rudi Hiden’ article. With this article, thirty-three articles have been reviewed in total, with notifications suggested for correction in extra fourteen. Preparing to review the next article.After reporting necessary corrections for ‘Rudi Hiden’, the total of articles reviewed thus far is forty-four, with formal notifications sent for fifteen errors. Proceeding to analyze the forty-fifth article.‘Mount Takao’ article has been reviewed with no grammatical mistakes found. This brings the number of total reviewed articles to forty-five. Moving to assess the forty-sixth article.Having completed the review of ‘Mount Takao’ with no errors, 45 articles have been reviewed thus far. Preparing to review the forty-sixth article.‘Cannibal Holocaust’ article reviewed and found to be free of grammatical errors. Preparing to review the forty-seventh article with forty-six articles reviewed to date.No grammatical errors were found in the ‘Cannibal Holocaust’ article. I have now reviewed forty-six articles. Proceeding to select and examine the forty-seventh article.The ‘Cyrille Regis’ article is grammatically sound. The total articles reviewed stands at forty-seven. Preparing for the review of the forty-eighth article.‘Cyrille Regis’ article was free of grammatical errors. With that review complete, the count of articles reviewed is forty-seven. Now, I will proceed with the review of the forty-eighth article.Reviewed ‘Água Fria’ and identified no grammatical errors. Progressing to the forty-ninth article review with forty-eight articles already reviewed.Having completed the review of the ‘Água Fria’ article without detecting grammatical mistakes, the count of reviewed articles now stands at forty-eight. Moving to analyze the forty-ninth article.Reviewed the ‘Hans Motz’ article and found it to be free of grammatical issues. Forty-nine articles have now been assessed. Preparing to review the fiftieth article in the task sequence.The ‘Hans Motz’ article was grammatically accurate. The tally of articles reviewed has reached forty-nine. Now proceeding to select and review the fiftieth article.Assessed ‘June 1962 Alcatraz escape attempt’ article, and no grammatical mistakes were found. Articles reviewed thus far total fifty. Ready to continue with the fifty-first article.Continuing the task, fifty articles have been reviewed, with the last being ‘June 1962 Alcatraz escape attempt,’ which had no grammatical errors. Now preparing to review the fifty-first article.No grammatical corrections were needed for the ‘Xenopus’ article, although a punctuation placement issue was noted. Ready to proceed with the review of the fifty-second article, having reviewed fifty-one articles up to this point.The article ‘Xenopus’ had a formatting issue; however, no grammatical errors required correction. Fifty-one articles have been reviewed to date. Proceeding to the fifty-second article review.‘UNTV’ article reviewed; no immediate grammatical errors found. Preparing to proceed with the review of the fifty-third article, with fifty-two articles reviewed so far.Having completed the review of ‘UNTV’ without identifying grammatical issues, the reviewed article count is now at fifty-two. Proceeding to the fifty-third article.‘Danish language’ article reviewed without grammatical errors detected. Articles reviewed is now fifty-three, ready to advance to the fifty-fourth article review.The ‘Danish language’ article was found to be grammatically correct, marking fifty-three articles reviewed in total. Now preparing to review the fifty-fourth article.‘Living with a Hernia’ has been reviewed and found to be grammatically sound. This makes fifty-four articles reviewed. Ready to proceed with the fifty-fifth article.Having found no errors in ‘Living with a Hernia’, I’ve reviewed fifty-four articles to date. Now preparing to analyze the fifty-fifth article.Found and reported issues with terminology and phrasing in the ‘Louisiana Territory’ article. Including this one, fifty-six articles have been reviewed, with send sixteen notifications for corrections. Moving on to review the fifty-seventh article.Corrections for the ‘Louisiana Territory’ article have been communicated. Fifty-six articles have been reviewed, with sixteen requiring user notification. Preparing now to assess the fifty-seventh article.Reviewed the ‘Hal Willner’ article which contains no significant grammatical errors. Articles reviewed now total fifty-seven; moving on to the next one for review.The ‘Hal Willner’ article was reviewed and found to be grammatically correct. Ready to proceed with the review of the fifty-eighth article, after reviewing fifty-seven so far.Reviewed the ‘Mike Brooks (journalist)’ article, identifying no grammatical issues to correct. Ready to continue with the review of the fifty-ninth article after successfully evaluating fifty-eight articles.Fifty-eight articles have been reviewed for grammatical errors. The last article reviewed was ‘Mike Brooks (journalist)’, which contained no grammatical issues. Moving on to retrieve the fifty-ninth article.Reviewed ‘Lynching in the United States’, found a typographical error with ‘Ku Klux clan’ which should be ‘Ku Klux Klan’. Questioned the clarity of the currency conversion statement. Moving to retrieve and review the fifty-ninth article after notifying the user. Fifty-nine articles have been reviewed so far with sixteen requiring notifications for errors or clarifications.The fifty-ninth article titled ‘Lynching in the United States’ had a typographical error which was communicated to the user; now obtaining the sixtieth article for review. The total number of articles reviewed so far is fifty-nine.After reviewing ‘Burlington, Illinois’, no errors were detected. This was the sixtieth article analyzed, and no user notification was required. Preparing to move on to the sixty-first article in the sequence. The count of reviewed articles remains at fifty-nine with sixteen requiring notifications.The article ‘Burlington, Illinois’ was brief but contained no grammatical errors. Currently, sixty articles have been reviewed, and a user notification was only necessary for sixteen of them. Preparing to retrieve and analyze the sixty-first article.Reviewed the ‘Marcelo Bonelli’ article and found a typographical error regarding capitalization, along with suggestions for improved clarity and structure. Notified the user of these points. Sixty-one articles have been reviewed so far with seventeen requiring notifications for errors or clarifications. Preparing to retrieve and analyze the sixty-second article.Having completed the review of the ‘Marcelo Bonelli’ article, I have now initiated the retrieval of the sixty-second article. Sixty-one articles have been reviewed to date, with seventeen requiring user notification due to errors or requests for clarification. Now moving forward to the next article.The ‘Shahla Riahi’ article has been reviewed and no grammatical errors were found. As this was the sixty-second article reviewed without any errors, user notification was not necessary. Preparation is underway to proceed to the sixty-third article. Sixty-two articles have been reviewed, with seventeen requiring notifications.Sixty-two Simple Wikipedia articles have been reviewed, with seventeen notifications sent to the user for errors or clarifications needed. The next step is to analyze the sixty-third article. Previous articles with no errors include ‘Burlington, Illinois’, ‘Hal Willner’, ‘Louisiana Territory’, and ‘Living with a Hernia’.Reviewed the ‘Royal Library of Turin’ article and found it to be grammatically correct with the exception of a minor clarity enhancement suggestion. Preparing to move on to the sixty-fourth article. Articles reviewed: 63.The ‘Royal Library of Turin’ article was reviewed and a minor suggestion for improvement was sent to the user. Now, I am retrieving the sixty-fourth Simple Wikipedia article for grammatical review, continuing with the task. Articles reviewed: 63.Sent a user notification about the apparent incomplete ‘References’ section in ‘The Ladder (magazine)’ article. Preparing to retrieve the sixty-fifth article for review. Total articles reviewed: 64.Reviewed the ‘The Ladder (magazine)’ article and sent a user notification regarding the ‘References’ section’s completeness. Now proceeding to get the sixty-fifth article for review. Articles reviewed: 64.Notified the user of grammar and consistency errors in the ‘Open Season 2’ article. Moving on to retrieve the sixty-sixth article for review. Articles reviewed: 65.Reviewed the ‘Open Season 2’ article, notified the user of several grammatical corrections, and now, moving to review the sixty-sixth article. Articles reviewed: 65.Reviewed the ‘John G. Shedd’ article; suggested minor stylistic consistency and factual accuracy points to the user. Preparing to move on to the sixty-seventh article for review. Articles reviewed: 66.Sent feedback on the ‘John G. Shedd’ article. Now moving to review the sixty-seventh Simple Wikipedia article, with a total of 66 articles reviewed.Reviewed the ‘Max (book series)’ article and sent suggestions to the user on how to enhance the article’s content and referencing. Preparing to retrieve the sixty-eighth article for review. Articles reviewed: 67.With the ‘Max (book series)’ article reviewed and user notified, I am now moving on to review the sixty-eighth article. Total articles reviewed stands at 67.Notified the user of a grammatical correction in the ‘Oneroa (electorate)’ article and mentioned the lack of content in certain sections. Getting ready to obtain and review the sixty-ninth article. Articles reviewed: 68.Reviewed the ‘Oneroa (electorate)’ article, provided grammatical correction to the user, and mentioned the potential need for more information. Now moving to review the sixty-ninth article. Articles reviewed: 68.Sixty-eight Simple Wikipedia articles have been reviewed for grammatical errors so far, seventeen of which required user notifications for errors or clarifications. The last reviewed article was ‘Oneroa (electorate)’, which had grammatical issues that were communicated to the user. Preparing to analyze the sixty-ninth article.So far, I have reviewed sixty-nine Simple Wikipedia articles. The most recent article, ‘Cargo aircraft,’ had a grammatical error that was communicated to the user, who has been notified of the correction needed in the article. I will now proceed to obtain and review the seventieth article.Seventy Simple Wikipedia articles have now been analyzed. Corrections from the sixty-ninth article, ‘Cargo aircraft,’ were communicated to the user. Moving on to retrieve and analyze the seventy-first article for grammatical mistakes or other types of errors.Seventy-one Simple Wikipedia articles have been analyzed. The seventieth article titled ‘Francisco Dias Alves’ did not contain grammatical errors, so no communication with the user was necessary. Preparing to move to the seventy-second article to continue the sequential review of Wikipedia pages.Completed the review of seventy-one Simple Wikipedia articles. No errors were found in the seventieth article ‘Francisco Dias Alves’. Moving on to analyze the seventy-second article for grammatical mistakes or other errors as per the task directive.Seventy-two Simple Wikipedia articles have been analyzed, with two typographical errors identified in the seventy-first article ‘Shanghai Jiao Tong University’. Corrections have been suggested to the user. Preparing to retrieve and review the seventy-third article for grammatical mistakes or other types of errors.So far, seventy-two Simple Wikipedia articles have been reviewed, with the latest being ‘Shanghai Jiao Tong University’, where two typographical errors were corrected. Preparing now to review the seventy-third article.Seventy-three Simple Wikipedia articles have been analyzed so far, including the ‘Colony, Kansas’ article, where suggestions for improvement on clarity and formatting have been sent to the user. Now, preparing to retrieve and review the seventy-fourth article.Review of seventy-three Simple Wikipedia articles has been completed. Corrections have been addressed in the ‘Colony, Kansas’ article. Moving forward to retrieve and review the seventy-fourth article for grammatical mistakes or other types of errors.Seventy-four Simple Wikipedia articles have been reviewed to date, including the most recent one, ‘Plainville, Massachusetts’, which was found to be error-free. No user notification was sent. Preparing to continue with the review of the seventy-fifth article.So far, seventy-four Simple Wikipedia articles have been assessed. ‘Plainville, Massachusetts’ was the most recent article and didn’t require any corrections. Now, I am set to acquire and scrutinize the seventy-fifth article for grammatical mistakes or other concerns.Seventy-five Simple Wikipedia articles have been reviewed, including the latest ‘Autofocus’ article, where a spelling error was identified and a rephrasing suggestion was given. Preparing now to proceed with the review of the seventy-sixth article.To date, seventy-five Simple Wikipedia articles have been analyzed, with the latest update involving the ‘Autofocus’ article, where typographical corrections and suggestions for improved clarity were provided to the user. Proceeding to obtain and analyze the seventy-sixth article.Seventy-six Simple Wikipedia articles have been reviewed. The article ‘Allen Parish, Louisiana’ contained no errors, so no user notification was sent. Preparing to advance to the seventy-seventh article for grammatical review.Seventy-six articles have been examined so far without errors detected in the latest, ‘Allen Parish, Louisiana’. Now moving to obtain and review the seventy-seventh article for grammatical accuracy or any other notable issues.Seventy-seven Simple Wikipedia articles have been reviewed. The ‘Ketuvim’ article did not present grammatical errors, but a suggestion to improve the list format has been communicated to the user. Preparing to proceed with the review of the seventy-eighth article.Seventy-eight Simple Wikipedia articles have been reviewed; a formatting suggestion for improved readability was communicated to the user regarding the ‘Ketuvim’ article. I am now ready to select and review the seventy-ninth article in the sequence.Seventy-nine Simple Wikipedia articles have been reviewed to date. Corrections concerning a space error and a date clarification have been suggested to the user for the ‘Eiichiro Oda’ article. Moving forward to acquire and analyze the eightieth article.Eighty Simple Wikipedia articles have been reviewed, with the latest corrections sent to the user regarding the ‘Eiichiro Oda’ article. I am now prepared to retrieve and review the eighty-first article.Having reviewed eighty Simple Wikipedia articles, I’ve provided a suggestion to enhance clarity in the ‘Quett Masire’ article. Now, I am set to obtain and examine the eighty-second article.Eighty-one Simple Wikipedia articles have been reviewed thus far. Advice was provided to improve the ‘Quett Masire’ article. Moving on to retrieve and assess the eighty-second article.Eighty-two articles have been reviewed, including the latest on ‘John Motson,’ for which corrections and clarifications have been communicated to the user. Now preparing to review the eighty-third article.Having reviewed eighty-two Simple Wikipedia articles, with the last being John Motson, I am now set to select and review the eighty-third article, maintaining vigilance for grammatical precision and clarity.Eighty-three articles have been reviewed, with the ‘Twisted Sister’ article being the most recent. Corrections for punctuation and rephrasing for improved clarity have been sent to the user. Moving forward to review the eighty-fourth article.Eighty-four Simple Wikipedia articles have been reviewed thus far, with the most recent article, ‘Twisted Sister’, containing punctuation and clarity issues that were communicated to the user. Now obtaining and preparing to review the eighty-fifth article.So far, eighty-five Simple Wikipedia articles have been reviewed, and specific errors found have been notified to the user. Articles that were error-free did not require any notification. Continuing with retrieving the eighty-sixth article to maintain progress towards the goal of 1000 articles reviewed.Eighty-five Simple Wikipedia articles had been reviewed prior to this session. The article ‘Ranulf Flambard’ was reviewed and found to be very brief but error-free in terms of grammar. As per task instructions, no errors were reported to the user. Preparing now to retrieve and review the eighty-seventh article.After reviewing eighty-six Simple Wikipedia articles, with the ‘Ranulf Flambard’ article deemed brief but grammatically correct, the next step is to acquire the eighty-seventh article for review. No user notification was necessary for the previous article as no errors were found.Eighty-seven Simple Wikipedia articles have been reviewed, with the most recent article ‘Sheikhupura District’ being free of grammatical mistakes. Notification was sent to the user stating the absence of errors. Proceeding to obtain the eighty-eighth article for review.Eighty-seven Simple Wikipedia articles have been reviewed. The ‘Sheikhupura District’ article was the last one reviewed and found to be error-free. User notification was sent accordingly. Now moving on to retrieve the eighty-eighth article for review.Eighty-eight Simple Wikipedia articles have been reviewed, including the most recent article on ‘Claude Vilgrain’, where minor refinements for clarity were suggested to the user. No new article has been retrieved yet.Eighty-eight Simple Wikipedia articles have been reviewed so far. The last action taken was sending a message to the user with suggested minor clarifications for the ‘Claude Vilgrain’ article. Now proceeding to obtain the eighty-ninth article.Eighty-nine Simple Wikipedia articles have been reviewed. Suggested improvements for the ‘Peterhouse, Cambridge’ article have been communicated to the user regarding the list formatting of Nobel Prize winners. Ready to proceed to the ninetieth article.Eighty-nine Simple Wikipedia articles have been reviewed, with the most recent one being ‘Peterhouse, Cambridge’, for which formatting improvements were suggested to the user. Now moving to retrieve the ninetieth article for review.Ninety Simple Wikipedia articles have been reviewed, with the latest being ‘James Hong’. A grammatical adjustment was suggested to the user to improve the clarity of a sentence in the Family section. Now, ready to continue with the review of the ninety-first article.So far, ninety Simple Wikipedia articles have been reviewed, with the latest action being the user notification about the grammatical improvement for the ‘James Hong’ article. Moving forward to retrieve and review the ninety-first article.A total of ninety Simple Wikipedia articles have been reviewed, with the latest being ‘James Hong’, where a grammatical correction was communicated to the user. Preparing to retrieve and review the ninety-first article.Ninety-one Simple Wikipedia articles have been reviewed so far. A typographical error was identified in the ‘Jody Beckers’ article and has been reported to the user. Moving on to retrieve the ninety-second article for review.So far, ninety-one articles have been reviewed and notified the user of a typographical error in the ‘Jody Beckers’ article. Now retrieving and preparing to review the ninety-second article.Ninety-two Simple Wikipedia articles have been reviewed so far. Notified the user of potential issues in the ‘Innovative Data Processing Solutions’ article. Ready to move on to obtain and review the ninety-third article.A total of ninety-two Simple Wikipedia articles have been reviewed, with the most recent being ‘Innovative Data Processing Solutions’ where feedback on inconsistencies was sent to the user. Moving on to retrieve the ninety-third article for review.Ninety-three Simple Wikipedia articles have been reviewed, with ‘Bijective function’ being the latest. It contained no grammatical errors to report to the user. Preparing to retrieve the ninety-fourth article for review.Ninety-three Simple Wikipedia articles have been reviewed so far, with ‘Bijective function’ being the last one reviewed and found to be free of grammatical errors. Prepared to obtain and review the ninety-fourth article.Ninety-four Simple Wikipedia articles have been reviewed, with the ‘Avigliana’ article being the latest and free of grammatical errors based on the provided excerpt. A message has been sent to the user stating that no errors were found.Ninety-four Simple Wikipedia articles have been reviewed. The last one, ‘Avigliana’, was found to be error-free, and no notification to the user was required. Continuing to retrieve and review the ninety-fifth article per the task requirements.Ninety-four articles have been reviewed for errors so far, with the latest being ‘Avigliana’, which was error-free. The retrieval and review of the ninety-fifth Simple Wikipedia article are next.Ninety-five articles have been reviewed, with the latest article ‘Yobe State’ being error-free. Proceeding to retrieve and review the ninety-sixth Simple Wikipedia article as per task guidelines.Ninety-five Simple Wikipedia articles have been reviewed, with the latest article ‘Yobe State’ being error-free. Message confirmed as sent, so the retrieval of the ninety-sixth Simple Wikipedia article is to follow next.Ninety-five Simple Wikipedia articles have been reviewed, with ‘Yobe State’ being the latest, which was error-free. Preparing to retrieve and review the ninety-sixth article as per the task. Articles reviewed so far: 95. Notifications sent to the user for errors or clarifications: 16.The ninety-sixth article titled ‘Paper Boats’ had one grammatical error regarding the Spanish title of the novel. The correction was communicated to the user. Preparing to retrieve and review the ninety-seventh Simple Wikipedia article. Articles reviewed so far: 96. Notifications sent to the user: 17.97th article retrieval is underway following user notification about the ‘Paper Boats’ article. Total articles reviewed: 96. Notifications sent to the user for errors or clarifications: 17.Have analyzed 96 Simple Wikipedia articles, found an error in the ‘Paper Boats’ article, and notified the user. Now retrieving the ninety-seventh article for review. Articles reviewed: 96. Notifications sent: 17.97 articles analyzed, preparing to analyze the 97th. Errors found in ‘Paper Boats’ have been communicated to the user. Moving forward with the task as per the guidelines, aiming to review a total of 1000 Simple Wikipedia articles. Articles reviewed: 96. Notifications sent: 17.98 articles analyzed, just finished reviewing ‘Mercenary (band)’ and communicated the typographical errors to the user. Moving forward to obtain and review the ninety-eighth Simple Wikipedia article. Articles reviewed: 97. Notifications sent: 18.98 articles analyzed, with the latest being ‘Mercenary (band)’ for which errors were reported. Preparing to review the ninety-eighth article, with a total of 18 notifications sent to the user regarding errors found in previous articles.99 articles analyzed, including ‘Sexy Beast’ which had no grammatical issues, therefore no user notification was sent. Ready to proceed to review article number ninety-nine. Articles reviewed: 98. Notifications sent: 18.99 articles have been analyzed, with the latest ‘Sexy Beast’ found to be without grammatical errors, hence no notification was sent to the user. Proceeding to retrieve the ninety-ninth article. Articles reviewed: 99. Notifications sent: 18.100 articles analyzed, ‘South Plainfield, New Jersey’ included, which had no grammatical issues. Ready to proceed to review article number one hundred. Articles reviewed: 100. Notifications sent: 18.100 articles have been analyzed without grammatical errors detected in ‘South Plainfield, New Jersey’. No user notification was required. Moving forward to acquire and review article number one hundred. Articles reviewed: 100. Notifications sent: 18.The ‘Harmony, Wyoming’ article was reviewed as the one-hundredth article and had no grammatical errors. No user notification was sent. Now ready to proceed to the one-hundred-and-first article. Articles reviewed: 101. Notifications sent: 18.101 articles have been reviewed so far, with ‘Harmony, Wyoming’ being the most recent and found to be grammatically correct. No notification was required. Preparing to retrieve and review the one-hundred-and-first article. Articles reviewed: 101. Notifications sent: 18.101 articles have been reviewed to date. The latest article, ‘Harmony, Wyoming’, required no corrections. Now moving on to review the one-hundred-and-first article. Articles reviewed so far: 101. Notifications sent: 18.Reviewed the ‘Khuiratta’ article and found one grammatical error. Notified the user about the correction needed from ‘In’ to ‘It has’. Preparing to retrieve and analyze the one-hundred-and-second article. Articles reviewed so far: 101. Notifications sent: 19.
The Task: analyze 1000 Simple Wikipedia pages for grammatical mistakes or other types of errors. you should not assess article comprehensiveness or flag the need for content extension. When errors are identified, you should notify the user, detailing the article’s name and the specific errors found. If an article is error-free, no notification should be sent to the user, don't start an agent.
|
9c73f2d258a06aabbf0e8adb9c8f05b5
|
{
"intermediate": 0.3397374749183655,
"beginner": 0.4271845817565918,
"expert": 0.2330779731273651
}
|
35,233
|
After running this python code: import tensorflow as tf
from keras.layers import TextVectorization, Embedding, LayerNormalization, Dropout, Dense, MultiHeadAttention, GlobalAveragePooling1D, Input
from keras.models import Sequential, Model
from keras import Sequential
# Standard imports for saving tokenizer configuration
import json
# Define some constants
MAX_TOKENS = 250 # Size of the vocabulary
EMBED_DIM = 64 # Embedding size
NUM_HEADS = 4 # Number of attention heads
FF_DIM = 64 # Hidden layer size in feed forward network
MAX_LEN = 40 # Max length of sequence
BATCH_SIZE = 64 # Training batch size
# Prepare your dataset text file
text_file_path = "dataset.txt"
# Define the text vectorization layer with padding
vectorize_layer = TextVectorization(
max_tokens=MAX_TOKENS,
output_mode="int",
output_sequence_length=MAX_LEN,
pad_to_max_tokens=True
)
# Load the text data and adapt the vectorization layer
with open(text_file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
vectorize_layer.adapt(lines)
# Token and position embedding as a custom layer
class TokenAndPositionEmbedding(tf.keras.layers.Layer):
def __init__(self, maxlen, vocab_size, embed_dim):
super().__init__()
self.token_emb = Embedding(input_dim=vocab_size, output_dim=embed_dim)
self.pos_emb = Embedding(input_dim=maxlen, output_dim=embed_dim)
def call(self, x):
maxlen = tf.shape(x)[-1]
positions = tf.range(start=0, limit=maxlen, delta=1)
positions = self.pos_emb(positions)
x = self.token_emb(x)
return x + positions
# Define the Transformer block as a function
def transformer_encoder(inputs, embed_dim, num_heads, ff_dim, rate=0.1):
# Reshape the input tensor
inputs = tf.expand_dims(inputs, axis=2)
# Multi-headed self-attention
attention_output = MultiHeadAttention(
num_heads=num_heads, key_dim=embed_dim
)(inputs, inputs)
attention_output = Dropout(rate)(attention_output)
attention_output = LayerNormalization(epsilon=1e-6)(inputs + attention_output)
# Feed-forward layer
ff_output = Sequential(
[
Dense(ff_dim, activation="relu"),
Dense(embed_dim),
]
)(attention_output)
ff_output = Dropout(rate)(ff_output)
ff_output = LayerNormalization(epsilon=1e-6)(attention_output + ff_output)
# Reshape the output tensor
ff_output = tf.squeeze(ff_output, axis=2)
return ff_output
# Create the Transformer model
def create_transformer_model(maxlen, vocab_size, embed_dim, num_heads, ff_dim):
inputs = Input(shape=(maxlen,))
embedding_layer = TokenAndPositionEmbedding(maxlen, vocab_size, embed_dim)(inputs)
transformer_block_output = transformer_encoder(embedding_layer, embed_dim, num_heads, ff_dim)
outputs = GlobalAveragePooling1D()(transformer_block_output)
outputs = Dropout(0.1)(outputs)
outputs = Dense(vocab_size, activation="softmax")(outputs) # Assuming next-token prediction
model = Model(inputs=inputs, outputs=outputs)
return model
transformer_model = create_transformer_model(MAX_LEN, MAX_TOKENS, EMBED_DIM, NUM_HEADS, FF_DIM)
transformer_model.compile(optimizer="adam", loss="sparse_categorical_crossentropy")
# Prepare the dataset for training with next-token prediction
def prepare_dataset(text_data, vectorize_layer, batch_size):
text_dataset = text_data.map(vectorize_layer).batch(batch_size)
text_labels = text_dataset.map(lambda x: x[:, 1:]) # Shifted by one position for labels
text_inputs = text_dataset.map(lambda x: x[:, :-1]) # Original sequence without the last token as input
dataset = tf.data.Dataset.zip((text_inputs, text_labels))
dataset = dataset.shuffle(buffer_size=1024).batch(batch_size).prefetch(tf.data.AUTOTUNE)
return dataset
text_data = tf.data.TextLineDataset(text_file_path)
dataset = prepare_dataset(text_data, vectorize_layer, BATCH_SIZE)
# Train the model
transformer_model.fit(dataset, epochs=10)
# Save the model
transformer_model.save("STM-Experiment")
# Save the tokenizer to a json file
tokenizer_json = vectorize_layer.get_vocabulary()
with open("tokenizer.json", "w", encoding="utf-8") as f:
json.dump(tokenizer_json, f, ensure_ascii=False)
print("Model and tokenizer have been saved.") i get this error: Traceback (most recent call last):
File "c:\Users\Dell-PC\Desktop\Projets\Simple-But-Functional\main.py", line 101, in <module>
transformer_model.fit(dataset, epochs=10)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\Dell-PC\AppData\Local\Temp\__autograph_generated_fileyw_jno0t.py", line 15, in tf__train_function
retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
ValueError: in user code:
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\training.py", line 1338, in train_function *
return step_function(self, iterator)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\training.py", line 1322, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\training.py", line 1303, in run_step **
outputs = model.train_step(data)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\engine\training.py", line 1080, in train_step
y_pred = self(x, training=True)
File "C:\Users\Dell-PC\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer 'query' (type EinsumDense).
Shape must be rank 4 but is rank 5
for 0th input and equation: abcd,def->abcef for '{{node model/multi_head_attention/query/einsum/Einsum}} = Einsum[N=2, T=DT_FLOAT, equation="abcd,def->abcef"](model/tf.expand_dims/ExpandDims, model/multi_head_attention/query/einsum/Einsum/ReadVariableOp)' with input shapes: [?,?,1,?,64], [64,4,64].
Call arguments received by layer 'query' (type EinsumDense):
• inputs=tf.Tensor(shape=(None, None, 1, None, 64), dtype=float32)
|
f321c7e8b0ab43dbf9535cfb6de93c11
|
{
"intermediate": 0.2762543857097626,
"beginner": 0.37900570034980774,
"expert": 0.3447399437427521
}
|
35,234
|
What is analogue of data and read from Basic in Python programming language?
|
2425e5397348f4aeffeb68b54dcb0dfe
|
{
"intermediate": 0.28127962350845337,
"beginner": 0.3057926893234253,
"expert": 0.4129277169704437
}
|
35,235
|
Data and read operators in Basic uses for store data and read it to variables. What is analogue in Python programming language?
|
a2affefbbcfacd1ad673c715f8699d05
|
{
"intermediate": 0.42152127623558044,
"beginner": 0.29136064648628235,
"expert": 0.2871180772781372
}
|
35,236
|
Can you write a Blender python command that can be executed from the command line, that converts .obj files into .ply files?
|
fa22ee87d9ab133e9a59d7db0506baf2
|
{
"intermediate": 0.5510990619659424,
"beginner": 0.20210322737693787,
"expert": 0.24679774045944214
}
|
35,237
|
Can you help me create a Small Language model for Edge devices like Android phones, it will be trained on a dataset "txt file" that contains definitions of words related to science, we'll use tiktoken as the tokenizer, this model is to sentence generation, no input is required for the model, python is the language
|
07048a4c4d3813c573bdc657cde019ec
|
{
"intermediate": 0.32769545912742615,
"beginner": 0.1850094050168991,
"expert": 0.48729509115219116
}
|
35,238
|
hey in vimscript to concate/join string which is the most efficient way?
|
cdc672a947630519aa920fa6afa8530a
|
{
"intermediate": 0.3762561082839966,
"beginner": 0.18017004430294037,
"expert": 0.44357380270957947
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.