Skip to content

Instantly share code, notes, and snippets.

#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 / 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
@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 / 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
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 / drawingTs.d.ts
Last active August 29, 2015 14:14
DrawingTs declared types
declare module DrawingTs {
class Point {
public x: number;
public y: number;
constructor(x: number, y: number);
public to(p: Point): Vector;
public scale(n: number): Point;
}
class Vector extends Point {
constructor(x: number, y: number);
@pierre3
pierre3 / chatHub.cs
Last active August 23, 2021 18:35
Generate SignalR HubProxies for TypeScript
using Microsoft.AspNet.SignalR;
namespace hubProxyGen
{
public class ChatHub : Hub<ChatHubClient>
{
public void Send(string name, string message)
{
Clients.All.AddNewMessageToPage(name, message);
}
@pierre3
pierre3 / search-google.ps1
Created June 26, 2015 13:03
google web search commandlet
function Search-Google
{
[CmdletBinding()]
Param(
# 検索ワード
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
Position=0)]
[PSObject[]]
$SearchWords
@pierre3
pierre3 / GoogleSuggestCompletion.ps1
Last active December 3, 2015 12:51
TabExpansion++ Argument Completer for Search-Google
# TabExpansion++ を使用する場合
function GoogleSuggestCompletion {
# この属性でターゲットとなるコマンドとパラメータを指定する
[ArgumentCompleter(
Parameter = 'SearchWords',
Command = 'Search-Google',
Description='TabExpansion++ Argument Completer for Search-Google')]
# 入力パラメータこの通りにする。$wordToComplete に入力中の値が入ってくる。
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
using Microsoft.Diagnostics.Tracing;
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Management.Automation;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
namespace EtwStream.PowerShell