Skip to content

Instantly share code, notes, and snippets.

View gatosyocora's full-sized avatar

gatosyocora gatosyocora

View GitHub Profile
@gatosyocora
gatosyocora / text_counter.ps1
Last active July 19, 2020 12:41
pdfをtxtしたレポートの文字数を数えるPowerShellスクリプト
#[使い方]
# 1. ショートカットを作成する。リンク先は以下のような感じにする
# [powershell.exeの絶対パス] -ExecutionPolicy RemoteSigned -File [text_counter.ps1(このファイル)の絶対パス]
# 2. 採点するpdfファイルをAdobeAcrobatReaderDCの"ファイル(F)>テキストとして保存"でutf-8のtxtファイルに変換する
# 3. 1で作ったショートカットに2で作ったtxtファイルをD&Dする
#自動文字数検索では小節以下のタイトルも文字数に含めている
#図タイトルは文字数に含めないようにしている
#英数列は1文字ずつに分けて文字数として計算している(count = 5文字、0.1km = 5文字)
@gatosyocora
gatosyocora / NPCDressChanger.cs
Last active July 14, 2020 22:10
VRChatでインスタンス作成時にActiveにするオブジェクト(本スクリプトでは服装)をランダムで決定するUdonSharpスクリプト(確率と時間指定に対応)
using System;
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common.Interfaces;
public class NPCDressChanger : UdonSharpBehaviour
{
@gatosyocora
gatosyocora / 81-C# EditorWindow Script-NewEditorWindowScript.cs.txt
Last active May 26, 2020 08:54
UnityでCreateから作成できるEditorWindow用のC#テンプレートコード
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;
namespace #SCRIPTNAME#
{
public class #SCRIPTNAME# : EditorWindow
{
@gatosyocora
gatosyocora / flipImage.ps1
Created May 22, 2020 09:16
引数で受け取ったパスの画像を水平反転させるPowerShellのコード
Param(
[parameter(mandatory=$true)][String]$imageUrl
)
Add-Type -AssemblyName System.Drawing
$stream = [System.IO.FileStream]::new(
$imageUrl,
[System.IO.FileMode]::Open,
[System.IO.FileAccess]::ReadWrite)
$srcImage = [System.Drawing.Image]::FromStream($stream)
@gatosyocora
gatosyocora / VRCSDKChecker.cs
Last active May 5, 2020 09:43
VRCSDKがプロジェクトに入っているか調べる。入っている場合特定のシンボルを登録し、VRCSDKがないことによるコンパイルエラーを防ぐ
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class VRCSDKChecker
{
// 他のスクリプトでVRCSDKを使う部分に
// #if VRCSDK ~ #endif
// で囲うことでVRCSDKがないことによるコンパイルエラーを防げる
@gatosyocora
gatosyocora / git_commands.md
Last active May 25, 2021 17:22
忘れがちなgitのコマンドをまとめる
  • ファイルの変更はそのままで直前のコミットを取り消す(Windows)

    $git reset --soft "HEAD^"

  • gitignoreの変更を適用(管理しなくなったファイルの履歴も残さない(push前))

    1. $git rm -r --cached .
    2. $git add .
    3. $git commit --amend --no-edit
@gatosyocora
gatosyocora / GatoMaterialPropertyDrawer.cs
Last active April 20, 2023 08:41
ShaderLabのCustomMaterialPropertyDrawerのサンプル(区切り線, Texture2Dの1行表示, foldout)
using UnityEngine;
using UnityEditor;
using System;
namespace GatoMaterialPropertyDrawer
{
internal class LineDecorator : MaterialPropertyDrawer
{
private float spaceSize;
@gatosyocora
gatosyocora / ComponentProperties.cs
Last active November 1, 2019 13:38
任意のコンポーネントのプロパティ名一覧を取得する (同じオブジェクトにつけてReload->コンポーネント選択->Show Properties)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ComponentProperties : MonoBehaviour {
@gatosyocora
gatosyocora / AnimatorUtility.cs
Created October 18, 2019 17:16
UnityのAnimatorに関する便利な関数
using System.Collections.Generic;
using UnityEditor.Animations;
using UnityEngine;
using System.Linq;
using System.Text;
using System;
// Copyright (c) 2019 gatosyocora
// MIT License
@gatosyocora
gatosyocora / RuntimeMaterialLoader.cs
Created October 11, 2019 12:28
Unityアプリで任意の場所にあるmatファイルをランタイムロードするプログラム(暫定なのでエラー処理とか書いてないです)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Windows.Forms;
using System.IO;
using YamlDotNet;
using YamlDotNet.RepresentationModel;
using System.Text.RegularExpressions;
// Copyright (c) 2019 gatosyocora