Skip to content

Instantly share code, notes, and snippets.

@JohannesMP
JohannesMP / ConvertBase.hpp
Last active September 14, 2022 02:14
Converting a number from one base to another in C++
// NOTE: For the sake of practice, STL/stdlib helpers are not used, just std::string for memory management.
#include <string>
using std::string;
// Convert arbitrary base to base 10
// - Input must be valid number in the given base
// - Base must be between 2 and 36
// - If input or base are invalid, returns 0
long ConvertTo10(const string& input, int base)
@JohannesMP
JohannesMP / Windows10RegistryHacks.md
Last active September 13, 2022 03:40
A small collection of Registry hacks for Windows 10 installations

Note: for any folder not found, navigate as far as possible, then create as a new Key

Disable Downloads like Candy Crush, etc.

  • HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CloudContent
  • Dword DisableWindowsConsumerFeatures set to 1

Disable Lock screen, just show login form

@JohannesMP
JohannesMP / README.md
Last active December 12, 2021 23:29
Improving Photoshop Wacom Tablet Performance in Windows 10

Here are changes you can make that can greatly improve the responsiveness of Wacom Tablets on Windows 10.

NOTE: This guide was written for Photoshop CC (21.2.1) but most changes should apply to all versions of Photoshop.


Photoshop Settings Changes

These are changes in Photoshop itself. To be sure, restart Photoshop after applying these.

@JohannesMP
JohannesMP / InspectorButtonsTest.cs
Created July 31, 2018 05:33 — forked from LotteMakesStuff/InspectorButtonsTest.cs
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;
@JohannesMP
JohannesMP / EventProxyContainer.cs
Last active April 15, 2020 12:03
Proxying an Action<T> event as Action<object> and Action in C#
using System;
using System.Collections.Generic;
public struct EventHandlerProxy<T>
{
private struct HandlerProxy
{
public Action<T> proxy;
public int count;
}
@JohannesMP
JohannesMP / FileStreamReadLineExtension.cs
Last active November 7, 2019 12:40
A ReadLine extension for FileStream objects
using System.IO;
using System.Collections.Generic;
public static class FileStreamReadLineExtension
{
public static string ReadLine(this FileStream fs)
{
int curChar;
// EOF - return null
if ((curChar = fs.ReadByte()) == -1)
@JohannesMP
JohannesMP / EditorCoroutineRunner.cs
Created July 31, 2018 05:32 — forked from LotteMakesStuff/EditorCoroutineRunner.cs
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
solution "SDL2_Test"
configurations { "debug", "release" }
location("make/" .. os.get() .. "/")
targetdir("bin/" .. os.get() .. "/%{cfg.buildcfg}/")
objdir("obj/" .. os.get() .. "/%{cfg.buildcfg}/")
project "sdl2_test"
kind "WindowedApp"
language "C"
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Testing
{
/// <summary>
@JohannesMP
JohannesMP / EditorExtensionMethods.cs
Created July 31, 2018 05:24 — forked from LotteMakesStuff/EditorExtensionMethods.cs
A reimplementation of the logic in the Unity Editor that draws an inspector for a component. We can use this to learn how unity actually draws the inspector. for more info see https://www.patreon.com/posts/16724128
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
public static class EditorExtensionMethods
{
// Public reimplmentation of extention methods and helpers that are marked internal in UnityEditor.dll