Skip to content

Instantly share code, notes, and snippets.

View friuns2's full-sized avatar

Brutal Strike friuns2

View GitHub Profile
@friuns2
friuns2 / .js
Created March 26, 2024 23:10
.js
```js
function openapiToFunctions(openapiSpec) {
function replaceRefs(obj, parent = null) {
if (Array.isArray(obj)) {
return obj.map(item => replaceRefs(item, parent));
} else if (obj !== null && typeof obj === 'object') {
if (obj['$ref'] && typeof obj['$ref'] === 'string') {
const refPath = obj['$ref'].substring(2).split('/');
let refObj = parent;
for (const key of refPath) {
@friuns2
friuns2 / .html
Last active September 22, 2022 11:28
google maps auto translate
hello world
<style>
.google-translate {
display: inline-block;
vertical-align: top;
padding-top: 15px;
}
.goog-logo-link {
display: none !important;
// Mixamo Animation downloadeer
// The following script make use of mixamo2 API to download all anims for a single character that you choose.
// The animations are saved with descriptive long names instead of the short ones used by default by mixamo UI.
//
// This script has been written by gnuton@gnuton.org and the author is not responsible of its usage
//
// How to use this script
// 1. Browse mixamo.com
// 2. Log in
// 3. Open JS console (F12 on chrome)
#NoEnv
#SingleInstance force
#InstallKeybdHook
Global KeyStates, MouseState, ClickCount, IdleDelay, LargeDisplay
IdleDelay=3000
LargeDisplay=0
; 0 = Tooltip near mouse pointer
@friuns2
friuns2 / NonAllocString.cs
Last active April 24, 2020 20:47
Zero alloc strings
//example for(int i=0;i<1000;i++) string newZeroGcString = NonAllocString.instance+"test"+23;
using System;
using System.Collections.Generic;
using System.Text;
public class NonAllocString
{
private NonAllocString()
@friuns2
friuns2 / Two Sided Two UVs Texture Atlas.shader
Last active April 4, 2020 16:52
atlas tiled double face
Shader "Atlas Texture"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_LightMap ("Lightmap (RGB)", 2D) = "white" {}
_Padding("Padding", Range(0, 0)) = 0
_SrcBlend ("_SrcBlend", Float) = 1
_DstBlend ("_DstBlend", Float) = 0
@friuns2
friuns2 / ResourceDB.cs
Created December 23, 2019 15:08
ResourceDB.cs
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System.Linq;
[System.Serializable]
public class ResourceItem
{
public enum Type
{
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Hidden/TerrainEngine/Splatmap/Diffuse-BaseGen"
{
Properties
{
[HideInInspector] _DstBlend("DstBlend", Float) = 0.0
}
SubShader
{
@friuns2
friuns2 / test64.cs
Created December 16, 2019 12:22
perofrmance test
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
public class Test64 : MonoBehaviour
{
public bool mtRendering;
#if UNITY_EDITOR
public void OnValidate()
@friuns2
friuns2 / PlayerLoop.cs
Created July 3, 2019 10:56 — forked from LotteMakesStuff/PlayerLoop.cs
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;