PowerShell v3 以降のそれぞれのバージョン毎のスクリプティングを中心とした新機能のうち、私の独断で選んだ主な機能を列挙しました。
(PowerShell の本来の役割のはずの) コンピュータ管理機能などはばっさり省いています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const baseElm = $0; | |
document.addEventListener('copy', (e) => { | |
e.preventDefault(); | |
e.clipboardData.setData('text/plain', baseElm.closest('div.page').querySelector('canvas').toDataURL('image/png')); | |
console.log('png image copied!'); | |
}, { once: true }); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start /MIN powershell -File "%~dpn0.ps1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$apkfiles = gci D:\Android\data\com.think_android.appmanagerpro\files\appmonster3\backup\*\rev\*.apk | |
$deletedlist = New-Object System.Collections.Generic.List[string]; | |
$apkgrp | %{ | |
$targets = $_.Group | |
$filessorted = $targets | ?{ $_.Length -NE 0 } | sort { [long][System.IO.Path]::GetFileNameWithoutExtension($_.Name) }; | |
$saved = @(); | |
$saved += $filessorted | select -First 1; | |
$saved += $filessorted | group { [System.Math]::Floor([System.Math]::Log10( [long][System.IO.Path]::GetFileNameWithoutExtension($_.Name) )) } | %{ $_.Group | select -Last 1; }; | |
$targets -notcontains $saved; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff --name-only <commit> HEAD --diff-filter=CMART | gi | %{ $_.LastWriteTime = [datetime](git log --pretty=format:%ci --max-count=1 $_.FullName) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$a = @{} | |
$b = New-Object hashtable | |
$a['a'] = 1 | |
$a['A'] = 2 | |
$b['a'] = 1 | |
$b['A'] = 2 | |
$a | |
# Name Value | |
# ---- ----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ConnectionStrings": { | |
"DefaultConnection": "Filename=Blogging.db" | |
}, | |
"Logging": { | |
"IncludeScopes": false, | |
"LogLevel": { | |
"Default": "Debug", | |
"System": "Information", | |
"Microsoft": "Information" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Automatic nanaco gift card registration tool PowerShell edition. | |
.DESCRIPTION | |
Set either 'CardNumber' or 'Password' parameter. | |
<CommonParameters> is not supported. | |
.EXAMPLE | |
PS > $NanacoNumber = '0000000000000000'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[source]] | |
name = "pypi" | |
url = "https://pypi.org/simple" | |
[dev-packages] | |
pylint = "*" | |
mypy = "*" | |
[packages] | |
selenium = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Give the template inheritance of the `extends` tag as a template source string. | |
""" | |
from flask import Flask, render_template_string | |
from datetime import datetime | |
app = Flask(__name__) |
OlderNewer