StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

Playwright giving me hard time running a browser on existing chrome profile

4 April 2026 @ 4:28 am

I have been browsing through web, debugging with llms but not able to resolve this simple thing. Here's my code: // @ts-check import { chromium, test } from '@playwright/test'; import { rmSync } from 'fs'; import os from 'os'; import path from 'path'; test('open gemini with existing chrome profile', async () => { const userDataDir = path.join( os.homedir(), 'AppData', 'Local', 'Google', 'Chrome', 'User Data' ); // Remove stale lock/session files that can cause launchPersistentContext to timeout for (const file of ['SingletonLock', 'SingletonCookie', 'SingletonSocket']) { try { rmSync(path.join(userDataDir, file), { force: true }); } catch { } } const context = await chromium.launchPersistentContext(userDataDir, { channel: 'chrome', headless: false, args: ['--profile-directory=Profile 2'], }); const page = context.pages().at(0) ?? (await context.newPage()); await page.goto('https://gemini.google.co

Aimbot C# AssaultCube Hack

4 April 2026 @ 4:15 am

My aimbot is locking onto the enemy incorrectly and sometimes gets stuck aiming at a wall instead of the target. I think my angle calculation or target selection might be wrong, but I’m not sure what exactly is causing this issue. Can someone help me understand why the aim locks to walls and how I can fix it? static void Aimbot(IntPtr localPlayer, IntPtr entityList) { float myX = Mem.ReadFloat(localPlayer + Offset.Pos_X); float myY = Mem.ReadFloat(localPlayer + Offset.Pos_Y); float myZ = Mem.ReadFloat(localPlayer + Offset.Pos_Z); IntPtr closest = IntPtr.Zero; float closestDistance = float.MaxValue; for (int i = 0; i <=32; i++) { IntPtr entity = Mem.ReadPointer(entityList + i * 0x4); if (entity == IntPtr.Zero) continue; if (entity == localPlayer) continue;

Getting weird results from java string codepoints on a windows machine

4 April 2026 @ 4:09 am

I wrote this method: public String unicodePrint(String input) { if (input != null && !input.isEmpty()) { StringBuilder sbTitle = new StringBuilder(); System.err.println(input); // 挑战 final int length = input.length(); for (int offset = 0; offset < length;) { final int codepoint = input.codePointAt(offset); if (codepoint > 127) { sbTitle.append(htlmDelim + codepoint); } else { sbTitle.appendCodePoint(codepoint); } offset += Character.charCount(codepoint); } input = sbTitle.toString(); System.err.println(input); // &#230&#338&#8216&#230&#710&#732 } return input; } and I also tried this variation: for (int i = 0; i < input.length(); i++) { int codepoint = input.codePointAt(i); if (codepoint > 127) { sbTi

LM bot - connections stall after 3-5 minutes with 32+ bots despite identical protocol to working reference bot

4 April 2026 @ 3:46 am

I'm building a C# network client that maintains 32 concurrent TCP connections through SOCKS5 proxies to a game server. Each connection sends a small request (49 bytes) every 3.5 seconds and receives responses (1-2KB). With 1-8 connections, everything works indefinitely. With 32 connections, the server stops responding to ~20 of them after 3-5 minutes while heartbeat responses continue on the same TCP connections. I have a reference application (obfuscated .NET 9) that runs 64 connections with zero stalls. I've used Harmony hooks to confirm the wire protocol is byte-identical, and the socket options are identical: NoDelay=true, Blocking=false, SendTimeout=0, ReceiveTimeout=0, LingerState(false,0). The reference app uses synchronous Socket.Send() and async Socket.ReceiveAsync() — I've matched this exactly. The stall pattern is time-based: at 3.5s request interval it happens at cycle 3 (~5min), at 7s interval it happens at cycle 2 (~7min). dotnet-counters during the sta

Genymotion Android emulator stuck on boot screen and updates not working (VirtualBox, Windows 11)

4 April 2026 @ 3:30 am

I'm trying to run an Android emulator using Genymotion on Windows 11 with VirtualBox. The emulator starts, but it gets stuck on the “Android” boot screen for a long time and sometimes does not load properly. In some cases it opens, but system updates/apps are not working. What I have tried: Installed VirtualBox successfully Disabled Hyper-V using bcdedit /set hypervisorlaunchtype off Tried different devices (Samsung Galaxy A14 and Galaxy S4) Reinstalled Genymotion I'm still facing: Slow boot or stuck on boot screen Updates not working inside emulator System details: OS: Windows 11 Using VirtualBox (latest version) Genymotion desktop Memory: 12.0GB RAM Processor: AMD Ryzen 5 7235HS How can I fix this issue and make t

Why does removing elements from a list in a for loop in Python skip values?

4 April 2026 @ 3:16 am

I'm new to Python and I'm trying to write a script that removes all even numbers from a list. My logic was to loop through the list and, if a number is divisible by 2, remove it. Here is my code: numbers = [1, 2, 4, 5, 6, 8, 9] for num in numbers: if num % 2 == 0: numbers.remove(num) print(numbers) # Ожидаемый результат: [1, 5, 9] Problem: Instead of the expected [1, 5, 9], I get [1, 4, 5, 8, 9]. For some reason, the program "skips" some numbers (for example, 4 and 8), even though they are clearly even. What I've tried: I tested the if num % 2 == 0: condition separately; it works correctly. I noticed that if the list doesn't contain any consecutive even numbers, the code sometimes works, but I'm not sure. Can you please tell me why the iteration is behaving so strangely and how to properly remove elements from the list without crashing the loop? Thanks in advance!

How to direct calculate the range of a float in C?

4 April 2026 @ 3:00 am

I'm doing trying to solve the exercise 2.1 of K&R 2nd. I have already calculated the range of signed/unsigned char, short, int and long, mainly because two's complement is easy to get but IEEE754 is not. void short_range() { unsigned short next = us_max; for (; next != 0; next *= 2) us_max = next; signed short ss_min = -us_max; signed short ss_max = us_max - 1; us_max = us_max + (us_max - 1); ui_max = us_max + 1; printf("signed short range (%d, %d)\n", ss_min, ss_max); printf("unsigned short range (0, %u)\n", us_max); } void int_range() { unsigned int next = ui_max; for (; next != 0; next *= 2) ui_max = next; signed int si_min = -ui_max; signed int si_max = ui_max - 1; ui_max = ui_max + (ui_max - 1); // I kinda don't get why I have to cast `ui_max` only here and not on the past // functions but basically if I don't, `ui_max` wrapps to 0 screwing things // for `l

How do I measure text in Pango?

4 April 2026 @ 1:32 am

From a given text, its length, a PangoContext, a PangoFontFace, and a font size, I need to measure the text's logical width and height, including trailing whitespace. This should be dead simple, but it's been two hours and I still can't find the correct string of methods.

How do I make it so that the user only enters numbers in Console.ReadLine?

4 April 2026 @ 1:23 am

I'm studying C# and I have a question. How can I make it so that the user only enters numbers in Console.ReadLine()? Because if they enter numbers or letters in reversed fields, the code breaks... decimal Valor = Convert.ToDecimal(Console.ReadLine());

SFML and C++ problem, 2D objects shadow falls in the direction it is moving

4 April 2026 @ 1:12 am

I am struggling with a shadow that appears in front of an object is moving. I use SFML/Graphics.hpp to create the object. You can move the object using the WASD keys. I don't have any idea how to solve it. I tried change speed, it worked, but object has less speed and also the shadow was there still. I tried round object's coordinates, it didn't work. I guess maybe it is monitor, he can not change between colours as object change it's position? I am attending the code in C++: #include <SFML/Window.hpp> #include <SFML/Graphics.hpp> #include <iostream> #include <conio.h> using namespace std; using namespace sf; void main() { RenderWindow window(VideoMode::getDesktopMode(), "slova", Style::Resize | Style::Close); CircleShape rectangle(50.f); rectangle.setFillColor(Color(0, 150, 150)); rectangle.setPosition({200.f,100.f}); auto WindowHandle = window.getNativeH