Skip to content

Instantly share code, notes, and snippets.

View R3tr0BoiDX's full-sized avatar
🖨️
Low on cyan!

R3tr0BoiDX R3tr0BoiDX

🖨️
Low on cyan!
  • Germany
View GitHub Profile
@R3tr0BoiDX
R3tr0BoiDX / dependency-cleaner.sh
Last active December 31, 2023 10:46
Clean your system!
#!/bin/bash
RED="\e[31m"
ENDCOLOR="\e[0m"
sudo -v
echo -e "${RED}Run auto clean${ENDCOLOR}"
sudo apt autoclean -y
@R3tr0BoiDX
R3tr0BoiDX / tempenv
Last active December 31, 2023 00:21
I was tired of cluttering up my system with dependencies and tools that I only needed to use once, for example to compile something. This gives me a temporary environment in Docker, based on Debian. It mounts the current working directory into the container, automatically updates its package index on startup, and deletes itself unless specifical…
#!/bin/bash
# R3tr0Boi 2023
# Function to display usage information
function show_usage {
echo "Usage: $0 [-k] [-h]"
echo "Options:"
echo " -k Keep the container at the end (do not remove)"
echo " -h Display this help screen"
exit 1
@R3tr0BoiDX
R3tr0BoiDX / pygame_controller_layout.py
Created October 15, 2023 22:07
Pygame Controller Layout
import pygame
pygame.init()
pygame.joystick.init()
joystick = pygame.joystick.Joystick(0)
joystick.init()
while True:
for event in pygame.event.get():
@R3tr0BoiDX
R3tr0BoiDX / Multiline.cs
Last active December 6, 2022 20:59
A scene depended notepad directly within Unity, PREVIEW: https://github.com/R3tr0BoiDX/R3tr0BoiDX/blob/main/Multiline.png
#if UNITY_EDITOR
using UnityEngine;
public class Multiline : MonoBehaviour {
[Multiline(50)] public string notes;
}
#endif
@R3tr0BoiDX
R3tr0BoiDX / CompilationWindow.cs
Last active August 29, 2022 19:13
A custom compilation window, as Unity's default behavior became kinda painful recently. Allows you to turn off auto recompile and gives you the option to compile on demand and, if wanted, enters play mode
/// Allows you to turn off auto recompile and gives you the option to compile on demand and, if wanted, enters play mode
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
namespace Editor {
public class CompilationWindow : EditorWindow {
private static bool autoRefresh;
private bool enterPlaymode;
@R3tr0BoiDX
R3tr0BoiDX / SimpleAnimator.cs
Last active December 6, 2022 21:02
Easy animator for simple sprite animations. Use best with other gist "SimpleAnimatorEditor.cs". PREVIEW: https://github.com/R3tr0BoiDX/R3tr0BoiDX/blob/main/SimpleAnimator.png
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace Tools {
/// <summary>
/// Easy animator for simple sprite animations
/// Theres also a editor integration, you can find here: https://gist.github.com/R3tr0BoiDX/1607500b036531e17dadaa7e6255818d
/// </summary>
public class SimpleAnimator : MonoBehaviour {
@R3tr0BoiDX
R3tr0BoiDX / SimpleAnimatorEditor.cs
Last active August 16, 2022 22:17
Editor integration for SimpleAnimator
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
namespace Tools {
[CustomEditor(typeof(SimpleAnimator))] //find here: https://gist.github.com/R3tr0BoiDX/d84e91a03d020f2169d92446f1ffb857
public sealed class SimpleAnimatorEditor : Editor {
private SimpleAnimator anim;
@R3tr0BoiDX
R3tr0BoiDX / TaskManager.cs
Last active August 16, 2022 22:12
Convenient coroutine API for Unity by krockot, extended by R3tr0BoiDX (that's me, heh)
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Tools {
/// <summary>
/// Addendum to krockot's original task manager - https://github.com/krockot/Unity-TaskManager
/// Added possibility to pool a bunch of tasks together, so they can be started, stopped,... together
/// </summary>
@R3tr0BoiDX
R3tr0BoiDX / overwrite-state.yml
Last active August 1, 2022 19:58
Overwrite the on/off state of a given entity with from another
blueprint:
name:
description: 'Synchronize the on/off state of 2 entities'
domain: automation
input:
entity_1:
name: First entity
selector:
entity:
entity_2:
@R3tr0BoiDX
R3tr0BoiDX / hsv2rgb.c
Last active July 22, 2022 23:02 — forked from postspectacular/hsv2rgb.ino
C port of postspectacular's super compact HSV/RGB conversions for Arduino/C
float fract(float x) { return x - (int) x; }
float mix(float a, float b, float t) { return a + (b - a) * t; }
float step(float e, float x) { return x < e ? 0.0f : 1.0f; }
float constrain(float x, float low, float high) { return ((x) < (low) ? (low) : ((x) > (high) ? (high) : (x))); }
float min(float a, float b) { return (a > b) ? b : a; }