Skip to content

Instantly share code, notes, and snippets.

View PJB3005's full-sized avatar
🤔
Wondering why anybody would use these status messages.

Pieter-Jan Briers PJB3005

🤔
Wondering why anybody would use these status messages.
View GitHub Profile
@PJB3005
PJB3005 / main.c
Created November 25, 2023 21:17
VirtualAlloc2 funnies
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdio.h>
#define SIZE (32ull * 1024 * 1024 * 1024)
#define BLOCKS (32 * 32)
#define BLOCK_SIZE (SIZE / BLOCKS)
#define PAGE_SIZE (4096)
void print_error(char* area, DWORD error);
@PJB3005
PJB3005 / noVNCPasteAsKeyboard.user.js
Last active April 21, 2023 12:09 — forked from amunchet/noVNCCopyPasteProxmox.user.js
noVNC Paste as keyboard
// ==UserScript==
// @name noVNC Paste as keyboard
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Pastes text into a noVNC window by typing key binds. Useful if you need to dump an SSH public key into a system over only VNC or something. Paste the text to be pasted into NoVNC's clipboard window, then activate the script paste button
// @author Chester Enright, Pieter-Jan Briers
// @match https://console.cp4staging.be/*
// @match https://console.level27.eu/*
// @grant GM_registerMenuCommand
// @grant GM_log
// For various practical reasons,
// you *can only* have the union type contain fields of the struct itself.
// i.e. you can't deconstruct the field structs into their component fields.
// Consider a union of these two types:
[StructLayout(LayoutKind.Explicit)]
public struct A
{
// NOTE: while structs in C# default to being emitted as LayoutKind.Sequential,
// CoreCLR actually *ignores* sequential layout if the type has managed references inside it.
@PJB3005
PJB3005 / FormatHelpers.cs
Created June 7, 2022 11:50
Broken string interpolation handler analysis in Rider
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Text;
namespace Robust.Shared.Utility;
/// <summary>
/// Helpers for dealing with string formatting and related things.
/// </summary>
@PJB3005
PJB3005 / rw_modding_deck.md
Last active September 19, 2023 09:07
Rain World Steam Deck Modding

Quick guide to setting up Rain World mods on the Steam Deck, with Realm as mod loader. I recommend using Realm instead of BOI because Realm is completely ran through the game, no need to run BOI through Wine to install mods etc...

(this probably applies to Linux in general not specifically Steam Deck)

  1. Install Rain World on your Deck (duh), launch it once
  2. Go to desktop mode
  3. Install protontricks if you don't have it yet.
  4. protontricks 312520 win7 to set the wineprefix to windows 7, otherwise SSL things like CRS/Realm break
  5. protontricks 312520 winecfg to enable library override for winhttp, so that Doorstop loads:
  • If the winecfg window doesn't open on some weird error re-install the game and start from zero, happened to me
@PJB3005
PJB3005 / linux_sucks.md
Last active November 16, 2024 11:53
Summary of all problems I have with the Linux Desktop

Linux Desktop Issues

This is basically my manifesto of why Linux sucks and I keep using Windows as a desktop OS. This is both as a developer platform and end-user targeting.

Look: I would love to be able to use Linux as a daily driver. KDE is amazing and they clearly put far more effort into the desktop experience/UI than Windows (just the volume mixer alone). There are simply far too many underlying and infrastructural problems to the Linux desktop that none of KDE's great UI changes can make up for. I want Linux fanboys, developers, etc... to stop sticking their damn head in the sand about these issues and admit that Linux is still decades behind in some basic infrastructure. This shit can't get fixed if people refuse to admit it's broken in the first place, which some people are far too happy to do.

Desktop App Experience & Developer Tools

Windows has far better desktop apps than Linux, and thanks to WSL, I have all the CLI apps of Linux too. While I do believe KDE Plasma is a much better desk

#include <windows.h>
#include <stdio.h>
void PrintErr(LPCWSTR func)
{
DWORD code = GetLastError();
LPWSTR errorText;
FormatMessageW(
FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER
@PJB3005
PJB3005 / aoc_2021_1.ntsl
Created December 2, 2021 10:48
Advent Of Core 2021 Day 1 NTSL
if (substr($content, 1, 6) == "!load")
{
$lenContent = length($content);
$dataString = substr($content, 6, $lenContent+1);
$data = explode($dataString, ",");
mem("data", $data);
mem("i", 1);
mem("last", 10000);
mem("count", 0);
@PJB3005
PJB3005 / Cargo.toml
Created August 19, 2020 14:12
DM Recipe export to JSON
[package]
name = "dm-recipe-export"
version = "0.1.0"
authors = ["Pieter-Jan Briers <[email protected]>"]
edition = "2018"
[dependencies]
dreammaker = { path = "/home/pj/Projects/SpacemanDMM/src/dreammaker/" }
serde_json = "1.0.52"
serde = "1.0.107"
#!/usr/bin/env python3
import sys
import re
# Maybe unhardcode this.
KEY_SIZE = 3
MAP_LOC_HEADER = re.compile(r"\(1,1,[0-9]\) = {\"")
DEF_RE = re.compile(rf"\"([a-zA-Z]{{" + str(KEY_SIZE) + r"})\" = \((.*)\)")
print(DEF_RE)