Skip to content

Instantly share code, notes, and snippets.

@t-mat
t-mat / SelectAFileInFileExplorer.cs
Created April 8, 2024 08:53
[Unity][Windows] Select a file in the file explorer
using System;
using System.IO;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEngine;
internal static class Test {
[MenuItem("Help/Test/SHOpenFolderAndSelectItems")]
private static void MenuItem_MyMenu_SHOpenFolderAndSelectItems() {
string path = "C:/Windows/system.ini";
@t-mat
t-mat / ReportAllTextureImporterSettingsAsCSV.cs
Last active April 6, 2024 07:17
[Unity] Report all TextureImporter settings as CSV
//
// This Unity Editor script reports all TextureImporter settings as CSV file.
//
// Usage:
// - Invoke "UnityEditor > Help > TextureImporterReporter > Report all TextureImporter settings as CSV"
// - Script creates report CSV file and reports its file name.
//
// License
// -------
// SPDX-FileCopyrightText: Copyright (c) Takayuki Matsuoka
@t-mat
t-mat / SimpleIniFile.hpp
Created March 6, 2024 21:34
Simple in-memory .ini file parser in C++20
// Simple in-memory .ini file parser in C++20
//
// - Header only library
// - No exception, heap allocation and callback
// - Depends only <stddef.h>
// - Opt-in compatibility with <string_view> (SIMPLE_INI_FILE_HPP_VIEW_TYPE)
//
// Usage
// -----
//
@t-mat
t-mat / download-build-run-mini-rv32ima.md
Last active January 28, 2024 08:57
[Windows]Download, build and run mini-rv32ima
cmd.exe

: https://github.com/cnlohr/mini-rv32ima/tree/7185ec78442060e032bb33a71e6fe2f4319409e8
set "MINI_RV32IMA_HASH=7185ec78442060e032bb33a71e6fe2f4319409e8"

cd /d "%USERPROFILE%\Documents"

if not exist my-mini-rv32ima ( mkdir my-mini-rv32ima )
cd my-mini-rv32ima
@t-mat
t-mat / clone-and-open-threejs-examples.md
Created January 25, 2024 09:08
[Windows]Download and open the examples of three.js

Prerequisites

  • cmd.exe
  • python3

Commands

cmd.exe
@t-mat
t-mat / base64-decoder.cmd
Created January 24, 2024 12:39
[Windows][Batch-file]base64 decoder
@setlocal enabledelayedexpansion & set "ARGS=%*" & powershell -nop -ex Bypass -c "Add-Type (gc '%~dpf0'|select -Skip 1|Out-String); exit [Program]::Main();" & exit /b !ERRORLEVEL!
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
public static class Program {
[DllImport("shell32.dll")]
private static extern IntPtr CommandLineToArgvW(
@t-mat
t-mat / dragontamer_aesrand.hpp
Last active January 21, 2024 21:35
AESRand by dragontamer
#ifndef DRAGONTAMER_AESRAND_HPP_INCLUDED
#define DRAGONTAMER_AESRAND_HPP_INCLUDED 1
// AESRand
// =======
// A Prototype implementation of Pseudo-RNG based on hardware-accelerated AES instructions and 128-bit SIMD
//
// https://github.com/dragontamer/AESRand/
//
// MIT License
// ===========
@t-mat
t-mat / IniParser.cs
Last active January 4, 2024 07:39
[C#]Simple ReadOnlySpan<char> .ini parser
// Simple ReadOnlySpan<char> .ini parser
//
// License
// -------
// SPDX-FileCopyrightText: Copyright (c) Takayuki Matsuoka
// SPDX-License-Identifier: CC0-1.0
//
using System;
@t-mat
t-mat / build-volume-control-cli.bat
Last active December 28, 2023 16:33
[Windows]Clone and build volume-control-cli
@echo off
:
: Clone and build volume-control-cli for Windows x64 Desktop, VC++2022
:
setlocal enabledelayedexpansion
set "OLDCD=%CD%"
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"
:
@t-mat
t-mat / build-libwebp.bat
Created December 26, 2023 12:19
Download and build libwebp 1.3.2 for Windows x64 Desktop, VC++2022
@echo off
setlocal enabledelayedexpansion
set "OLDCD=%CD%"
set "libwebp-tgz=libwebp-1.3.2.tar.gz"
set "libwebp-tgz-dir=libwebp-1.3.2"
set "libwebp-url=https://storage.googleapis.com/downloads.webmproject.org/releases/webp/%libwebp-tgz%"
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E"