Skip to content

Instantly share code, notes, and snippets.

View retorillo's full-sized avatar

Retorillo retorillo

View GitHub Profile
@retorillo
retorillo / system_unattended_sleep_timeout.reg
Created August 31, 2023 17:32
システム無人スリープタイムアウトの設定を表示する(Windows 11/powercfgだとうまくいかない場合)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238c9fa8-0aad-41ed-83f4-97be242c8f20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0]
"Attributes"=dword:00000002

VST 3.x development on Windows 11 without IDE

THIS DOCUMENT IS A WORK IN PROGRESS

Download VST 3.x SDK

Download VST 3.x SDK from here and expand all.

Build mandatory libraries

{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "dz60",{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "dz60",
"keymap": "dz60_layout_60_ansi_mine",
$d = ""
$lastfile = ""
dir | sort | foreach {
if (-not [math]::max($d, $_.name -match "([^\d]*)(\d+)(.+)")) { continue }
$nd = [int32]::parse($matches[2])
if (($lastfile) -and ($d -ne "") -and (($d + 1) -ne $nd)) {
if (($nd - $d) -gt 3) {
echo "ERROR! MANUALLY CHECK AT " $lastfile.name
exit
}
$shell = new-object -comobject shell.application
$folder = $shell.namespace($pwd.path)
dir | foreach {
$file = $folder.parseName($_.name)
$size = $folder.getDetailsOf($file, 31)
if ($size -eq "") { continue }
if (-not(test-path $size)) { mkdir $size }
move $_.name $size
}

Native Instruments 製品の一括アンインストール

Native Accessには現時点でアンインストールはおろか一括アンインストール機能が提供されておらず、ひとつひとつ「プログラムの追加と削除」からアンインストールを行わなければなりません。手作業だと膨大な手間と時間がかかります。そこでアンインストールするためのスクリプトを作成しました。以下のスクリプトを実行するだけでほとんどのNI製品を取り除くことが可能で、かなりの時間を節約できます。

get-package -name "Native Instruments*" -providerName programs | where name -notmatch "Access|Agent|Editor|Driver"| %{$_.swidtagtext} | select-xml -xpath "*/*" | select-object -expandproperty node | %{ echo $_.ModifyPath; start -wait $_.ModifyPath -argumentlist @("REMOVE=TRUE","MODIFY=FALSE","SILENT=TRUE") }
  • Windows 11環境で確認済みです。
  • PowerShellを管理者権限で実行後、上記コマンドをコピー&ペースト(PowerShellの初期設定だと右クリックで貼り付けができます)ENTERキーを押すと実行が始まります。
@retorillo
retorillo / remove_masks_for_cubism.jsx
Created May 3, 2021 09:44
Live2D Cubism Editorに読み込むためにPSDファイルからすべてのマスクを除去します。「塗り」が100%以外である場合(おそらくLive2D未対応)や、ブレンドモードがデフォルト以外の場合に警告を出力してくれます
var count = 0;
var warning = [];
var targets = [];
function preprocess(root) {
if (!root) root = activeDocument;
for (var c = 0; c < root.layers.length; c++) {
var disabled = [];
if (root.layers[c].typename === 'ArtLayer') {
var path = getpath(root.layers[c]);
var visible = root.layers[c].visible;
@retorillo
retorillo / bigint_extendedscript.jsx
Last active May 2, 2021 04:59
Premiere's Time object computation (Adobe ExtendedScript compatible)
// for Premiere's Time object computation (Adobe ExtendedScript Compatible)
// WORKING IN PROGRESS, NOT WELL TESTED
// License: Public Domain or CC0
// Copyleft (ɔ) Retorillo
function bigint_pad(x, L) {
// NOTE: ExtendedScript does not support String.padStart
var y = x.split(/(?=.)/);
while(y.length < L) y.unshift('0');
return y.join('');
$TZ = 9; $PN = 'メディアの作成日時'; $E = @{ H='AVC'; X='HENC' }; $S = new-object -comObject shell.application; $I = -1; $D = $S.namespace((get-item .).fullName); 0..512 | foreach { $prop = $D.getDetailsOf($null, $_); if ($prop -eq $PN) { $I= $_; } }; if ($I -ne -1) { dir *.mp4 | foreach { $F = $D.parseName($_.name); $W = '{0}.wav' -f $_.baseName; $M = ($_.name + "`t" + $D.getDetailsOf($F, $I)) -match '^G(H|X)([\d]{2})[\d]{4}.((?i)mp4)\t[^\d]*(\d{4})[^\d]+(\d{1,2})[^\d]+(\d{1,2})[^\d]+(\d{1,2})[^\d]+(\d{1,2}).*$'; if ($M) { $G = $Matches; $J = ((new-object datetime ($G[4], $G[5], $G[6], $G[7], $G[8], "0")) - [timespan]::fromhours($TZ)); $N = 'GOPRO_{0}_C{1}_{2}_{3}' -f $J.toString('yyyyMMdd_HHmm'), $G[2], $E[$G[1]], $_.baseName; rni $_.name ('{0}.mp4' -f $N); if (test-path $W) { rni $W ('{0}.wav' -f $N) } } } }

Google Speech-to-Text の QuickStart サンプルコード を実行する

https://github.com/GoogleCloudPlatform/dotnet-docs-samples の「speech/api/QuickStart.cs」を実行するステップ

Visual Studio で必要なコンポーネント

現時点(2021年01月26日)では少なくとも以下のコンポーネントが必要。VS2019 Communityで検証。

  • .NET SDK(dotnetコマンドに必要、コンポーネントインストール後ログインしなおさないとコマンドは使えない)
  • .NET Core 2.1 ランタイム (LTS)