Skip to content

Instantly share code, notes, and snippets.

View esperecyan's full-sized avatar

100の人 (エスパー・イーシア) esperecyan

View GitHub Profile
@esperecyan
esperecyan / VRChatBlockedComponentsRemover.cs
Last active May 14, 2022 04:05
『VRChatBlockedComponentsRemover.cs』 VRChatのOculust Quest版のアバターにおいて、使用できないコンポーネントを削除します。 https://twitter.com/esperecyan/status/1185926369441509381
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
namespace Esperecyan.Unity.VRChatBlockedComponentsRemover
{
/// <summary>
/// VRChatのOculust Quest版のアバターにおいて、使用できないコンポーネントを削除します。
/// </summary>
@esperecyan
esperecyan / 履歴のURL置換.js
Last active January 11, 2020 00:36
Firefox 72以降で動作。7つの定数値を書き替え後、ブラウザーコンソールにコピペして実行。
(async function () {
const FAVICON_URI = NetUtil.newURI('https://www.pixiv.net/favicon.ico');
const PRINCIPAL = Services.scriptSecurityManager.createContentPrincipal(NetUtil.newURI('https://www.pixiv.net/artworks/'), {});
const OLD_URL_SEARCH_TERMS = 'https://www.pixiv.net/member_illust.php?mode=medium&illust_id=';
const OLD_URL_PATTERN = /^https:\/\/www\.pixiv\.net\/member_illust.php\?mode=medium&illust_id=[0-9]+$/;
const NEW_URL_SEARCH_TERMS = 'https://www.pixiv.net/artworks/';
const NEW_URL_PATTERN = /^https:\/\/www\.pixiv\.net\/artworks\//;
const REPLACE_PATTERN = [/\/member_illust\.php\?mode=medium&illust_id=/, '/artworks/'];
const query = PlacesUtils.history.getNewQuery();
@esperecyan
esperecyan / CreateFrameByFrameAnimation.cs
Last active August 23, 2023 10:25
■『convert-video-to-texture-for-vrchat-quest.ps1.jse』MP4などの動画から、一定間隔ごとにUVを一瞬でズラすことができるシステム向けのテクスチャに変換するスクリプトです。 ■『CreateFrameByFrameAnimation.cs』 VRChatのQuest版における動画再生用のエディタ拡張。テクスチャをHierarchey上のメッシュオブジェクトに設定しておき、そのオブジェクトのコンテクストメニューから生成します。 ■『VCI埋め込み動画再生ライブラリ』バーチャルキャストのアイテム・背景に動画を埋め込めるようにするLuaスクリプト片。 https://twitter.com/esperecyan/status/115569878…
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using UnityEditor;
#if VRC_SDK_VRCSDK2

『CombineMeshesAndSubMeshes.cs』は、『VRM Converter for VRChat』へ統合しました。
https://pokemori.booth.pm/items/1025226

『VRM Converter for VRChat』のメイン機能を利用するにはVRChat SDKのインポートが必要ですが、 メッシュの結合だけを行う場合は、VRChat SDKのインポートは不要です。

@esperecyan
esperecyan / convert-video-to-texture-for-mtoon.ps1.jse
Last active September 14, 2022 14:14
『convert-video-to-texture-for-mtoon.ps1.jse』 動画をMToon上で再生できるきゃぱきゃぱ式テクスチャに変換するスクリプトです。 【16:9で38分割したサンプルFBX】https://cdn.discordapp.com/attachments/511077066628661271/997715603345391638/screen.fbx / https://twitter.com/mirabetakasi64/status/1148233404019642368
#@~^AQAAAA==~IAAAAA==^#~@ function toPSString(str) { return "'" + str.replace(/%/g, '"%"').replace(/'/g, "''") + "'"; } /* -*- mode: powershell;-*-
<#*/ var command = 'param($Path, $FrameCount, $VerticalResolution, [int]$TextureSize = 8192)'
+ '; $_PSCommandPath = ' + toPSString(WSH.ScriptFullName)
+ '; Invoke-Expression (Get-Content ' + toPSString(WSH.ScriptFullName) + ' -Encoding UTF8 -Raw)';
var namePattern = /^-(?!(?:b(?:and|or|xor|not)|sh[lr]|[ic]?(?:eq|ne|gt|ge|lt|le|(?:not)?(?:like|match|contains|in)|replace|split)|join|is(?:not)?|as|and|or|not|f)$)[0-9a-z]+$/i;
var args = ''; for (var i = 0; i < WSH.Arguments.Length; i++) {
var arg = WSH.Arguments(i); args += ' ' + (namePattern.test(arg) ? arg : toPSString(arg)); }
WSH.CreateObject('WScript.Shell').Run('PowerShell -NoExit -Command &{' + command + '}' + args); /*#>
<#
.SYNOPSIS
@esperecyan
esperecyan / life-and-death-monitor.ps1.jse
Last active October 8, 2022 09:37
『life-and-death-monitor.ps1.jse』 通知領域 (タスクトレイ) に常駐する、Windows向けのシンプルなPowershell製死活監視ツールです。
#@~^AQAAAA==~IAAAAA==^#~@ function toPSString(str) { return "'" + str.replace(/%/g, '"%"').replace(/'/g, "''") + "'"; } /* -*- mode: powershell;-*-
<#*/ var command = 'param(\
$Names, \
$IntervalSeconds = 5 * 60, \
$StartupDelaySeconds = 0, \
$DefaultTemporaryHaltSeconds = 3 * 60 * 60)'
+ '; $_PSCommandPath = ' + toPSString(WSH.ScriptFullName)
+ '; Invoke-Expression (Get-Content ' + toPSString(WSH.ScriptFullName) + ' -Encoding UTF8 -Raw)';
var namePattern = /^-(?!(?:b(?:and|or|xor|not)|sh[lr]|[ic]?(?:eq|ne|gt|ge|lt|le|(?:not)?(?:like|match|contains|in)|replace|split)|join|is(?:not)?|as|and|or|not|f)$)[0-9a-z]+$/i;
var args = ''; for (var i = 0; i < WSH.Arguments.Length; i++) {
@esperecyan
esperecyan / powershell-template.ps1.jse
Last active January 22, 2021 13:03
ダブルクリックで実行できるPowerShellスクリプトファイルのテンプレート。UTF-8 (BOMなし) で保存してください。MIT License https://opensource.org/licenses/mit-license
#@~^AQAAAA==~IAAAAA==^#~@ function toPSString(str) { return "'" + str.replace(/%/g, '"%"').replace(/'/g, "''") + "'"; } /* -*- mode: powershell;-*-
<#*/ var command = 'param($Test)'
+ '; $_PSCommandPath = ' + toPSString(WSH.ScriptFullName)
+ '; Invoke-Expression (Get-Content ' + toPSString(WSH.ScriptFullName) + ' -Encoding UTF8 -Raw)';
var namePattern = /^-(?!(?:b(?:and|or|xor|not)|sh[lr]|[ic]?(?:eq|ne|gt|ge|lt|le|(?:not)?(?:like|match|contains|in)|replace|split)|join|is(?:not)?|as|and|or|not|f)$)[0-9a-z]+$/i;
var args = ''; for (var i = 0; i < WSH.Arguments.Length; i++) {
var arg = WSH.Arguments(i); args += ' ' + (namePattern.test(arg) ? arg : toPSString(arg)); }
WSH.CreateObject('WScript.Shell').Run('PowerShell -NoExit -Command &{' + command + '}' + args); /*#>
#Requires -Version 5.0
using namespace System.Windows.Forms
@esperecyan
esperecyan / FBXMeshFileSizeReducer.cs
Last active May 6, 2022 08:41
『FBXMeshFileSizeReducer.cs』 Unity 2018.3以降でFBXのメッシュが肥大化する問題を抑制するエディタ拡張。 unitypackage: https://pokemori.booth.pm/items/1961154
using System.Linq;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor;
namespace Esperecyan.Unity.FBXMeshFileSizeReducer
{
/// <summary>
/// Unity 2018.3以降でFBXのメッシュが肥大化する問題を抑制します。
@esperecyan
esperecyan / mozilla.cfg
Last active January 10, 2023 03:14
これは古いやり方です。次のWikiを参照してください。 http://wiki.nothing.sh/page?userChrome.js%CD%D1%A5%B9%A5%AF%A5%EA%A5%D7%A5%C8#m5c944e2
// -*- mode: javascript;-*-
/**
* @file 「mozilla.cfg」(autoconfig.cfg) として動作するよう修正した簡易版userChromeJS。
* The simplified version of userChromeJS which modified to run as “mozilla.cfg” (autoconfig.cfg).
* @version 3.0.2
* @see [Deploying Firefox in an enterprise environment — Mozilla | MDN]{@link https://developer.mozilla.org/Firefox/Enterprise_deployment#Configuration}
* @see [mozdev.org — userchromejs: index]{@link http://userchromejs.mozdev.org/}
* @see [[Ext] userChromeJS 2.0 [2015-08-02] • mozillaZine Forums]{@link http://forums.mozillazine.org/viewtopic.php?p=14747866#p14747866}
* @see [設定の管理 | 技術的なよくある質問 | 法人向け情報 | Mozilla Japan コミュニティポータル]{@link https://www.mozilla.jp/business/faq/tech/setting-management/#mcd}
* @see [userChrome.js/userChrome.js at master · alice0775/userChrome.js]{@link https://github.com/alice0775/userChrome.js/blob/master/userChrome.js}