Skip to content

Instantly share code, notes, and snippets.

View PapeCoding's full-sized avatar

Sebi PapeCoding

View GitHub Profile
@PapeCoding
PapeCoding / Doc.tex
Last active August 20, 2025 14:28
Rendering Code for Color Scheme Bars using TikZ
\resizebox{\linewidth}{!}{\begin{tikzpicture}[font=\sffamily]
\newcommand{\colorBar}[3]{
\foreach \c / \l / \i in {#3} {%
\definecolor{boxColor}{HTML}{\c}
\node[fill=boxColor,minimum width=6mm,anchor=west] at (\i*6mm,#2*9mm) {\strut\textbf{\l}};
}
\node[anchor=east] at (0,#2*9mm){#1};
}
\colorBar{Dark Colors:} {0} {BC96C6/a/0,A8A3F7/b/1,9AACFF/c/2,8EB4FF/d/3,82BDFF/e/4,71C8FF/f/5,5BD5FF/g/6,45E0EF/h/7,31E8C9/i/8,29EEA5/j/9,3EF17E/k/10,61F158/l/11,84EE37/m/12,A2E824/n/13,BEDF25/o/14,D9D42F/p/15,F0C738/q/16,FFB83C/r/17,FFA83C/s/18,FF963B/t/19,FF853B/u/20,FF783E/v/21,FF7142/w/22,FF6F48/x/23,FF7050/y/24,FF755D/z/25}
@PapeCoding
PapeCoding / DasherMouseInput.cpp
Created January 11, 2024 11:56
Simple Exponential Moving Average Filter for Dasher Mouse Input
// replace the content of the function with the one below:
[...]
bool CDasherMouseInput::GetScreenCoords(screenint &iX, screenint &iY, CDasherView *pView)
{
POINT mousepos;
GetCursorPos(&mousepos);
ScreenToClient(m_hwnd, &mousepos);
@PapeCoding
PapeCoding / FaceIT-HyperV-Toggle.ps1
Last active March 9, 2021 21:32
Toggle HyperV for the FACEIT Anti-Cheat
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{ Write-Host "No Adminrights. restart as Administrator"
$arguments = "& ‚" + $myinvocation.mycommand.definition + "‚"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$oldValue = (bcdedit | Select-String -Pattern "hypervisorlaunchtype").toString().split() | select -Last 1
If ( $oldValue -eq "Off")
@PapeCoding
PapeCoding / UnrealAssetLoading.cpp
Last active March 10, 2020 10:30
This shows how an Asset can be loaded from C++. Here a Plane and a corresponding Material is loaded
template <typename T>
bool LoadAsset(const FString& Path, T* & Result)
{
ConstructorHelpers::FObjectFinder<T> Loader(*Path);
Result = Loader.Object;
if (!Loader.Succeeded()) UE_LOG(LogTemp, Error, TEXT("Could not find %s. Have you renamed it?"), *Path);
return Loader.Succeeded();
}
AMyClass::AMyClass()
@PapeCoding
PapeCoding / UnrealCreateC++UMGBinding.hpp
Last active March 9, 2020 16:08
This shows how an UMG widget can be bound/controlled from C++
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "TextBlock.h"
#include "Border.h"
#include "MySpecificUserWidget.generated.h"
/**
*
@PapeCoding
PapeCoding / UnrealCreateUMGWidgetFromC++.cpp
Created March 9, 2020 15:28
This allows the spawning of a widget from C++, which is then attached to the viewport
// Declare this in Header
TSubclassOf<class UUserWidget> Overlay_Class;
UUserWidget* Overlay;
// Do this in Constructor
ConstructorHelpers::FClassFinder<UUserWidget> WidgetClassFinder(TEXT("WidgetBlueprint'/MyPlugin/MyWidgetName'"));
if (WidgetClassFinder.Succeeded())
{
Overlay_Class = WidgetClassFinder.Class;
}
@PapeCoding
PapeCoding / UnrealRedirectClass.ini
Created March 9, 2020 15:22
This allows to rename a C++ class without breaking every blueprint that inherits from it
# Open Configs/DefaultEngine.ini of your project and under [/Script/Engine.Engine] section add the below line:
+ActiveClassRedirects=(OldClassName="/Script/MyOldClassName",NewClassName="/Script/MyNewClassName")
# This can look like this in a plugin:
+ActiveClassRedirects=(OldClassName="/Script/MyPlugin.MyClass",NewClassName="/Script/MyPlugin.MyClass2")
# If you are not sure how the reference looks like, you can right click your C++ class in the editor and copy the reference
@PapeCoding
PapeCoding / UnrealActionMappingAndBind.cpp
Last active March 9, 2020 15:20
This allows binding "keys" to functions indirectly, by introducing a unique action, which calls your method with your parameter(s).
// Declare inside your Unreal Class
DECLARE_DELEGATE_OneParam(FMyActionDelegate, float);
//Do in function like BeginPlay or the StartupModule function of your Plugin
UInputSettings::GetInputSettings()->AddActionMapping(FInputActionKeyMapping(TEXT("MyTestAction"),EKeys::T));
UInputSettings::GetInputSettings()->SaveKeyMappings();
InputComponent->BindAction<FMyActionDelegate>(TEXT("MyTestAction"),EInputEvent::IE_Pressed,this,&MyClass::MyFunctionHandler,-0.1337f);
@PapeCoding
PapeCoding / UnrealHLSLAccessSceneTextureByName.ush
Last active March 9, 2020 15:22
Unreal PostProcess Access Textures by Name in HLSL
// All members of the GBuffer can be found here:
// https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Shaders/Private/DeferredShadingCommon.ush#L301
#if SCENE_TEXTURES_DISABLED
return 0;
#endif
return GetScreenSpaceData(GetSceneTextureUV(Parameters), false).GBuffer.CustomStencil.x == 1;
@PapeCoding
PapeCoding / GetTweetsText.js
Last active January 30, 2019 21:47
Get all displayed tweets from a timeline as plaintext in single lines! This is very usefull to get data from twitter without having an api key. This especially works fine on the "advanced search"-results!
a = ""; Array.from(document.getElementsByClassName("tweet-text")).forEach(function(t) {if(t.getAttribute("lang") == "en") a += t.innerText.replace(/\n|\s\s+/g, " ").trim() + "\n"}); var input = document.createElement("textarea"); document.querySelectorAll('.AppContent-main, .AppContent')[0].prepend(input); input.value = a;