Skip to content

Instantly share code, notes, and snippets.

@savage69kr
savage69kr / GeometryUtils.cs
Created January 16, 2024 02:37 — forked from unitycoder/GeometryUtils.cs
Unity Math & Geometry Utility : ShortestAngleDistance, IsAxisAligned, FindClosestEdge, PointOnOppositeSideOfPolygon, TriangulatePolygon, ClosestTimesOnTwoLines, ClosestPointsOnTwoLineSegments, ClosestPointOnLineSegment, ClosestPolygonApproach, PointInPolygon, ProjectPointOnPlane, OrientedMinimumBoundingBox2D, PolygonsWithinRange, PolygonVertexTo…
// source: https://docs.unity3d.com/Packages/com.unity.xrtools.utils@1.4/api/Unity.XRTools.Utils.GeometryUtils.html
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.CoreUtils
{
/// <summary>
/// Utility methods for common geometric operations
@savage69kr
savage69kr / ascii_movie_image_ver_1.py
Created January 3, 2024 03:26 — forked from MotionDesignStudio/ascii_movie_image_ver_1.py
Python ASCII Video And ASCII Image Creator
#!/usr/bin/env python
import sys
import cv2
import subprocess
from subprocess import call
import aalib
import Image
@savage69kr
savage69kr / SceneViewUIObjectPickerContextWindow.cs
Created December 11, 2023 05:36 — forked from yasirkula/SceneViewUIObjectPickerContextWindow.cs
Select the UI object under the cursor via right click in Unity's Scene window
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2021_2_OR_NEWER
using PrefabStage = UnityEditor.SceneManagement.PrefabStage;
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
Shader "Pristine Grid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
_LineWidthX ("Line Width X", Range(0,1.0)) = 0.01
_LineWidthY ("Line Width Y", Range(0,1.0)) = 0.01
@savage69kr
savage69kr / CircularMenu.cs
Created September 11, 2023 03:22 — forked from alexanderameye/CircularMenu.cs
Circular menu for the Unity Editor
/*
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@savage69kr
savage69kr / free-database-hosting.md
Created September 1, 2023 07:20 — forked from bmaupin/free-database-hosting.md
Free database hosting
@savage69kr
savage69kr / syncthing-automerge.py
Created August 25, 2023 02:48 — forked from solarkraft/syncthing-automerge.py
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
@savage69kr
savage69kr / atkinson.py
Created May 24, 2023 05:26 — forked from radupotop/atkinson.py
Atkinson dithering
#!/usr/bin/python2
import sys, PIL.Image
img = PIL.Image.open(sys.argv[-1]).convert('L')
threshold = 128*[0] + 128*[255]
for y in range(img.size[1]):
for x in range(img.size[0]):
@savage69kr
savage69kr / Dockerfile
Created May 8, 2023 09:06 — forked from benperiton/Dockerfile
backgroundremover test
FROM python:3.6-slim
ARG UID
ARG GID
RUN groupadd -g "${GID}" app \
&& useradd --create-home --no-log-init -u "${UID}" -g "${GID}" app
RUN apt-get update && \
apt-get -y install python3-pip && \
@savage69kr
savage69kr / ScreenShotter.cs
Created April 17, 2023 06:16 — forked from stevepdp/ScreenShotter.cs
A screenshot taking tool for Unity. Drop this onto a "ScreenShotter" or similarily named empty object in your scene and configure as desired. The defaults are however pretty good with screenshots being dumped to the top of your project folder every three seconds. Don't forget to exclude this directory in your .gitignore!
using UnityEngine;
using System.IO;
public class ScreenShotter : MonoBehaviour
{
[Header("Filename Settings")]
[SerializeField, Tooltip("Set the destination path. This folder will be placed at the top of your project directory.")]
string fileDestination = "Screenshots/";