PowerShell v3 以降のそれぞれのバージョン毎のスクリプティングを中心とした新機能のうち、私の独断で選んだ主な機能を列挙しました。
(PowerShell の本来の役割のはずの) コンピュータ管理機能などはばっさり省いています。
This file contains hidden or 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
[regex]::Replace((Get-Clipboard -Raw), '\[([a-zA-Z]{1,14})(?: lang(?:uage)?="(.*?)")?\](.*?)\[/\1\]', { | |
param([System.Text.RegularExpressions.Match]$m); | |
switch ($m.Groups[1].Value) { | |
'cci' { | |
return '`' + [System.Web.HttpUtility]::HtmlDecode($m.Groups[3].Value) + '`' | |
} | |
{ 'code', 'cc' -contains $_ } { | |
return '```' + $m.Groups[2].Value + [System.Web.HttpUtility]::HtmlDecode($m.Groups[3].Value) + '```' | |
} | |
default { |
This file contains hidden or 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
FROM alpine:3.10 | |
RUN mkdir -p /samba/share && \ | |
chmod -R 0777 /samba/share && \ | |
chown -R nobody:nobody /samba/share | |
# install samba | |
RUN apk update && \ | |
apk add samba | |
RUN { \ |
This file contains hidden or 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
<############################################################### | |
タスクトレイに常駐し、クリックされると特定のスクリプトを実行するコード | |
###############################################################> | |
#Requires -Version 3 | |
param( | |
# アイコンクリック時に実行する スクリプトファイル または スクリプトブロック | |
[parameter(Mandatory)] | |
[ValidateNotNull()] | |
[ValidateScript({ $_ -is [string] -or $_ -is [scriptblock] })] | |
$Script, |
This file contains hidden or 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
--- | |
- hosts: all | |
vars: | |
venv_dir: /tmp/venv-awx | |
awx_repo: https://github.com/ansible/awx.git | |
awx_repo_dir: /tmp/awx | |
awx_version: 9.0.1 | |
postgres_data_dir: /tmp/pgdocker | |
#http_proxy: http://proxy.example.com | |
#https_proxy: http://proxy.example.com |
This file contains hidden or 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
#Requires -Version 5.0 | |
[CmdletBinding(DefaultParameterSetName = "Path")] | |
param( | |
[Parameter(Mandatory, ParameterSetName="Path", Position = 0)] | |
[System.String[]] | |
$Path, | |
[Parameter(Mandatory, ParameterSetName="LiteralPath", ValueFromPipelineByPropertyName = $true)] | |
[Alias("PSPath")] | |
[System.String[]] |
This file contains hidden or 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__) |
This file contains hidden or 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 hidden or 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 hidden or 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" |