Skip to content

Instantly share code, notes, and snippets.

@koturn
koturn / unpack_unitypackage.bash
Created May 8, 2024 14:46
unitypackageを展開するbashスクリプト
#!/bin/bash
set -eu
if [ $# -lt 1 ]; then
echo Invalid arguments 1>&2
echo [USAGE]
echo $0 UNITYPACKAGE
exit 1
fi
@koturn
koturn / ListUtil.cs
Created November 18, 2023 10:27
List<T>の内部の配列を取得するやつ
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
namespace Koturn
{
/// <summary>
/// Provides some utility methods of <see cref="List{T}"/>.
@koturn
koturn / ToggleKeywordUtil.cs
Created September 16, 2023 15:18
Unityのシェーダーで[Toggle]が付与されているプロパティのキーワードをC#側から切り替えるやつ(シェーダー側の定義が主)
using System;
using System.Linq.Expressions;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Koturn
{
/// <summary>
@koturn
koturn / MenuHelper.cs
Created September 2, 2023 00:48
https://qiita.com/Swanman/items/279b3b679f3f96a5f925 のリフレクション結果をキャッシュするようにしたやつ
using System;
using System.Linq.Expressions;
using System.Reflection;
using UnityEditor;
namespace Koturn
{
/// <summary>
/// Menu helper
@koturn
koturn / LiltoonCustomShaderMemo.md
Last active August 23, 2023 05:33
lilToonのカスタムシェーダーで躓いたり本体コード読んだときのメモ
<style> details { /* font: 16px "Open Sans", Calibri, sans-serif; */ /* width: 620px; */ } details > summary { padding: 2px 6px; /* width: 15em; */ background-color: #ddd;
@koturn
koturn / LifeGameHSVRotation.shader
Last active January 13, 2021 23:31
ゲーミングライフゲーム
Shader "koturn/GameOfLife"
{
// セルの生存をアルファ値で管理する
// 座標(0, 0)は更新間隔管理に用いており,描画セルかどうかの座標値の判定は省いているので,
// (0, 0)に影響を及ぼさない安定したパターンを初期値として与える必要がある.
Properties
{
_Color ("Cell Color", Color) = (0.0, 1.0, 0.0, 1.0)
_TimeScale ("Time multiplier for HSV rotation", Float) = 0.1
@koturn
koturn / MoveFileByTimestamp.cs
Created November 30, 2020 19:41
VRChatの写真をタイムスタンプで整理するやつ
using System;
using System.IO;
using System.Linq;
namespace MoveFileByTimestamp
{
public class Program
{
private static readonly TimeSpan DefaultOffsetTs;
@koturn
koturn / SingletonTest.cs
Created June 15, 2020 21:11
様々なシングルトンの実装
using System;
namespace Wandbox
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Foo.Instance.Name);
Console.WriteLine(Bar.Instance.Name);
@koturn
koturn / dein.toml
Created June 7, 2020 09:36
dein.vimの設定ファイル
[[plugins]]
repo = 'Shougo/dein.vim'
[[plugins]]
repo = 'fsharp/vim-fsharp'
[[plugins]]
repo = 'neovim/pynvim'
[[plugins]]
@koturn
koturn / test.cpp
Created May 26, 2020 09:53
ラムダのオーバーロードのテスト(一時オブジェクトがmoveされるかどうか)
#include <algorithm>
#include <iostream>
#include <vector>
#if 0
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts&&...) -> overloaded<std::decay_t<Ts>...>;
#else
template <typename... Fs>