Skip to content

Instantly share code, notes, and snippets.

@t-mat
t-mat / AlpineWSL.run.bat
Created May 4, 2024 17:16
[Windows] Download and run Alpine Linux on WSL
@echo off
setlocal EnableDelayedExpansion
set /a errorno=1
for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "_ESC=%%E"
cd /d "%~dp0"
set /a _E =0
set /a _E+=1 && if not exist "Alpine.zip" ( curl -JOL https://github.com/yuk7/AlpineWSL/releases/download/3.18.4-0/Alpine.zip )
set /a _E+=1 && if not exist "Alpine.zip" goto :ERROR
set /a _E+=1 && if not exist "Alpine.exe" ( tar -xkf .\Alpine.zip )
@t-mat
t-mat / winget-error-0x8a15005e.md
Created April 28, 2024 13:46
[Windows] `winget` keep reporting mysterious error 0x8a15005e

Problem: winget CLI command keep reporting a mysterious error code 0x8a15005e

Solution: Update winget.exe via aka.ms/getwinget

pwsh.exe
cd $env:USERPROFILE\Desktop
curl.exe -JOL https://aka.ms/getwinget
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.txt.msixbundle
@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;