Skip to content

Instantly share code, notes, and snippets.

@error454
error454 / MinimapUserWidget.cpp
Created January 22, 2024 03:19
Barebones example of texture math for minimap, just enough boilerplate to describe GetImageCoordsFromWorldLoc
#include "MinimapUserWidget.h"
#include "Kismet/GameplayStatics.h"
FVector2D UMinimapUserWidget::GetImageCoordsFromWorldLoc(FVector WorldLoc) const
{
// Image coordinate system in UMG is:
// 0,0 ------> +x
// |
// |
// |
@error454
error454 / w2rgb.py
Created December 6, 2014 23:35
Wavelength to RGB
#!/usr/bin/env python
# vim:set ft=python fileencoding=utf-8 sr et ts=4 sw=4 : See help 'modeline'
# From http://www.noah.org/wiki/Wavelength_to_RGB_in_Python
'''
== A few notes about color ==
Color Wavelength(nm) Frequency(THz)
Red 620-750 484-400
Orange 590-620 508-484
@error454
error454 / gist:1202171
Created September 7, 2011 23:38
Java random delay
void randomDelay(float min, float max){
int random = (int)(max * Math.random() + min);
try {
Thread.sleep(random * 1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@error454
error454 / UnrealBuildHue.py
Last active February 24, 2022 21:07
UE4 Compile Alerts using Philips Hue
from time import sleep
import time
import datetime
import zachhue
import os
import winsound, sys
lastColor = zachhue.office.xy
lastBrightness = zachhue.office.brightness
bIsBuilding = False
@error454
error454 / UE4Tools.gs
Last active October 1, 2021 00:22
Google Drive Sheet to CSV export for UE4
/**
* @OnlyCurrentDoc
*/
kvString = "=KV(";
kvaString = "=KVA(";
/**
* A special function that runs when the spreadsheet is open, used to add a
* custom menu to the spreadsheet.
@error454
error454 / example.cpp
Last active May 25, 2021 00:42
Vivox UE4 Quest Microphone
#include "AndroidPermissionFunctionLibrary.h"
#include "AndroidPermissionCallbackProxy.h"
void SomeFuncWhereYouNeedPermissions()
{
#if PLATFORM_ANDROID
// If we don't have the permission
if (!UAndroidPermissionFunctionLibrary::CheckPermission(TEXT("android.permission.RECORD_AUDIO")))
{
// Build an array of permissions to request
@error454
error454 / gist:6b94c46d1f7512ffe5ee
Last active May 14, 2020 22:17
Convert RGB to CIE Color Space
import math
# This is based on original code from http://stackoverflow.com/a/22649803
def EnhanceColor(normalized):
if normalized > 0.04045:
return math.pow( (normalized + 0.055) / (1.0 + 0.055), 2.4)
else:
return normalized / 12.92
def RGBtoXY(r, g, b):
@error454
error454 / fix_dropbox.sh
Created December 17, 2019 20:50
Dropbox FS Fix
#!/bin/bash
##############################################################################
# Workaround for Dropbox daemon
# -----------------------------
# Verified on Dropbox v77.4.131
# Just make it executable (if need, using
# $ chmod a+x fix_dropbox
# ) and run it.
# Author: Здравко
# www.dropboxforum.com/t5/user/viewprofilepage/user-id/422790
@error454
error454 / gist:3229018
Created August 1, 2012 17:27
QR Code WiFi Scheme Regex

QR Code WiFi Scheme Regexs of Extreme Awesomeness

A few regular expressions to parse WIFI schemes such as:

WIFI:T:WEP;S:test;P:rainbows\;unicorns\:jedis\,ninjas\\ secure;;

Network Type

###Raw (?<=T:)[a-zA-Z]+(?=;)

@error454
error454 / babyshower.py
Last active October 15, 2018 23:05
Write numbers to images for baby shower guessing game
#Plow through all images in the folder
#Write a tracking number in the top left corner
#Save a text file that shows the original filename and the
#tracking number.
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import glob, os
import random