Skip to content

Instantly share code, notes, and snippets.

@CannoHarito
CannoHarito / Keep-Awake.ps1
Last active July 22, 2024 23:53
放置時のデバイスのスリープや画面の電源オフを無効にするPoweshell
# @stringTrimmer https://gist.github.com/jamesfreeman959/231b068c3d1ed6557675f21c0e346a9c
Param([int]$seconds = -1, [switch]$display)
$Signature = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern void SetThreadExecutionState(uint esFlags);
"@
$ES_SYSTEM_REQUIRED = [uint32]"0x00000001"
$ES_DISPLAY_REQUIRED = [uint32]"0x00000002"
$ES_CONTINUOUS = [uint32]"0x80000000"
@CannoHarito
CannoHarito / Invoke-Regnus-Clock.ps1
Created December 31, 2023 08:51
BLUE PROTOCOL(ブルプロ)のレグナス時間をターミナルのプロンプトで表示するPowerShell
. .\Regnus-Clock.ps1
# 更新間隔秒数
$tickDuration = 10
function Invoke-Regnus-Clock {
$currentName = Get-Name
$first = Get-Next-Term
$second = $first | Get-Next-Term
try {
while (1) {
@CannoHarito
CannoHarito / regnus-clock.ts
Last active November 29, 2023 15:49
BLUE PROTOCOL(ブルプロ)のレグナス時間を求めるTypeScript。 単なる推測です。ゲームと一致するか保証しません。
export interface RegnusClock {
isNight: boolean
remainSecond: number
}
// レグナスの1日は50分
const dayDuration = 50 * 60;
// UTC00:00:00はレグナスの朝の12.5分前?
// const regnusStart = -12.5 * 60;
// 実際は22秒ずれてる? //750?740?728?
const regnusStart = -728;
@CannoHarito
CannoHarito / Copy-ALLB-Screenshot.ps1
Last active February 26, 2024 07:01
DMM版アサルトリリィLastBulletでゲーム内メニューでスクリーンショットを取り共有をキャンセルした画像ファイルをコピーするPowershell
$from = "~\AppData\LocalLow\Pokelabo\Assaultlily\LilyProject.png"
if (Test-Path $from) {
$to = "./" + (Get-ChildItem $from).LastWriteTime.ToString("yyyyMMdd_HHmmss") + ".png"
Copy-Item $from $to
}
else {
Get-ChildItem $from
Pause
}
@CannoHarito
CannoHarito / Add_CancelKeyPress.ps1
Created November 17, 2022 06:09
PowershellからFormを描画した際にコンソールへのCtrl+Cで終了したい。Powershellで[System.Console]::Add_CancelKeyPress({})をすると異常終了する。C#で書けば動いた
Add-Type -AssemblyName System.Windows.Forms
$CK = Add-Type -ReferencedAssemblies 'System.Windows.Forms' -PassThru -TypeDefinition @"
using System;
using System.Windows.Forms;
public class CancelKey{
public static void Main() {
Console.CancelKeyPress += (sender, e) => {
// trueにすると、プログラムを終了させない
e.Cancel = true;
Console.WriteLine("CTRL+C が押されました");
@CannoHarito
CannoHarito / Switch-Lineinput.ps1
Created November 12, 2022 10:40
音声入力デバイスの"このデバイスを聴く"を切り替える 参考文献https://nyanshiba.hatenablog.com/entry/2017/08/21/221555
# https://nyanshiba.hatenablog.com/entry/2017/08/21/221555
param([int]$InputDevice = 3)
# Add-Type -AssemblyName System.Windows.Forms
$wshShell = New-Object -ComObject WScript.Shell
function Send-Keys {
param(
[Parameter(ValueFromPipeline = $true)][string]$key,
[int]$wait = 100
)
Process {
@CannoHarito
CannoHarito / scanner.yolol
Last active October 31, 2022 07:56
[Starbase Game] Material point scanner script for Origin's Safezone : display stacks and price
s=1728 o=" Ore" c=" Crystal" in="\nScanning..." no="\nNo Result"
m1="Ajatite" p1=.544 m2="Valkite" p2=p1 m3="Ice" p3=.816 m4="Bastium"
p4=.87 m5="Vokarium" p5=.979 m6="Nhurgite" p6=2.721 m7="Charodium"
p7=3.81 m8="Exorium" p8=4.354 m9="Aegisium" p9=2.503
// end of init
:Materials=no
e="" i=0 sr="" cr=0 :Scan=1 goto7+:ScanOre
:Materials=in ifi>=:ScanResults thengoto6*(i>0)+6end :Index=i
m=:Material-o-c v=:Volume/s i++ sr+="\n"+m+"\n"+v+" stks"
p=(m==m1)*p1+(m==m2)*p2+(m==m3)*p3+(m==m4)*p4+(m==m5)*p5+(m==m6)*p6
@CannoHarito
CannoHarito / Enter-TTS-Console.ps1
Last active November 15, 2023 05:43
powershellがしゃべるやつ。Ctrl+Cで終わればよいだろう。
param([Int]$volume, [string]$voice)
# & .\Enter-TTS-Console.ps1 -voice 'Microsoft Zira Desktop'
# in cmd.exe: powershell .\Enter-TTS-Console.ps1 -voice 'Microsoft` Zira` Desktop'
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
if ($volume) {
$speak.Volume = $volume
}
if ($voice) {
@CannoHarito
CannoHarito / benchmark1_20-10-2020_06-40-23.txt
Created October 20, 2020 06:53
Stormworks benchmark. GPU Link width PCI-Express x4. ASUS PH-GTX1650-O4GD6
==========Hardware==========
OS: Windows 64Bit
CPU: AMD Athlon 200GE with Radeon Vega Graphics
RAM: 16384MB RAM
GPU Vendor: NVIDIA Corporation
GPU: GeForce GTX 1650/PCIe/SSE2
OpenGL: 4.6.0 NVIDIA 456.71
==========Config==========
Window Mode: Windowed
@CannoHarito
CannoHarito / COOKPAD-ShowReportCount.user.js
Last active January 15, 2024 06:02
ブラウザプロファイルをクラッシュしたので、以前使っていたものに近いのを探した。ちょっと古かったので作り直した。
// ==UserScript==
// @name COOKPAD - Show Report Count
// @version 2024-01-15
// @description Cookpadのレシピへの文字列リンクにつくれぽ数を表示する
// @namespace http://iwamot.com/
// @match https://cookpad.com/*
// @grant none
// @website http://d.hatena.ne.jp/samurai20000/20090715/1247668133
// @website https://github.com/iwamot/cookpad-show-report-count
// @downloadURL https://gist.githubusercontent.com/CannoHarito/a4b61f812ace98a86e203605c1f5303c/raw/