Skip to content

Instantly share code, notes, and snippets.

View Pixelsuft's full-sized avatar
:octocat:

pixelsuft‮ Pixelsuft

:octocat:
View GitHub Profile
@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active April 28, 2025 19:10
Visual C/C++ CRT functionality
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
@mdonkers
mdonkers / server.py
Last active April 4, 2025 13:11
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@psqq
psqq / main.cpp
Last active September 15, 2024 04:07
Simple SDL_net example
#include <SDL.h>
#include <SDL_net.h>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
if (SDL_Init(0) == -1) {
printf("SDL_Init: %s\n", SDL_GetError());
@probonopd
probonopd / Wayland.md
Last active May 13, 2025 23:44
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.


As 2024 is winding down:

@Pixelsuft
Pixelsuft / unsplitter.py
Created September 27, 2021 09:04
Unity assents unsplitter
'''
MIT License
Copyright (c) 2021 Pixelsuft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Pixelsuft
Pixelsuft / pip_hooker.py
Last active September 29, 2021 09:28
Running pip without creating process
'''
MIT License
Copyright (c) 2021 Pixelsuft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@Pixelsuft
Pixelsuft / backward_midi.py
Created October 12, 2021 10:29
MIDI Backward
from mido import MidiFile
fn = input('Enter file name: ').replace('"', '')
ext = fn.split('.')[-1].strip()
no_ext = '.'.join(fn.split('.')[:-1])
cv1 = MidiFile(fn, clip=True)
@StanislavPetrovV
StanislavPetrovV / voxel_starfield.py
Last active January 20, 2024 15:24
VoxelStarfield
import pygame as pg
import random
import math
vec2, vec3 = pg.math.Vector2, pg.math.Vector3
RES = WIDTH, HEIGHT = 1600, 900
NUM_STARS = 1500
CENTER = vec2(WIDTH // 2, HEIGHT // 2)
COLORS = 'red green blue orange purple cyan'.split()
@rounk-ctrl
rounk-ctrl / Dark.md
Last active May 13, 2025 22:51
Win32 Dark Mode

Dark Mode APIs.

API Signatures.

ShouldAppsUseDarkMode()

Checks whether system is using dark mode or not.
Signature:

using fnShouldAppsUseDarkMode = bool (WINAPI*)(); // ordinal 132

AllowDarkModeForWindow(In HWND hWnd, In bool allow)