Skip to content

Instantly share code, notes, and snippets.

@BarelyAliveMau5
BarelyAliveMau5 / readme.md
Last active March 14, 2024 09:42
How to attach unity profiler to existing WebGL builds on Windows 11

Attaching the Unity profiler to WebGL builds on Windows 11

One of the biggest pains in Unity when developing for WebGL is that if you want to profile it, you have to use the "Build and Run" menu option to do it, while it works, it can be very inconvenient and waste a lot of time recompiling everything, in this brief tutorial I present a way of attaching the profiler without having to recompile everything.

Click here to see the TL;DR (Too long; Didn't Read™) step-by-step if you are not patient enough to read everything

Note: This entire procedure was only tested with Unity 2021.3.29f1. The procedure might be the same in newer versions, but in case it's not, refer below for how I discovered it for this version.

As of 2023-09-28, the Unity documentation states:

@BarelyAliveMau5
BarelyAliveMau5 / userscript.js
Last active September 28, 2023 12:17
Custom userscript for a specific game that I can't name publicly (the "match" param has a sha256 of the matching website)
// ==UserScript==
// @name ZoomControl
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Use mouse wheel to adjust the viewport zoom
// @author BarelyAliveMau5
// @match https://5891d91f6481d61777db401c5b7861d0e6ad4d67356fcbd61d83b00131d6a814
// @icon https://5891d91f6481d61777db401c5b7861d0e6ad4d67356fcbd61d83b00131d6a814/static/img/icon64.png
// @grant none
// ==/UserScript==
@BarelyAliveMau5
BarelyAliveMau5 / WebSocketServer.cs
Last active March 16, 2022 17:54 — forked from wildbook/WebSocketServer.cs
Very simple websocket server in C#, adapted to work in powershell 5.0 (C# 5.0 syntax)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
@BarelyAliveMau5
BarelyAliveMau5 / ad_onpremise_lockout_mechanism.md
Created January 17, 2022 18:01
Adding lockout mechanism in active directory in windows server 2019

Step 1

1

Step 2

2

Step 3

3

Step 4

4

@BarelyAliveMau5
BarelyAliveMau5 / disableUnsafeCiphers.ps1
Last active January 17, 2022 14:44
This script can be used to disable unsafe ciphers as of 2022-01-17 - made for Windows Server 2016.
#Requires -RunAsAdministrator
#Requires -Version 5
# refer to: https://docs.microsoft.com/en-us/answers/questions/166697/disable-weak-cipher-suits-with-windows-server-2016.html
# archived version: https://web.archive.org/web/20220117144405/https://docs.microsoft.com/en-us/answers/questions/166697/disable-weak-cipher-suits-with-windows-server-2016.html
@("TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_RSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_AES_128_GCM_SHA256",
@BarelyAliveMau5
BarelyAliveMau5 / docker_winserver2016_vm_virtualbox.md
Last active June 24, 2021 23:54
Installing docker with container isolation in a Windows Server 2016 VM running inside VirtualBox 6.1

One of the requirements to use Docker in Windows with Container Isolation is to enable Hyper-V, this is specified in the official documentation of Microsoft. (Click here if the link is dead).

If you search a lot in the internet, you'll probably find references to "Hyper-V must be enabled in the host machine", however, you might also notice that VirtualBox had a hard time integrating with Hyper-V in the past few years, i tried it myself and lost 2 days trying to figure out why i was getting blue screens all the time. As it turns out, virtualbox 6.1 was STILL having issues with Hyper-V in the host machine, so i had to turn it off in order to use my other VMs.

So i could not enable Hyper-V in the machine running Virtual

@BarelyAliveMau5
BarelyAliveMau5 / godot_decent_resize.gd
Last active February 4, 2024 20:43
Godot Engine - Screen content resizing without black-bars, nor distortions, nor content reveal
# What is this?
# This is my sample script used for a decent screen stretching mode in Godot. As
# of Godot 3.1 alpha, there are no good ways to resize the game screen without
# stretching it (thus making the image weird if you stretch it too much), or
# creating black bars on the screen borders (looks awful in my opinion), or
# letting the player see something not supposed to be seen (in this case,
# instead of showing the black bar, it zooms out)
#
# What it does?
# Basically, it doesn't let the player see anything beyond the specified
@BarelyAliveMau5
BarelyAliveMau5 / modified_utf8.py
Last active August 23, 2023 17:58
python's version of java's modified utf8
# translated from: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/94cc251d0c45/src/share/npt/utf.c
def utf8s_to_utf8m(string):
"""
:param string: utf8 encoded string
:return: modified utf8 encoded string
"""
new_str = []
i = 0
while i < len(string):