Skip to content

Instantly share code, notes, and snippets.

function Get-SP500 {
$res = Invoke-WebRequest -Uri 'https://www.bing.com/search?q=sp500'
$content = $res.Content
$m = [Regex]::Match($content, '<span class="fin_scibr">([\d\.,]+)</span>')
$m.Groups[1].Value
}
function Get-USDJPY {
@Y-Koji
Y-Koji / ActionCommand.cs
Last active November 4, 2020 13:40
WPF Support Codes
using System;
using System.Windows.Input;
public class ActionCommand : ICommand
{
public event EventHandler CanExecuteChanged;
private ActionCommand() { }
private Func<object, bool> _CanExecute { get; set; }
private Action<object> _Execute { get; set; }
@Y-Koji
Y-Koji / ImageCompare.ps1
Last active March 31, 2020 13:39
PowerShell で画像比較
using assembly System.Drawing
using namespace System.Drawing
using namespace System.Drawing.Imaging
using namespace System.Runtime.InteropServices
# 画像比較関数
# $img1 : 比較元画像
# $img2 : 比較先画像
# 備考
# $img1, $img2 には同じサイズの画像を指定すること
@Y-Koji
Y-Koji / PropetyChangedRaisableProperty.snippet
Created October 19, 2019 09:44
INotifyPropertyChanged 実装時のプロパティ定義用VisualStudioスニペット
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>通知可能プロパティ</Title>
<Shortcut>pprop</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[
@Y-Koji
Y-Koji / DictionaryProxy.cs
Created July 27, 2019 08:58
C# Data Objects
using System.Collections;
using System.Collections.Generic;
/// <summary>データ表現用共通オブジェクト (Dictinaryプロキシクラス)</summary>
/// <typeparam name="TKey">The type of keys in the dictionary.</typeparam>
/// <typeparam name="TValue">The type of values in the dictionary.</typeparam>
public class DictionaryProxy<TKey, TValue> : IDictionary<TKey, TValue>
{
private IDictionary<TKey, TValue> dictObj = new Dictionary<TKey, TValue>();
@Y-Koji
Y-Koji / F# SQLiteの設定.md
Last active August 31, 2019 12:32
備忘録

F# SQLiteの設定

1. パッケージの追加

NuGetにより以下のパッケージを導入する.

  • System.Data.SQLite.Core
  • SQLProvider

System.Dataを参照に追加する.

function Speak-Text {
param($text)
Add-Type -AssemblyName System.Speech
$ss = New-Object System.Speech.Synthesis.SpeechSynthesizer
$ss.Volume = 100
$ss.SelectVoiceByHints(
[System.Speech.Synthesis.VoiceGender]::Female,
@Y-Koji
Y-Koji / HttpRequest.fs
Last active June 1, 2019 00:26
F# 備忘録
open FSharp.Data
[<EntryPoint>]
let main argv =
let req =
Http.AsyncRequest(
"http://url/",
httpMethod = "POST",
headers = [ "Key", "Value"; ],
body = FormValues [ "Key", "Value"; ],
@Y-Koji
Y-Koji / fsx.reg
Last active March 7, 2019 12:35
F# スクリプト ダブルクリック起動有効化するやつ
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.fsx]
[HKEY_CLASSES_ROOT\.fsx\Shell]
[HKEY_CLASSES_ROOT\.fsx\Shell\Open]
[HKEY_CLASSES_ROOT\.fsx\Shell\Open\Command]
@="C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\FSharp\\fsi.exe \"%1\" %*"
@Y-Koji
Y-Koji / MainWindow.xaml
Last active February 8, 2019 12:59
黒魔術でINotifyPropertyChanged自動実装
<Window x:Class="RexView.View.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:ViewModel"
xmlns:mvvm="clr-namespace:MVVM"
xmlns:m="clr-namespace:Model"
mc:Ignorable="d"