Skip to content

Instantly share code, notes, and snippets.

namespace System.Runtime.Serialization.Json;
using System;
using System.Xml;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public sealed class JsonNode :IEnumerable<JsonNode>
@Aetopia
Aetopia / Json.cs
Created August 25, 2024 12:04
A simple wrapper class that wraps all .NET Framework JSON serializers.
#pragma warning disable IDE0130
namespace System.Runtime.Serialization.Json;
#pragma warning restore IDE0130
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Linq;
using System.Xml.Linq;
@Aetopia
Aetopia / Particle-Disabler.ps1
Last active August 17, 2024 15:01
Particle Disabler: A dynamically generated resource pack that removes all vanilla particles for Minecraft: Bedrock Edition.
Add-Type -AssemblyName System.IO.Compression.FileSystem
function _($Path) { return [System.Text.RegularExpressions.Regex]::Replace([System.IO.File]::ReadAllText($Path), "//.*?$|/\*[\s\S]*?\*/", "", [System.Text.RegularExpressions.RegexOptions]::Multiline) | ConvertFrom-Json }
if ($Package = (Get-AppxPackage | Where-Object { $_.PackageFamilyName -eq "Microsoft.MinecraftUWP_8wekyb3d8bbwe" }) ) {
Remove-Item "$ENV:TEMP\Particle Disabler" -Recurse -Force -ErrorAction SilentlyContinue
[System.IO.Directory]::CreateDirectory("$ENV:TEMP\Particle Disabler\particles") | Out-Null
$MaxEngineVersion = [System.Version]::new()
(Get-ChildItem "$($Package.InstallLocation)\data\resource_packs\*\manifest.json" -Recurse).FullName | ForEach-Object {
@Aetopia
Aetopia / WinMain.c
Created August 9, 2024 06:09
COM Inheritance in C Win32.
#include <initguid.h>
#include <windows.h>
#include <shobjidl.h>
void $(const char *format, ...)
{
va_list ArgList = NULL;
va_start(ArgList, format);
CHAR szOutput[1025] = {};
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), szOutput, wvsprintfA(szOutput, format, ArgList), NULL, NULL);
@Aetopia
Aetopia / PLMBypass.cmd
Created June 18, 2024 06:15
Bypass Process Lifecycle Manager.
<# ::
@echo off
powershell -c "iex (gc -Raw '%~f0')"
goto :eof
#>
$Names = @()
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public static class PackageDebugSettings
@Aetopia
Aetopia / PrintFormatA.c
Created April 2, 2024 09:22
CRTless printf implementation Win32
#define printf PrintFormatA
DWORD PrintFormatA(LPCSTR lpFormat, ...)
{
va_list ArgList = NULL;
va_start(ArgList, lpFormat);
CHAR szOutput[1024] = {};
DWORD nNumberOfBytesToWrite = wvsprintfA(szOutput, lpFormat, ArgList);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), szOutput, nNumberOfBytesToWrite, NULL, NULL);
va_end(ArgList);
return nNumberOfBytesToWrite;
@Aetopia
Aetopia / Build.cmd
Created March 15, 2024 10:39
NoSteamWebHelper
@echo off
cd "%~dp0"
gcc -municode -mwindows -nostdlib -Os -s WinMain.c -lUser32 -lKernel32 -lShell32 -o NoSteamWebHelper.exe
upx --best --ultra-brute NoSteamWebHelper.exe>nul 2>&1
@Aetopia
Aetopia / DisplayConfig.c
Created February 19, 2024 09:14
Simple command line app to switch display modes on Windows via a CLI.
#include <windows.h>
LONG DisplayConfigSetDisplayMode(DISPLAYCONFIG_PATH_INFO *pPath, PDEVMODEW pDevMode, DWORD dwFlags)
{
DISPLAYCONFIG_SOURCE_DEVICE_NAME dcSourceDeviceName = {.header = {.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME,
.size = sizeof(DISPLAYCONFIG_SOURCE_DEVICE_NAME),
.adapterId = pPath->sourceInfo.adapterId,
.id = pPath->sourceInfo.id}};
DisplayConfigGetDeviceInfo(&dcSourceDeviceName.header);
@Aetopia
Aetopia / ITaskbarList2_MarkFullscreenWindow.c
Created January 9, 2024 17:41
MarkFullscreenWindow, 2 implementations.
BOOL MarkWindowFullscreen(HWND hWnd, BOOL fFullscreen)
{
ITaskbarList2 *pTaskbarList2 = NULL;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList2, (LPVOID *)&pTaskbarList2);
pTaskbarList2->lpVtbl->HrInit(pTaskbarList2);
HRESULT hr = pTaskbarList2->lpVtbl->MarkFullscreenWindow(pTaskbarList2, GetConsoleWindow(), TRUE);
pTaskbarList2->lpVtbl->Release(pTaskbarList2);
@Aetopia
Aetopia / Cargo.toml
Last active December 5, 2023 10:49
Get the most performant graphics adapter name as well as the currently installed CPU name using Rust.
[dependencies.windows]
version = "0.52"
features = ["Win32_Foundation", "Win32_Graphics_Dxgi", "Win32_Graphics_Dxgi_Common"]
[dependencies.windows-sys]
version = "0.52"
features = ["Win32_Foundation", "Win32_Devices_DeviceAndDriverInstallation"]