Skip to content

Instantly share code, notes, and snippets.

function Get-DatePicker
{
[CmdletBinding()]
[OutputType([System.DateTime])]
Param([string]$windowTitle=$null)
Add-type -AssemblyName "System.windows.forms"
$winForm = New-object Windows.Forms.Form
if([string]::IsNullOrEmpty($windowTitle)){
$winForm.Text = "DatePicker Control"
@pierre3
pierre3 / Get-GooLabsEntity.ps1
Created December 7, 2014 02:07
https://labs.goo.ne.jp/ の固有表現抽出APIを使用して、文字列から固有表現を取得する PowerShell function
<#
.Synopsis
文字列から固有表現の抽出
.DESCRIPTION
https://labs.goo.ne.jp/ の固有表現抽出APIを使用して、文字列から固有表現を取得します
https://labs.goo.ne.jp/apiusage/ で取得したアプリケーションIDを $AppId パラメータに指定する必要があります。
.EXAMPLE
Get-GooLabsEntity "今日、田中君と山本君に渋谷で待ち合わせをしています。" -AppId $app_id
.EXAMPLE
Get-Content ".\data.txt" | Get-GooLabsEntity -AppId $app_id
@pierre3
pierre3 / Get-WebText.ps1
Created December 7, 2014 02:04
指定したUrlのHTMLドキュメントからTextノードのみを抽出するPowershell function
<#
.Synopsis
WebページからTextを取得
.DESCRIPTION
指定したUrlのHTMLドキュメントからTextノードのみを抽出します。
.EXAMPLE
Get-WebText "http://example.com"
.EXAMPLE
"http://example1.com","http://example2.com","http://example3.com" | Get-WebText
#>
@pierre3
pierre3 / Search-Web.ps1
Last active August 29, 2015 14:10
Google検索を行い、検索結果リンクのタイトルとUrlを取得するPowerShell function
<#
.Synopsis
Web検索
.DESCRIPTION
Google検索を行い、検索結果リンクのタイトルとUrlを取得します
.EXAMPLE
$words = 'powerShell', 'script', 'example'
$words | Search-Web
.EXAMPLE
Search-Web powerShell,script,example
#1. モジュールのインポート
PS C:\> Import-Module path\to\posh-todo.psm1
#2. ToDoデータ保存先ファイル名を指定してposh-todoを開始
PS C:\> Start-PoshTodo D:\todo\myTodo.json
# 指定したファイル内に登録済みのToDoが存在すればその一覧が表示されます。ファイル自体が無い場合は作成されます
<#
##### ToDo List #####
#>
# ** 上記の2行はプロファイル内に記述しておけば、毎回入力する手間が省けて良いです **
@pierre3
pierre3 / Linq_verbose.ps1
Created October 1, 2014 15:05
Linq.ps1 with Write-Verbose
function Where-Block
{
[CmdletBinding()]
[OutputType([scriptblock])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
Position=0)]
[PSObject]
@pierre3
pierre3 / Linq.ps1
Last active August 29, 2015 14:07
[PowerShell] A enumeration cmdlet of delayed evaluation.
function Where-Block
{
[CmdletBinding()]
[OutputType([scriptblock])]
Param
(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
Position=0)]
[PSObject]
@pierre3
pierre3 / Iterator.cs
Last active August 29, 2015 14:06
Iterator class for debug
using System;
using System.Collections.Generic;
using System.Linq;
namespace IteratorTest
{
public static class IteratorHelper
{
//インスタンス生成を楽するためのショートカット
public static Iterator<T> CreateIterator<T>(params T[] source)
@pierre3
pierre3 / MarkdownPreview.ps1
Last active August 29, 2015 14:06
お好みのテキストエディタにMarkdownプレビュー機能を追加するPowerShellスクリプト
# このスクリプト自身が格納されているディレクトリを取得
$Script:scriptDir = Split-Path $MyInvocation.MyCommand.Definition -Parent
<#
.Synopsis
Markdownテキストのプレビュー
.DESCRIPTION
Markdown形式で記述されたテキストファイルの内容をHTMLに変換し、ブラウザでプレビュー表示します。
.EXAMPLE
PS C:\> Start-Markdown .\markdownText.md
@pierre3
pierre3 / RoslynSample.cs
Created July 5, 2014 00:57
C# Interactive interpreter-like console app
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Collections.Generic;
namespace ConsoleApplication1
{