Skip to content

Instantly share code, notes, and snippets.

View tshm's full-sized avatar

tosh shimayama (satake) tshm

View GitHub Profile
@tshm
tshm / networktest.ps1
Created March 2, 2016 08:02
web performance
# network connection test script.
$url = "http://www.google.com/"
$sleep = 1
function test() {
try {
$meas = Measure-Command {
$response = Invoke-WebRequest $url
}
@tshm
tshm / protocol.reg
Created January 7, 2016 04:01
Protocol Association for Windows.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\xxx]
@="URL:xxx Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\xxx\shell]
[HKEY_CLASSES_ROOT\xxx\shell\open]
@tshm
tshm / collectinfo.bat
Last active May 26, 2022 12:26
information collection batch script
pushd c:\log
systeminfo > systeminfo.txt
msinfo32 /report msinfo32.txt
ipconfig /all > ipconfig.txt
schtasks /query /V > schtasks.txt
net use > netuse.txt
@tshm
tshm / tail.ps1
Last active December 22, 2015 17:15
tail command with powershell
# get-date -format yyyyMMdd | %{ $dd = $_ }
$dd = $(get-date -format yyyyMMdd)
cat ("C:\log\{0}.log" -f $dd) -wait -tail 10
@tshm
tshm / template.bat
Last active August 5, 2016 04:38
powershell template
@findstr/v "^@f.*&" "%~f0"|powershell -&goto:eof
Write-Output "Hello World"
@tshm
tshm / createwim.bat
Created July 21, 2015 11:33
make wim image.
Dism /Capture-Image /ImageFile:F:\win8.wim /CaptureDir:D:\ /Name:"win8"
internal static class StatusObserverFactory
{
static public IObservable<bool> GetPowerStatusObserver()
{
var obs = Observable.FromEvent<PowerModeChangedEventHandler, PowerModeChangedEventArgs>(
evc => (sender, evt) => evc(evt),
h => SystemEvents.PowerModeChanged += h,
h => SystemEvents.PowerModeChanged -= h
).Where(evt => evt.Mode == PowerModes.StatusChange)
.Select(
@tshm
tshm / cmdexecution.cs
Created June 13, 2015 07:51
command execution example
private int runCommand(string cmd, string args)
{
Log("コマンド実行:\n\t{0} {1}\n", cmd, args);
System.Diagnostics.Process process = new System.Diagnostics.Process()
{
StartInfo = new System.Diagnostics.ProcessStartInfo()
{
RedirectStandardOutput = true,
UseShellExecute = false,
@tshm
tshm / resexp.bat
Last active May 31, 2017 11:34
restarting explorer
@echo off
taskkill /f /IM explorer.exe
if ERRORLEVEL 1 goto :err
start "" "explorer.exe"
exit
:err
echo ----------- failed -----------
pause
@tshm
tshm / ap.bat
Created April 17, 2015 03:23
create ap on windows pc
netsh wlan set hostednetwork mode=allow ssid=”MySSID” key=”passwd”