PowerShellからマルチスクリーンの解像度を取得

Windows の PowerShellから、マルチスクリーンの解像度を取得する方法。

PS> Add-Type -AssemblyName System.Windows.Forms
PS> [System.Windows.Forms.Screen]::AllScreens

BitsPerPixel : 32
Bounds       : {X=0,Y=0,Width=2560,Height=1440}
DeviceName   : \\.\DISPLAY1
Primary      : True
WorkingArea  : {X=0,Y=0,Width=2560,Height=1400}

BitsPerPixel : 32
Bounds       : {X=2560,Y=0,Width=1344,Height=840}
DeviceName   : \\.\DISPLAY2
Primary      : False
WorkingArea  : {X=2560,Y=0,Width=1344,Height=800}

Add-Type -AssemblyName System.Windows.Formsで、PowerShell以外のAPIにアクセスできるようにして、WPFのライブラリを叩けるようにするのが肝。

Via! https://stackoverflow.com/questions/7967699/get-screen-resolution-using-wmi-powershell-in-windows-7

既存のレポジトリに.gitignoreを後から反映させる方法

あとから、.gitignoreを設置したけど、一発で.gitignoreを全体に反映させる。

一気に、レポジトリから削除(除外)

以下のコマンドで、.gitignoreから除外を反映させる

$ git rm --cached `git ls-files --full-name -i --exclude-from=.gitignore`

確認&反映

$ git status
$ git commit -m 'Reflected .gitignore'

via!
あとからまとめて.gitignoreする方法

Amazonで買う圧着チューブセット

センサーの結線で必要だったので、新規に圧着チューブとヒートガンをAmazonで手に入れる。

(STRAIGHT/ストレート) 熱収縮チューブ セット ブラック 100ピース 35-311

φ1.5mm、φ2.5mm、φ4.0mm、φ6.0mm、φ10.0mm、φ13.0mmの6種類が一気にセットになっているので、ちまちまとφと合わせて買わなくて便利。

ヒートガン 1800W 強弱2段階切り替え可能 アタッチメント付き

ヒートガンは、ピンキリで出ていますが、ベストセラーになっていた程良い値段のものを。意外とサイズが大きいです。吹き出し口のアタッチメントが数種類付いていて、便利。

UniRxでTimer処理を行う方法

UniRxでTimer処理を行う方法

	Observable.Interval(TimeSpan.FromMilliseconds(1000)).Subscribe(l =>
        {
		//Something Do            
        }).AddTo(this);		

TimeSpan.FromMilliseconds(1000)で、ミリ秒で待ち時間を設定する。