Skip to content

Instantly share code, notes, and snippets.

@xldeveloper
xldeveloper / AssistantVisuals.cs
Created August 1, 2022 23:48 — forked from Kleptine/AssistantVisuals.cs
Clone Arms Rigging in The Last Clockwinder
// Copyright 2022 John Austin - Pontoco
// License: MIT
// https://choosealicense.com/licenses/mit/
// This is the rigging code that is used to calculate IK and place arm bones in The Last Clockwinder.
// It began using the Unity Animation Rigging package, but we found that to be too slow and overly separated into too many
// trivial jobs (it was dominated by scheduling time).
// This code is largely the result of manually inlining all of the rigging code we were using from our Animation Rigging setup.
// You'll notice that it's well setup to run as a Job! But we never needed the extra performance. In face, just running this code 25 times
Cache references
We recommend caching references to all relevant components and GameObjects at initialization because repeating function calls such as GetComponent<T>() and Camera.main are more expensive relative to the memory cost to store a pointer. . Camera.main just uses FindGameObjectsWithTag() underneath, which expensively searches your scene graph for a camera object with the "MainCamera" tag.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
private Camera cam;
private CustomComponent comp;
@xldeveloper
xldeveloper / MakePowerShellRememberSSHPassphrase.md
Created May 27, 2022 00:21 — forked from danieldogeanu/MakePowerShellRememberSSHPassphrase.md
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@xldeveloper
xldeveloper / MenuItemGenerator.cs
Created May 25, 2022 22:01 — forked from marcosecchi/ MenuItemGenerator.cs
Generating menu items at runtime in Unity
using UnityEngine;
using UnityEditor;
using System.Text;
namespace TheBitCave {
public class MenuItemGenerator {
/// <summary>
/// Generates a list of menuitems from an array
/// </summary>
@xldeveloper
xldeveloper / hosts
Created January 9, 2022 22:06 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@xldeveloper
xldeveloper / docker-mongo-repair
Created August 25, 2021 15:58 — forked from mtrunkat/docker-mongo-repair
Run "mongo --repair" in Docker container that cannot start because of MongoDB error
#!/bin/bash
# See https://github.com/docker-library/mongo/pull/63
docker run --rm --volumes-from my-mongo-server mongo unlink "/data/db/mongod.lock"
docker run --rm --volumes-from my-mongo-server mongo --repair
@xldeveloper
xldeveloper / MiniPCG32.cs
Created July 22, 2021 07:51 — forked from ThomasFOG/MiniPCG32.cs
Minimal PCG32 Random Number Generator in C#
namespace PizzaDough
{
/// <summary>
/// Random Number Generator based on Permutation-Congruential-Generator (PCG), which is a fancy wording to
/// describe a family of RNG which are simple, fast, statistically excellent, and hardly predictable.
///
/// More interestingly, PCG allows to generate multiple sequences with the same seed, which is very handy
/// in game development to have a unique seed per game session while using different streams for each
/// RNG which requires an isolated context (e.g. generating a procedural level, but we don't want the loot
/// generation to affect subsequent level generations).
@xldeveloper
xldeveloper / .gitattributes
Created June 15, 2021 19:43 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@xldeveloper
xldeveloper / .gitattributes-lfs-unity
Created June 15, 2021 19:43 — forked from bpesquet/.gitattributes-lfs-unity
.gitattributes file for LFS with Unity
* text=auto
# Unity files
*.meta -text -merge=unityamlmerge
*.unity -text -merge=unityamlmerge
*.asset -text -merge=unityamlmerge
*.prefab -text -merge=unityamlmerge
# Image formats
*.psd filter=lfs diff=lfs merge=lfs -text