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
| param ( | |
| [string]$sourceDir | |
| ) | |
| $ftpaddr = "example.com/upload/" | |
| # option | |
| $assemblies = ( | |
| "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL", | |
| "System.IO, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| autoReload="true" | |
| internalLogLevel="Info" | |
| internalLogFile="c:\temp\internal-nlog.txt"> | |
| <!-- 啟用 ASP.NET Core 排版呈現器 --> | |
| <extensions> | |
| <add assembly="NLog.Web.AspNetCore"/> |
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
| # use pwsh.exe (PS7Now) | |
| Import-Module posh-ssh -UseWindowsPowerShell | |
| $cred = Get-Credential | |
| $remoteDir = "/" | |
| $ftpaddr = "127.0.0.1" | |
| $sourceDir = "D:\zips\*" | |
| $files = Get-ChildItem -Path $sourceDir -Include *.zip |
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
| // To view the default settings, hold "alt" while clicking on the "Settings" button. | |
| // For documentation on these settings, see: https://aka.ms/terminal-documentation | |
| { | |
| "$schema": "https://aka.ms/terminal-profiles-schema", | |
| "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
| "profiles": { | |
| "defaults": { | |
| "fontFace": "Fira Code", | |
| "startingDirectory": "c://", | |
| "colorScheme": "Solarized Dark" |
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
| # Example: | |
| # .\Push-FoldersToAmazonS3.ps1 -BucketName kkbruce -ProfileName default -LocalPath D:\Amazon -PrefixName "uploaded_fieds" | |
| [CmdletBinding()] | |
| param ( | |
| [string]$BucketName, | |
| [string]$ProfileName, | |
| [string]$LocalPath, | |
| [string]$PrefixName, | |
| [switch]$UseProxy | |
| ) |
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
| $Text = "Hello world!" | |
| $EncodedUniText =[Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($Text)) | |
| $EncodedUniText | |
| $EncodedASCText =[Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($Text)) | |
| $EncodedASCText | |
| $DecodedUniText = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($EncodedUniText)) | |
| $DecodedUniText | |
| $DecodedASCText = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($EncodedASCText)) | |
| $DecodedASCText |
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
| REM Run cmd.exe first | |
| del "\\?\x:\folder_name\invalid_filename" | |
| rd "\\?\x:\folder_name\invalid_filename" |
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
| REM wsl.exe -d Ubuntu-18.04 | |
| wsl sudo apt update && sudo apt upgrade |
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
| # Ref: https://docs.microsoft.com/zh-tw/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed | |
| $netInfo = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" -Name Release | |
| $netVerKey = $netInfo.Release | |
| if ($netVerKey -ge 528040) { | |
| Write-Output "4.8 or later" | |
| } | |
| if ($netVerKey -ge 461808) { | |
| Write-Output "4.7.2" |
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
| Get-Service -ComputerName "ComputerName" -Name "ServiceName" | ` | |
| Where-Object {$_.Status -eq "Stopped"} | ` | |
| Set-Service -Status Running |