Skip to content

Instantly share code, notes, and snippets.

@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
@t2psyto
t2psyto / !readit
Created June 14, 2022 03:46
音声読み上げブックマークレット for android
javascript:(function(){location.href='https://www.google.com/readit?url=%27+encodeURIComponent(location.href)})()
@t2psyto
t2psyto / myipcheck.ps1
Created March 8, 2022 01:40
グローバルIPをチェックしてメール通知する。 # # globalIPに変化がなくてもメール通知する。 # globalIPに変化があった場合は追加CC先にもメールを送る。
## myipcheck.ps1
# グローバルIPをチェックしてメール通知する。
#
# globalIPに変化がなくてもメール通知する。
# globalIPに変化があった場合は追加CC先にもメールを送る。
#
# このスクリプトを myipcheck.bat から呼び出す場合::
# > powershell -NoProfile -ExecutionPolicy Unrestricted "%~dpn0.ps1"