qshinoの日記

Powershell関係と徒然なこと

2017-03-01から1ヶ月間の記事一覧

Screen Capture

PC

Ezvid https://www.ezvid.com/download 参考 http://www.hongkiat.com/blog/win-screen-recording-softwares/ https://www.ezvid.com/download

PPPoE

PPPoE PPPoEは二つのセッションに別れる。 Discovery PPP Discovery ここでは、PPPoE Active Discovery パケットがやり取りされる。本パケットには、下記のものがある。 PADI. : Initialize PDO. : Offer PADR : Request PADS : Session-Confirmation PPP PP…

EtherIP/IPsec

EtherIP/IPsec Softether + IX2000シリーズ。 ike mode aggressive ipsec mode tunnel ike id 入力値 pre-shared-key 入力値 peer se側 恐らくany peer ix側 seのIP nat traversal on ike aes / sha DH group2/ 1024bit ipsec aes/sha パケット 元 eth ip0 p…

Windows Installer作成ツール

PC

Windows Installer作成ツール 主なツールは下記の通り。 WiX Toolset Inno Setup Nullsoft Scriptable Install System (NSIS) WiXのみ、WindowsInstallの仕組みを利用している。 WiXが難しそうなので、トライして撃退されたらInno Setupが良さそうな雰囲気。…

PowerShell Action delegate

