This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------- | |
# GPS を使った簡易時刻合わせ (管理者権限で実行) | |
#-------------- | |
function SetDateFromGPS($portname) { | |
trap{ | |
# エラーが発生したら終了 | |
break | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------- | |
# NTP の応答を表示する | |
#-------------- | |
# NTP 積算秒数の起点時刻 (JST) | |
$ntpEpoch = New-Object System.Datetime @(1900, 1, 1, 9, 0, 0) | |
# 符号付き Int8 を取得 | |
Function getInt8($byte) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------- | |
# NTP 時刻合わせ (NTP UDP:123) | |
#-------------- | |
# NTP 積算秒数の起点時刻 (JST) | |
$ntpEpoch = New-Object System.Datetime @(1900, 1, 1, 9, 0, 0) | |
# Big Endian の符号なし Int32 を取得 | |
Function getUInt32BE($bytes, $startIndex) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# シリアル秒起点時刻 | |
$epoch = New-Object System.Datetime @(1900, 1, 1, 9, 0, 0) | |
# 現在時刻取得 (「NICT 公開 NTP サービス」を利用) | |
$ntp = Invoke-WebRequest "https://ntp-a1.nict.go.jp/cgi-bin/ntp" | |
# 現在時刻のシリアル秒を取得 | |
$xml = [xml]$ntp.Content | |
$val = [Double]($xml.HTML.BODY -replace "`n", "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub アクティブドキュメントの全角英数を半角にする() | |
Dim vsoPage As Visio.Page | |
Dim vsoShape As Visio.Shape | |
Dim vsoChar As Visio.Characters | |
Dim c As Integer | |
For Each vsoPage In Application.ActiveDocument.Pages | |
For Each vsoShape In vsoPage.Shapes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main() | |
' 鍵生成 | |
Call GetKey(publicKey, privateKey) | |
Debug.Print publicKey | |
Debug.Print privateKey | |
' 暗号化 | |
encryptString = Encrypt(publicKey, "あいう") | |
Debug.Print encryptString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ToDec32(source As String) As Integer | |
' 0x?? , &hxx , $xx は 16進数とする | |
Dim h1 = Regex.Match(source, "(?i)^(?<prefix>0x|&h|\$)(?<body>.*)$") | |
If h1.Groups("prefix").Value <> "" Then | |
Return Convert.ToInt32(h1.Groups("body").Value, 16) | |
End If | |
' ??h は 16進数とする | |
Dim h2 = Regex.Match(source, "(?i)^(?<body>.*)(?<suffix>h)$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class IniFileAccessor | |
''' <summary> | |
''' iniファイル名 | |
''' </summary> | |
Private _iniFileName As String | |
''' <summary> | |
''' 読込用テンポラリ領域 | |
''' </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -a Microsoft.VisualBasic | |
Function Send-RecycleBin($filename) { | |
(gci $filename) | | |
% { | |
Write-Host $_.FullName; | |
[Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile( | |
$_, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function VisualizeControlCharacter($s) { | |
-join ( | |
$s.ToCharArray() | | |
% { | |
switch -regex ($_){ | |
'[\u0000-\u001F]' { [Char]([Int16]$_ + 0x2400) }; | |
'[\u0020]' { [Char](0x2423) }; | |
'[\u007F]' { [Char](0x2421) }; | |
default { $_ }; |
NewerOlder