Skip to content

Instantly share code, notes, and snippets.

View keijiro's full-sized avatar

Keijiro Takahashi keijiro

View GitHub Profile
@keijiro
keijiro / FpsCapper.cs
Last active November 25, 2024 15:58
FpsCapper - Limits the frame rate of the Unity Editor in Edit Mode
using UnityEditor;
using UnityEngine;
using UnityEngine.LowLevel;
using System.Linq;
using System.Threading;
namespace EditorUtils {
//
// Serializable settings

$$x = (\sin t) \left\{ e^{\cos t} - 2\cos 4t - \sin^5 \Big({t \over 12}\Big) \right\} $$

$$y = (\cos t) \left\{ e^{\cos t} - 2\cos 4t - \sin^5 \Big({t \over 12}\Big) \right\} $$

$$0 \le t \le 12\pi$$

@keijiro
keijiro / kitty.conf
Created March 17, 2024 03:12
My Kitty configuration
# vim:fileencoding=utf-8:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family Lilex Nerd Font Mono
# bold_font auto
@keijiro
keijiro / CFD.hlsl
Last active August 12, 2023 04:04
CFD.hlsl
#version 150
// Pseudo fluids, heavily inspired by flockaroo's single-pass CFD
// https://www.shadertoy.com/view/MdKXRy
in VertexData {
vec4 v_position;
vec3 v_normal;
vec2 v_texcoord;
} inData;
import sys
pcount = int(sys.stdin.readline().rstrip())
for i in range(0, pcount):
sys.stdin.readline()
for j in range(0, 16):
coord = sys.stdin.readline().rstrip().split()
coord = list(map(lambda x: float(x) * 0.2, coord))
coord[2] = max(0, coord[2] - 0.075 * 0.2)
using UnityEngine;
sealed class Test : MonoBehaviour
{
float life;
void Test1()
{
(float, int) attack = (3.5f, 8);
life -= attack.Item1 * attack.Item2;
@keijiro
keijiro / disco.hlsl
Last active May 18, 2023 10:46
Disco mode shader for Windows Terminal
Texture2D shaderTexture;
SamplerState samplerState;
cbuffer PixelShaderSettings
{
float Time;
float Scale;
float2 Resolution;
float4 Background;
};
@keijiro
keijiro / setup_scoped_registry.md
Last active October 27, 2024 06:57
How to add "Keijiro" scoped registry to your Unity project

How to add "Keijiro" scoped registry to your Unity project

Open the Package Manager page in the Project Settings window and add the following entry to the "Scoped Registries" list:

  • Name: Keijiro
  • URL: https://registry.npmjs.com
  • Scope: jp.keijiro

Scoped Registry

  graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
#if HOGEHOGE
struct FullName
{
[MarshalAs(UnmanagedType.LPStr)] public string first;
[MarshalAs(UnmanagedType.LPStr)] public string last;
}
[DllImport(_dll)]
static extern uint get_full_length(in FullName name);