Skip to content

Instantly share code, notes, and snippets.

View forestrf's full-sized avatar

Andrés Leone Gámez forestrf

View GitHub Profile
@forestrf
forestrf / setup_http_server_on_android_with_termux.md
Last active October 27, 2023 00:56 — forked from vilkoz/setup_http_server_on_android_with_termux.md
setup http server on android with termux

Setting up http server on android with termux

Setting SSH server

To be able to make all procedures without pain you should have physical keyboard or just install ssh server and connect to your device shell from computer.

Folow this guide to setup ssh server.

Installing needed stuff

@forestrf
forestrf / gist:4bc9e2cc56acb74a6719547e22072d68
Created August 5, 2023 20:08 — forked from ykst/gist:6e80e3566bd6b9d63d19
WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebRTCでやれよ!と言われそうなところですが、 WebSocket+WebAudioの組み合わせで音声ストリーミングをシンプルに構成する方法を紹介してみます。

サーバーサイド(Node.js + ws + pcm)

サーバーサイドは何でも良いのですが、 とりあえずNode.jsでtest.mp3というサンプルファイルをpcmモジュールでデコードし、 wsでクライアントに垂れ流す作りにしておきます。

@forestrf
forestrf / JobSafeMenuItem.cs
Created July 14, 2023 20:07
List thread-safe Unity API to the console. Read more at https://www.jacksondunstan.com/articles/5029
// https://www.jacksondunstan.com/articles/5029
// Fix by AshKatchap to support Windows
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEditor;
@forestrf
forestrf / DefineSymbolUtil.cs
Last active July 8, 2023 01:17 — forked from LaneF/DefineSymbolUtil.cs
Unity Define Symbols Utility
using UnityEditor;
using UnityEngine;
using System.Linq;
using UnityEditor.Callbacks;
namespace Ashkatchap {
public static class DefineSymbolUtil {
static readonly (string, string)[] TypeAndSymbol = new[] {
("UltEvents.UltEventBase, UltEvents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "USE_ULTEVENTS"),
};
@forestrf
forestrf / Selectable.cs
Last active February 7, 2024 18:26
Improved UI navigation on Selectable.cs
// Improved navigation code
using System;
using System.Collections.Generic;
using UnityEngine.Serialization;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
[AddComponentMenu("UI/Selectable", 35)]
[ExecuteAlways]
@forestrf
forestrf / PhotoshopMathFP.hlsl
Created March 4, 2023 23:38 — forked from unitycoder/PhotoshopMathFP.hlsl
PhotoshopMath hlsl shader
// https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/
/*
** Photoshop & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate
**
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/
@forestrf
forestrf / aaStepFastBoth.hlsl
Created February 1, 2023 00:14
aaStep HLSL
// Smooth equivalent to step(a, b) and both a and b can have their value change.
float aaStepFastBoth(float a, float b) {
return saturate((b - a) / max(fwidth(b), fwidth(a)));
}
@forestrf
forestrf / BlurEffect.compute
Created April 8, 2022 19:46 — forked from Refsa/BlurEffect.compute
Unity URP custom render feature for UI Blur
#pragma kernel Downscale
#pragma kernel GaussianBlurVertical
#pragma kernel GaussianBlurHorizontal
#pragma kernel BoxBlur
Texture2D<float4> _Source;
RWTexture2D<float4> _Dest;
float _Amount;
float2 _Size;
@forestrf
forestrf / ExtendedScriptableObjectDrawer.cs
Created November 13, 2021 02:06 — forked from tomkail/ExtendedScriptableObjectDrawer.cs
Displays the fields of a ScriptableObject in the inspector
// Developed by Tom Kail at Inkle
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT
// Must be placed within a folder named "Editor"
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@forestrf
forestrf / fbfetch.shader
Created September 22, 2021 12:27 — forked from aras-p/fbfetch.shader
Framebuffer fetch shader in Unity
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
// in practice: only compile for gles2,gles3,metal
#pragma only_renderers framebufferfetch
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};