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.

How do i get rid of duplicate images that have only slight variation?

11 May 2026 @ 11:35 pm

Im following this ARG i found recently called neiz or whatever, their most recent video features a grid of pixels that a friend helped me sorta isolate in video editing software. It changes twice every second, and while he tried to lower the fps and reduce the amnt of images, the base number is still around 2k, here are two grids and a duplicate of each; 1 2 3 4 i wanted to only isolate the unique grids and discard ones that repeat my first attempt at this was trying to isolate the colors and calculating a difference that way.. but it seems that's still too lenient as i get a lot of duplicates still COLORS_AS_RGB = { 'red': np.array([255, 22, 1

GTM (go to market) Engineers

11 May 2026 @ 11:17 pm

With GTM Engineering being a relatively new and evolving skill set, what types of roles have the strongest candidates typically come from historically? For example, are you seeing more successful profiles transition from Software Engineering, Revenue Operations, Sales Engineering, Growth Engineering, Data Engineering, Marketing Operations, or other adjacent backgrounds?

Keep unique pairs of values from two vectors in numpy

11 May 2026 @ 11:04 pm

Suppose I have two integer numpy vectors a0 and a1 of the same length. I want to return unique pairs of elements of a0 and a1. For instance: a0 = np.asarray([0, 1, 4, 1, 0, 4]) # --> b0 = np.asarray([0, 1, 4, 4]) a1 = np.asarray([0, 2, 3, 2, 0, 2]) # --> b1 = np.asarray([0, 2, 3, 2]) What is the most concise way to do this in numpy?

Livewire tries to load views with unparsed PHP code as file name

11 May 2026 @ 11:03 pm

I have a Laravel project (Laravel 12.58, Livewire 4.3) hosted on a Windows IIS server managed with Plesk. The project is deployed with Plesk’s Laravel Toolkit into a subdomain on the server; it has worked fine up until today. Today, I was messing around with some attempts to do something across multiple (sub)domains on the server,¹ and somewhere along the way, something I did managed to mess up this project – I don’t know what did it. I’ve undone everything I tried out earlier, and I’ve even done a fresh deployment with no luck. The project works fine if there are only pure Laravel views on the requested page. The problem appears when there are Livewire components on the page. Livewire seemingly attempts to load any view not by referring to its actual file name, but by lines 1

Can multiprocessing pool's workers start working immediately?

11 May 2026 @ 10:56 pm

Our main process loads some gigabytes of input data, then launches (forks) a bunch of workers to process different pieces of it. The last worker of the bunch is launched considerably later than the first one, but none of them start working until all are launched. This not only wastes time, but also creates unwelcome synchronization. Is there any way to make each worker start running immediately upon being forked, without waiting for the pool to finish forking all its siblings? Using python-3.13 on Linux...

ERROR InvalidDistribution: Invalid distribution metadata: '2.5' is not a valid metadata version

11 May 2026 @ 10:54 pm

twine utility (v6.2) for interacting with PyPI gives this error when uploading a wheel: $ twine --version twine version 6.2.0 (keyring: 25.7.0, packaging: 26.2, requests: 2.34.0, requests-toolbelt: 1.0.0, urllib3: 2.7.0, id: 1.6.1) $ twine upload meowpkg-0.1-py2.py3-none-any.whl Uploading distributions to https://upload.pypi.org/legacy/ ERROR InvalidDistribution: Invalid distribution metadata: '2.5' is not a valid metadata version The wheel (.zip) has the files shown below meowpkg-0.1-py2.py3-none-any.whl └── meowpkg-0.1.dist-info ├── METADATA ├── RECORD └── WHEEL dist-info contents: $ cat METADATA Metadata-Version: 2.5 Name: meowpkg Version: 0.1 Import-Name: $ cat RECORD meowpkg-0.1.dist-info/METADATA,sha256=VkjlIuVod8UShkZwydWzpGXsIiLeP-FWnhDZmUlVshg,63 meowpkg-0.1.dist-info/WHEEL,sha256=vwhs3Rbpi5CZJZl6V8jUp0Am3eZXbojfqs5Rr4FGqBQ,98 meowpkg-0.1.dist-info/RECORD

How to pass a custom Parcelable object in Jetpack Compose Type-Safe Navigation (Navigation 2.8.0+)?

11 May 2026 @ 10:07 pm

With the release of Jetpack Compose Navigation 2.8.0, we can now navigate using type-safe objects (`@Serializable` data classes) instead of route strings. However, if my route data class contains a custom `Parcelable` object, the navigation component doesn't know how to handle it by default. For example, I have a sealed class for my routes: @Serializable sealed class Route { @Serializable data class DetailsScreen(val userData: UserData) : Route() } Where `UserData` is a `@Parcelize` class. How do I define and register a custom `NavType` for this `Parcelable` object so I can pass it safely in the new Compose navigation graph?

Is this a proper way to implement "chance" in randomness?

11 May 2026 @ 9:49 pm

The "chance" is implemented by taking the output of a PRNG, then taking the remainder of a division (in most programming languages this operation is represented with the symbol '%') and checking whether the result is less than the desired percentage. For example a 20% chance would be represented as: [PRNG output]%100 + 1 if < 20 (do something) else (don't do anything)

C loop branch optimization

11 May 2026 @ 9:43 pm

I've done recently some read of Agner Fog's optimization manuals, and he has an interesting example, how to eliminate a branching if inside a loop by bitmasking then move it to AVX registers. I was curious what impact it could have removing the AVX and just eliminate the if at all so I did this toy example (the fluff code was removed for simplicity): //my toy example void SelectAddMul2(int aa[], int bb[], int cc[], int sz) { int m ; for(int i=0; i < sz; i++) { m = (bb[i] ^ bb[i]-1) >> 1; int m1 = (cc[i] + 2) & ~m; int m2 = (bb[i] * cc[i]) & m; aa[i] = (m1 | m2); } } //agner fog example original void SelectAddMul(int aa[], int bb[], int cc[], int sz) { for (int i=0; i < sz; i++){ aa[i] = (bb[i] > 0) ? (cc[i] + 2) : (bb[i] * cc[i]); } } so I will skip the boring part with validity (I've tested with same data both functions so the result is identical), however when

Writing bytes directly to a drive without a file system?

11 May 2026 @ 7:59 pm

I'm trying to write over a section of my W drive at a certain offset with a custom array of bytes, like an automated hex editor of sorts. So far I have this: try { URI uri = new URI("file:///W:/"); FileChannel channel = FileChannel.open(Path.of(uri), StandardOpenOption.READ, StandardOpenOption.WRITE); MappedByteBuffer buff = channel.map(FileChannel.MapMode.READ_WRITE, 4206944, 6); byte[] write = new byte[] {0x2F, 0x10, 0x50, 0xDA, 0x00, 0x10}; buff.put(write); buff.force(); } catch (IOException e) { throw new RuntimeException(e); } catch (URISyntaxException e) { throw new RuntimeException(e); } When I run this code, I get "java.nio.file.NoSuchFileException: W:\" on the line instantiating the FileChannel, presumably because the W drive isn't actually a file. Is there a way to manipulate the drive as if all