Skip to content

Instantly share code, notes, and snippets.

View keijiro's full-sized avatar

Keijiro Takahashi keijiro

View GitHub Profile
@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 January 10, 2024 12:52
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);
@keijiro
keijiro / unity-rust.md
Last active January 24, 2022 09:45
Unity/Rust interoperability test projects
using UnityEngine;
using UnityEditor;
static class RawToTexture3D
{
static Color IntToColor(uint b1, uint b2)
=> new Color((b2 + (b1 << 8)) / 65536.0f, 0, 0);
[MenuItem("Tool/Raw to Texture3D")]
static void ConvertRawToTexture3D()