Skip to content

Instantly share code, notes, and snippets.

@t2psyto
t2psyto / gist:6f923231adb2969bda343a247910bb69
Created January 26, 2025 08:39
hide message. NHK-plus. bookmarklet
javascript:( function(){ const element = document.querySelector(".hls-player_message"); element.style.display = "none"; })();
@t2psyto
t2psyto / curl-z.bat
Last active January 22, 2025 09:00
更新されていたらダウンロードする & レスポンスコードを環境変数 http_code に格納する
rem 更新されていたらダウンロードする & レスポンスコードを環境変数 http_code に格納する
rem curl.exe -z と同様の処理を powershell で実装
rem ※ Windows 10 LTSB Version 1607 には curl.exe が標準コマンドに含まれていない
rem ※ powershell v5.1 の Invoke-webrequest は 200 以外の時に例外を吐く
set fetch_remote=https://example.org/sample.txt
set fetch_local=d:\sample.txt
set http_code=
if exist "c:\windows\system32\curl.exe" (
@t2psyto
t2psyto / show-in-gridview.ps1
Created March 27, 2024 15:20
show in gridview
$header = @("名前", "ほげ", "ふが")
$data = @(("name1", "hoge1", "fuga1"), ("name2", "hoge2", "fuga2"))
function showindatagrid($data, $header) {
Add-Type -AssemblyName PresentationFramework
# XAMLからウインドウ作成
[xml]$xaml = @'
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@t2psyto
t2psyto / openfolder.ps1
Created March 27, 2024 15:19
openfolder
function openfolder() {
# System.Windows.Formsアセンブリを有効化
[void][System.Reflection.Assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")
# OpenFileDialogクラスをインスタンス化し、必要な情報を設定
$dialog = New-Object System.Windows.Forms.OpenFileDialog
$dialog.InitialDirectory = "C:\"
$dialog.Title = "フォルダを選択してください"
$dialog.ValidateNames = 0 # falseに設定
$dialog.CheckFileExists = 0 # falseに設定
@t2psyto
t2psyto / PsQRCapture.ps1.bat
Created December 21, 2023 02:57
QRコードを画面キャプチャからデコードする。zxing.dll を使用。 powershell
<# :
@setlocal
@set _args_=%*
@powershell -noprofile "[ScriptBlock]::Create((${%~f0} | out-string)).Invoke(@(iex('&{$args} ' + $env:_args_)))"
@exit /b %errorlevel%
#>
## 以下スクリプトの内容 ##
<#
.SYNOPSIS
Simple OCR screen capture UI
@t2psyto
t2psyto / httpdate_easy.ps1.bat
Last active October 31, 2023 05:11
現在時刻を設定 (yahoo.co.jp のweb応答Dateヘッダーを利用)
@set args=%*
@powershell "iex((@('')*3+(cat '%~f0'|select -skip 3))-join[char]10)"
@exit /b %ERRORLEVEL%
Try {
# 現在時刻取得 (yahoo.co.jp のweb応答Dateヘッダーを利用)
#$ret = Invoke-WebRequest "http://www.yahoo.co.jp" -Proxy "x.x.x.x:8080"
$ret = Invoke-WebRequest "http://www.yahoo.co.jp"
@t2psyto
t2psyto / web応答計測.bat
Last active October 10, 2023 07:08
curl でwebの応答時間をログ出力する for windows環境
@echo off
setlocal enabledelayedexpansion
echo ■■ パタン1: インターネット(yahoo)
set cwd1=%~dp0
set cwd=%cwd1:~0,-1%
rem タイムスタンプ YYYYMMDD_hhmmss を取得
@t2psyto
t2psyto / main.dart
Last active June 12, 2023 05:20
flutterレイアウト
import 'package:flutter/material.dart';
//import 'package:flutter/cupertino.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
@t2psyto
t2psyto / HttpServer.ps1.bat
Created April 19, 2023 00:05
http sever by powershell
<# : by earthdiver1
@echo off
cd %~dp0
set BATCH_ARGS=%*
setlocal EnableDelayedExpansion
set "BATCH_ARGS=!BATCH_ARGS:%%=%%%%!"
set "PWSH_ARGS=" & call :quote_args !BATCH_ARGS!
Powershell -ExecutionPolicy Bypass -NoProfile -Command "$input|&([ScriptBlock]::Create((gc '%~f0'|Out-String)))" !PWSH_ARGS!
endlocal
pause & exit/b
@t2psyto
t2psyto / HttpServer.ps1.bat
Created January 11, 2023 06:58
HttpServer.ps1.bat. need to exec as administorator
<# : by earthdiver1
@echo off
cd %~dp0
set BATCH_ARGS=%*
setlocal EnableDelayedExpansion
set "BATCH_ARGS=!BATCH_ARGS:%%=%%%%!"
set "PWSH_ARGS=" & call :quote_args !BATCH_ARGS!
Powershell -NoProfile -Command "$input|&([ScriptBlock]::Create((gc '%~f0'|Out-String)))" !PWSH_ARGS!
endlocal
pause & exit/b