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 getNicName($deviceName) { | |
$na = Get-WmiObject Win32_NetworkAdapter | ? {$_.Name -eq $deviceName} | |
$na.NetConnectionID | |
} |
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
'------------------------------------------------------------------ | |
' Excel VBA (標準モジュール) | |
' 日付を指定すると休みの属性に応じて、祝/休/振/日/土、を戻します。平時は空文字。 | |
'------------------------------------------------------------------ | |
' 諸注意 | |
' 2019年,2020,2021 年に対応しました。 | |
' ①春分の日と秋分の日は計算するのが面倒なので、Wikipedia から予想日をコピペしています。(汗 | |
' 前年に官報で発表される日付と違っていた場合は、適宜修正してください。 | |
' ②春分の日と秋分の日は 2000 年から設定していますが、他の祝日は 2013 年以前の状況を反映しません。(例:みどりの日) | |
' あくまで今年 2014 年以降の表示用のプログラムです。過去の祝日を正確に反映したい場合は、修正が必要です。 |
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
# ipv4,ipv6 共通処理 | |
Function executeTCPing($tcp) { | |
$sw = New-Object System.Diagnostics.Stopwatch | |
$sw.Start() | |
try { | |
$tcp.Connect($target, $port) | |
$sw.Stop() | |
Write-Output ("{0} port={1} ({2}) への接続: 時間 ={3:0.00}ms" -f $target, $port, $tcp.Client.RemoteEndPoint, ($sw.Elapsed).TotalMilliseconds) |
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
Public Class Matrix | |
''' <summary> | |
''' 乗算 | |
''' </summary> | |
Public Shared Function Multiply(multiplicandMatrix As Double(,), | |
multiplierMatrix As Double(,)) As Double(,) | |
Dim matA = multiplicandMatrix | |
Dim matB = multiplierMatrix |
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
Public Class Regression | |
''' <summary> | |
''' 係数の取得 | |
''' </summary> | |
Public Shared Function GetPolynomialCoefficients(y As Double(), x As Double(), degree As Integer) As Double() | |
Dim Ymax = y.GetUpperBound(0) | |
Dim Xmax = x.GetUpperBound(0) | |
Dim N = degree |
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 CPing($from, $to, $timout) { | |
# タイムアウト値設定 | |
$w = [int]$timout; | |
if ($w -le 0) { | |
$w = 50; | |
} | |
# ipv4アドレス分解 | |
$f = $from -split "\." |
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
Public Shared Function GetIPv4FirstAddress(address As String) As Net.IPAddress | |
Dim entries = Net.Dns.GetHostAddresses(address) | |
For Each ip In entries | |
If ip.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then | |
Return ip | |
End If | |
Next |
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 PasteDisplayInterior() | |
Set wsh = CreateObject("WScript.Shell") | |
cmd = "Powershell -sta -command " _ | |
& """" _ | |
& " Add-Type -an System.Windows.Forms; " _ | |
& " $a = [System.Windows.Forms.Clipboard]::GetData('HTML Format'); " _ | |
& " [System.Windows.Forms.Clipboard]::Clear(); " _ | |
& " [System.Windows.Forms.Clipboard]::SetData('HTML Format', $a); " _ |
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
''' <summary> | |
''' 丸め | |
''' </summary> | |
''' <remarks> | |
''' 参考) | |
''' http://ja.wikipedia.org/wiki/%E7%AB%AF%E6%95%B0%E5%87%A6%E7%90%86#.E4.B8.B8.E3.82.81.E3.81.AE.E7.A8.AE.E9.A1.9E | |
''' http://rurema.clear-code.com/2.1.0/method/BigDecimal/s/mode.html | |
''' </remarks> | |
Public Class Rounding | |
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
' 標準モジュールに作成する | |
' 自ワークブック名を取得する | |
' 使い方) =ThisWorkbookName() | |
Function ThisWorkbookName() As String | |
Application.Volatile | |
ThisWorkbookName = Application.ThisWorkbook.Name | |
End Function | |
' 自ワークシート名を取得する |
OlderNewer