PowerShell Action delegate Action/Funcはdelegate型 Action : 戻り値なし、引数なし。 Action: 戻り値なし、引数1 Func<T,TResult: 戻り値1,引数1 PowerShellでは [action] [action[int]] [func[int][int]] ? or func[int,int]] ? Funcの例 Func<T,TResult> using System; public class GenericFunc { public static void Main() { // Instantiate deleg…</t,tresult:>

wpf messagebox

wpf

wpf messagebox Show(msg) Show(msg,caption) 参考

wpfクリップボード

wpf

wpfでクリップボードを使う。 クリップボードへのテキストコピーは、 Clipboard.SetData(DataFormats.Text, (Object)txet); 取り出すには、同様にGetDataを用いる。 サンプル // copy string string textData = "Hinan."; // To clipboard Clipboard.SetData…

wpf window owner property

wpf

owner property Windowの親子関係と振る舞い。親子関係は、子のowner propertyに親を設定する事で決まる。親子関係を設定した場合、どちらかのウインドウの振る舞いが他に影響する。未設定の場合は影響しない。また、ユーザープログラムが子ウインドウのowne…

CSS練習

CSSの練習 h1. だけ。 影使ったもの h1 { padding: .5em .75em; background-color: #f6f6f6; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); } 番号付き body { counter-reset: secno } section { counter-increment: secno; } h1 { position: relative; paddin…

wpf webbrowser class

wpf

wpf webbrowser class class : System.Windows.Controls.WebBrowser 例 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="hdoc" Height="300" Width="300"> <StackPanel> <WebBrowser Name="ax" Source="c:¥poi.html" /> </webbrowser></stackpanel></window>

html文字セット

html文字セット <meta http-equiv="Content-Type" content="text/html; charset="> 文字セット一覧。 Shift-JIS EUC-JP ISO-2022-JP UTF-8 例) <meta http-equiv="Content-Type" content="text/html; charset=Shift-JIS"> 参考 http://www.dspt.net/html_tag/001_data/017.html</meta></meta>

WPF背景色

wpf

wpf背景色 WPFでコントロールに背景色を付ける。 気合いでやるなら、このぐらい。 <Window x:Class="BackgroundColorChange.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Keypad" Height="500" Width="500"> </window>

WPF ShowDialog()中の非同期イベント

ShowDialog()中に非同期イベントを処理できない。 Powershell でWPFのShowDialog()を処理中に非同期イベントが発生しても処理されない件、原因不明ながら回避策にて対応。 なお、イベントの発生と処理は別物。発生時刻をイベントのプロパティTimeGeneratedで…

Application.Run()

wpf

Applucation.Run() 何をしているのか? MSDN/wpfだとあっさりと、 Run() Starts a Windows Presentation Foundation (WPF) application. Run(Window) Starts a Windows Presentation Foundation (WPF) application and opens the specified window. さて App…

AppDomain

AppDomain .Netの実行環境階層構造 Process – AppDomain —- RunSpace かな? Process メモリ空間を共有する。 AppDomain : アセンブリ空間共有 RunSpace : コンテキスト共有 一つのAppDomainに最大1つのアプリケーションクラスを持てる。 コード例/msdn usin…

2015国内情報セキュリティ市場

国内情報セキュリティ市場 参考 http://www.jnsa.org/result/2016/surv_mrk/data/2015_mrk-report_sokuhou.pdf

SynchronizingObject

SynchronizingObject on powetshell Start-ProcessのExitedイベントの終了処理で、wpfのLabel.Contentを変更したい。 それだけ。 $proc = Start-Process "poi.bat" -passThru $ev = Register-ObjectEvent $proc -EventName Exited -Action { AddText("hoge")…

teraterm log auto close

teraterm log auto close logautoclosemode 1 logopen 'D:\teraterm_sample.log' 0 0 ; do something... end ``` # 参考 https://ttssh2.osdn.jp/manual/ja/macro/command/logautoclosemode.html

git 作業ディレクトリの変更を戻す

git

作業ディレクトリの変更を戻す by git 作業したが変更を戻したい。 git checkout . これでカレント作業ディレクトリの変更を戻してくれるが、新規に作成したファイルは削除してくれず、手作業で削除する。なお、飽くまで作業ディレクトリの内容なので親ディ…

RunSpace

RunSpace 参考 https://msdn.microsoft.com/ja-jp/library/system.management.automation.runspaces.runspace(v=vs.85).aspx https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/26/beginning-use-of-powershell-runspaces-part-1/ https://www.g…

WPF Clipboard

Clipboad on wpf by powershell PowerShellでWPFのクリップボードを使う。 [Windows.Clipboard] のGetText(), SetText()を使う。 $get = [Windows.Clipboard]::GetText() [Windows.Clipboard]::SetText("oha") [Windows.Clipboard]::Clear() 但し、下記が必…

.Netで作るPowerShellコンソール

Poweshellコンソール by wpf まさに欲しかったもの。PowerShellコンソールをWPFに組み込む。 肝はPowershll.Create()でPowershell を生成する事。 using (var powershell = PowerShell.Create()) { powershell.AddCommand("Get-ChildItem"); powershell.AddC…

Exited Event非同期対応

Start-ProcessのExitedEvent Thread Strart-ProcessのExited EventはデフォルトではSystem thread pool から実行される。UI系とは異なるため、UI系を制御すると問題が発生しやすい。 そのため、Formなどで使用するためにSynchronizingObject にUIオブジェク…

リモートデスクトップ via https/443

リモートデスクトップをHttpsで/ssl飛ばす。 myrtilleで可能な模様。WebSocketを使用している模様。 参考 https://github.com/cedrozor/myrtille/blob/master/README.md

WPF messageBox by PowerShell

WPF messageBox MessageBoxResult result = MessageBox.Show("Do you want to close this window?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { Application.Current.Shutdown(); } 参考 M…

Windows ping応答許可

PC

Windows Ping応答許可 ファイアーウォールで許可 参考 http://www.cloudn-service.com/faq/2165

実行ユーザー取得 by PowerShell

PowerShellで実行ユーザー取得 $id = [System.Security.Principal.WindowsIdentity]::GetCurrent() $uname = $id.Name $groupsids = $id.Groups $groupsids | foreach{ $_.Translate([System.Security.Principal.NTAccount]) } 参考 WindowsIdentity http://…

IIS ftpサイト起動

ftp起動 $ftpSite.Start()はダメで、正しくは$ftpsite.ftpserver.Start()なのね。 ftpサーバーをスタートすれば良かったのね $ftpSite = IIS:\Sites\FtpData $ftpSite.ftpServer.Start() 参考 http://stackoverflow.com/questions/23015011/start-ftp-websit…

Pester

Pester for PowerShell 実行方法 雛形生成 New-Fixture .\bin Code テスト実行 Invoke-Pester .\bin\Code.Tests.ps1 テスト記法 Describe "Code" { Context "poi1" { It "Test Case 1" { $data | should Be $null } It "TestCase2" { "" | Should exist } } …

PSScriptAnalyzer for PowerShell

PSScriptAnalyzer for PowerShell 使い方 Invoke-ScriptAnalyzer SCRIPT 使うまで Download from GitHub Install-Module -Name PSScriptAnalyzer or git clone https://github.com/PowerShell/PSScriptAnalyzer or download from https://github.com/PowerSh…