mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 09:23:12 +01:00
Add datatype to param()
This commit is contained in:
parent
35255539df
commit
b97098fc42
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "")
|
param([string]$File = "")
|
||||||
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
||||||
|
|
||||||
$Result = get-filehash $File -algorithm MD5
|
$Result = get-filehash $File -algorithm MD5
|
||||||
"MD5 hash is" $Result.Hash
|
"MD5 hash is" $Result.Hash
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "")
|
param([string]$File = "")
|
||||||
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||||
|
|
||||||
$Result = get-filehash $File -algorithm SHA1
|
$Result = get-filehash $File -algorithm SHA1
|
||||||
write-output "SHA1 hash is" $Result.Hash
|
write-output "SHA1 hash is" $Result.Hash
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "")
|
param([string]$File = "")
|
||||||
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||||
|
|
||||||
$Result = get-filehash $File -algorithm SHA256
|
$Result = get-filehash $File -algorithm SHA256
|
||||||
write-output "SHA256 hash is:" $Result.Hash
|
write-output "SHA256 hash is:" $Result.Hash
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
if ($Text -eq "" ) { $Text = read-host "Enter the memo text to add" }
|
if ($Text -eq "" ) { $Text = read-host "Enter the memo text to add" }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -11,13 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Message = "")
|
param([string]$Message = "")
|
||||||
|
|
||||||
if ($Message -eq "" ) {
|
|
||||||
$URL = read-host "Enter alert message"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Message -eq "" ) { $URL = read-host "Enter alert message" }
|
||||||
|
|
||||||
echo "ALERT: $Message"
|
echo "ALERT: $Message"
|
||||||
|
|
||||||
curl --header "Access-Token: o.PZl5XCp6SBl4F5PpaNXGDfFpUJZKAlEb" --header "Content-Type: application/json" --data-binary '{"type": "note", "title": "ALERT", "body": "$Message"}' --request POST https://api.pushbullet.com/v2/pushes
|
curl --header "Access-Token: o.PZl5XCp6SBl4F5PpaNXGDfFpUJZKAlEb" --header "Content-Type: application/json" --data-binary '{"type": "note", "title": "ALERT", "body": "$Message"}' --request POST https://api.pushbullet.com/v2/pushes
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Drive = "", [int]$MinLevel = 20) # minimum level in GB
|
param([string]$Drive = "", [int]$MinLevel = 20) # minimum level in GB
|
||||||
|
|
||||||
if ($Drive -eq "" ) { $Drive = read-host "Enter drive to check" }
|
if ($Drive -eq "" ) { $Drive = read-host "Enter drive to check" }
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#Requires -RunAsAdministrator
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
param($Drive = "")
|
param([string]$Drive = "")
|
||||||
|
|
||||||
if ($Drive -eq "" ) {
|
if ($Drive -eq "" ) {
|
||||||
$Drive = read-host "Enter drive (letter) to check"
|
$Drive = read-host "Enter drive (letter) to check"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Address = "")
|
param([string]$Address = "")
|
||||||
|
|
||||||
function IsIPv4AddressValid { param([string]$IP)
|
function IsIPv4AddressValid { param([string]$IP)
|
||||||
$RegEx = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
|
$RegEx = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Address = "")
|
param([string]$Address = "")
|
||||||
|
|
||||||
function IsIPv6AddressValid { param([string]$IP)
|
function IsIPv6AddressValid { param([string]$IP)
|
||||||
$IPv4Regex = '(((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))'
|
$IPv4Regex = '(((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2}))'
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($MAC = "")
|
param([string]$MAC = "")
|
||||||
|
|
||||||
function IsMACAddressValid { param([string]$mac)
|
function IsMACAddressValid { param([string]$mac)
|
||||||
$RegEx = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9A-Fa-f]{2}){6}$"
|
$RegEx = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})|([0-9A-Fa-f]{2}){6}$"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "")
|
param([string]$DirTree = "")
|
||||||
|
|
||||||
if ($DirTree -eq "" ) {
|
if ($DirTree -eq "" ) {
|
||||||
$DirTree = read-host "Enter the path to the directory tree"
|
$DirTree = read-host "Enter the path to the directory tree"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Location = "") # empty means determine automatically
|
param([string]$Location = "") # empty means determine automatically
|
||||||
|
|
||||||
function Check { param([int]$Value, [int]$NormalMin, [int]$NormalMax, [string]$Unit)
|
function Check { param([int]$Value, [int]$NormalMin, [int]$NormalMax, [string]$Unit)
|
||||||
if ($Value -lt $NormalMin) {
|
if ($Value -lt $NormalMin) {
|
||||||
|
@ -11,13 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "")
|
param([string]$File = "")
|
||||||
|
|
||||||
if ($File -eq "" ) {
|
|
||||||
$File = read-host "Enter path to XML file"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter path to XML file" }
|
||||||
|
|
||||||
$XmlFile = Get-Item $File
|
$XmlFile = Get-Item $File
|
||||||
|
|
||||||
$script:ErrorCount = 0
|
$script:ErrorCount = 0
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD")
|
param([string]$CommitID = "", [string]$CommitMessage = "", [string]$Branches = "", [string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($CommitID -eq "") { $CommitID = read-host "Enter the commit id to cherry-pick" }
|
if ($CommitID -eq "") { $CommitID = read-host "Enter the commit id to cherry-pick" }
|
||||||
if ($CommitMessage -eq "") { $CommitMessage = read-host "Enter the commit message to use" }
|
if ($CommitMessage -eq "") { $CommitMessage = read-host "Enter the commit message to use" }
|
||||||
if ($Branches -eq "") { $Branches = read-host "Enter the target branches separated by spaces" }
|
if ($Branches -eq "") { $Branches = read-host "Enter the target branches separated by spaces" }
|
||||||
|
|
||||||
try {
|
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
set-location "$RepoDir"
|
set-location "$RepoDir"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ParentDir = "$PWD")
|
param([string]$ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ParentDir = "$PWD")
|
param([string]$ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($FullProgramName = "", $ProgramName = "", $ProgramAliasName = "")
|
param([string]$FullProgramName = "", [string]$ProgramName = "", [string]$ProgramAliasName = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($ProgramName -eq "") {
|
if ($ProgramName -eq "") {
|
||||||
get-process | where-object {$_.mainWindowTitle} | format-table Id, Name, mainWindowtitle -AutoSize
|
get-process | where-object {$_.mainWindowTitle} | format-table Id, Name, mainWindowtitle -AutoSize
|
||||||
$ProgramName = read-host "Enter program name"
|
$ProgramName = read-host "Enter program name"
|
||||||
@ -21,7 +22,6 @@ if ($FullProgramName -eq "") {
|
|||||||
$FullProgramName = $ProgramName
|
$FullProgramName = $ProgramName
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
$Processes = get-process -name $ProgramName -errorAction 'silentlycontinue'
|
$Processes = get-process -name $ProgramName -errorAction 'silentlycontinue'
|
||||||
if ($Processes.Count -ne 0) {
|
if ($Processes.Count -ne 0) {
|
||||||
foreach ($Process in $Processes) {
|
foreach ($Process in $Processes) {
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($FullName = "", $EmailAddress = "", $FavoriteEditor = "")
|
param([string]$FullName = "", [string]$EmailAddress = "", [string]$FavoriteEditor = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($FullName -eq "") { $FullName = read-host "Enter your full name" }
|
if ($FullName -eq "") { $FullName = read-host "Enter your full name" }
|
||||||
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
|
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
|
||||||
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" }
|
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" }
|
||||||
|
|
||||||
try {
|
|
||||||
$Null = (git --version)
|
$Null = (git --version)
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Path = "")
|
param([string]$Path = "")
|
||||||
if ($Path -eq "" ) { $Path = read-host "Enter path to CSV file" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Path -eq "" ) { $Path = read-host "Enter path to CSV file" }
|
||||||
|
|
||||||
$Table = Import-CSV -path "$Path" -header A,B,C,D,E,F,G,H
|
$Table = Import-CSV -path "$Path" -header A,B,C,D,E,F,G,H
|
||||||
|
|
||||||
foreach($Row in $Table) {
|
foreach($Row in $Table) {
|
||||||
|
@ -12,14 +12,15 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
||||||
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
param([string]$server = "", [string]$database = "", [string]$username = "", [string]$password = "", [string]$query = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the MySQL server" }
|
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the MySQL server" }
|
||||||
if ($database -eq "") { $database = read-host "Enter the database name" }
|
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||||
if ($username -eq "") { $username = read-host "Enter the database username" }
|
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||||
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||||
if ($query -eq "") { $query = read-host "Enter the database query" }
|
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||||
|
|
||||||
try {
|
|
||||||
$csvfilepath = "$PSScriptRoot\mysql_table.csv"
|
$csvfilepath = "$PSScriptRoot\mysql_table.csv"
|
||||||
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$username; password=$password; pooling = false; convert zero datetime=True" -Sql $query -CommandTimeout 10000
|
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$username; password=$password; pooling = false; convert zero datetime=True" -Sql $query -CommandTimeout 10000
|
||||||
$result | Export-Csv $csvfilepath -NoTypeInformation
|
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Pattern = "")
|
param([string]$Pattern = "")
|
||||||
if ($Pattern -eq "") { $Pattern = read-host "Enter path to the PowerShell script(s)" }
|
|
||||||
|
|
||||||
function Convert-PowerShellToBatch
|
function Convert-PowerShellToBatch
|
||||||
{
|
{
|
||||||
@ -33,6 +32,8 @@ function Convert-PowerShellToBatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Pattern -eq "") { $Pattern = read-host "Enter path to the PowerShell script(s)" }
|
||||||
|
|
||||||
$Files = get-childItem -path "$Pattern"
|
$Files = get-childItem -path "$Pattern"
|
||||||
foreach ($File in $Files) {
|
foreach ($File in $Files) {
|
||||||
Convert-PowerShellToBatch "$File"
|
Convert-PowerShellToBatch "$File"
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
param([string]$server = "", [string]$database = "", [string]$username = "", [string]$password = "", [string]$query = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the SQL server" }
|
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the SQL server" }
|
||||||
if ($database -eq "") { $database = read-host "Enter the database name" }
|
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||||
if ($username -eq "") { $username = read-host "Enter the database username" }
|
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||||
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||||
if ($query -eq "") { $query = read-host "Enter the database query" }
|
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||||
|
|
||||||
try {
|
|
||||||
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
|
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
|
||||||
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
|
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
|
||||||
$csvfilepath = "$PSScriptRoot\sqlserver_table.csv"
|
$csvfilepath = "$PSScriptRoot\sqlserver_table.csv"
|
||||||
|
@ -11,11 +11,12 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "", $WavFile = "")
|
param([string]$Text = "", [string]$WavFile = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($Text -eq "") { $Text = read-host "Enter text to speak" }
|
if ($Text -eq "") { $Text = read-host "Enter text to speak" }
|
||||||
if ($WavFile -eq "") { $WavFile = read-host "Enter .WAV file to save to" }
|
if ($WavFile -eq "") { $WavFile = read-host "Enter .WAV file to save to" }
|
||||||
|
|
||||||
try {
|
|
||||||
Add-Type -AssemblyName System.Speech
|
Add-Type -AssemblyName System.Speech
|
||||||
$SpeechSynthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
$SpeechSynthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||||
$SpeechSynthesizer.SetOutputToWaveFile($tWavFile)
|
$SpeechSynthesizer.SetOutputToWaveFile($tWavFile)
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($NewBranchName = "", $RepoDir = "$PWD")
|
param([string]$NewBranchName = "", [string]$RepoDir = "$PWD")
|
||||||
if ($NewBranchName -eq "") { $NewBranchName = read-host "Enter new branch name" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($NewBranchName -eq "") { $NewBranchName = read-host "Enter new branch name" }
|
||||||
|
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Shortcut = "", $Target = "", $Description)
|
param([string]$Shortcut = "", [string]$Target = "", [string]$Description)
|
||||||
|
|
||||||
|
try {
|
||||||
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
|
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
|
||||||
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||||
if ($Description -eq "" ) { $Description = read-host "Enter description" }
|
if ($Description -eq "" ) { $Description = read-host "Enter description" }
|
||||||
|
|
||||||
try {
|
|
||||||
$sh = new-object -ComObject WScript.Shell
|
$sh = new-object -ComObject WScript.Shell
|
||||||
$shortcut = $sh.CreateShortcut("$Shortcut.lnk")
|
$shortcut = $sh.CreateShortcut("$Shortcut.lnk")
|
||||||
$shortcut.TargetPath = "$Target"
|
$shortcut.TargetPath = "$Target"
|
||||||
|
@ -11,14 +11,15 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Symlink = "", $Target = "")
|
param([string]$Symlink = "", $[string]Target = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" }
|
if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" }
|
||||||
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||||
|
|
||||||
try {
|
|
||||||
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
|
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
|
||||||
|
|
||||||
write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)"
|
"✔️ created symlink $Symlink (pointing to $Target)"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($NewTagName = "", $RepoDir = "$PWD")
|
param([string]$NewTagName = "", [string]$RepoDir = "$PWD")
|
||||||
if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" }
|
||||||
|
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
set-location "$RepoDir"
|
set-location "$RepoDir"
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($URL = "")
|
param([string]$URL = "")
|
||||||
if ($URL -eq "") { $URL = read-host "Enter directory URL to download" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($URL -eq "") { $URL = read-host "Enter directory URL to download" }
|
||||||
|
|
||||||
& wget --version
|
& wget --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($URL = "")
|
param([string]$URL = "")
|
||||||
if ($URL -eq "") { $URL = read-host "Enter file URL to download" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($URL -eq "") { $URL = read-host "Enter file URL to download" }
|
||||||
|
|
||||||
& wget --version
|
& wget --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Filename = "")
|
param([string]$Filename = "")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Path = "", $Password = "")
|
param([string]$Path = "", [string]$Password = "")
|
||||||
|
|
||||||
function EncryptFile {
|
function EncryptFile {
|
||||||
<#
|
<#
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ParentDir = "$PWD")
|
param([string]$ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -11,11 +11,12 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "", $ImageSize = "")
|
param([string]$Text = "", [string]$ImageSize = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($Text -eq "") { $Text = read-host "Enter text or URL" }
|
if ($Text -eq "") { $Text = read-host "Enter text or URL" }
|
||||||
if ($ImageSize -eq "") { $ImageSize = read-host "Enter image size (e.g. 500x500)" }
|
if ($ImageSize -eq "") { $ImageSize = read-host "Enter image size (e.g. 500x500)" }
|
||||||
|
|
||||||
try {
|
|
||||||
$ECC = "M" # can be L, M, Q, H
|
$ECC = "M" # can be L, M, Q, H
|
||||||
$QuietZone = 1
|
$QuietZone = 1
|
||||||
$ForegroundColor = "000000"
|
$ForegroundColor = "000000"
|
||||||
|
@ -11,13 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($PathToExe = "")
|
param([string]$PathToExe = "")
|
||||||
|
|
||||||
if ($PathToExe -eq "" ) {
|
|
||||||
$PathToExe = read-host "Enter path to executable file"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($PathToExe -eq "" ) { $PathToExe = read-host "Enter path to executable file" }
|
||||||
|
|
||||||
get-childitem $PathToExe | % {$_.VersionInfo} | Select *
|
get-childitem $PathToExe | % {$_.VersionInfo} | Select *
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Version = "")
|
param([string]$Version = "")
|
||||||
if ($Version -eq "") { $Version = read-host "Enter version to install (see https://github.com/AsamK/signal-cli)" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Version -eq "") { $Version = read-host "Enter version to install (see https://github.com/AsamK/signal-cli)" }
|
||||||
|
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
set-location /tmp
|
set-location /tmp
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Word = "", [int]$Columns = 8)
|
param([string]$Word = "", [int]$Columns = 8)
|
||||||
|
|
||||||
function GetPermutations {
|
function GetPermutations {
|
||||||
[cmdletbinding()]
|
[cmdletbinding()]
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD", $Pattern = "*")
|
param([string]$RepoDir = "$PWD", [string]$Pattern = "*")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD", $Format = "compact")
|
param([string]$RepoDir = "$PWD", [string]$Format = "compact")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "$PWD")
|
param([string]$DirTree = "$PWD")
|
||||||
|
|
||||||
function ListDir { param([string]$Directory, [int]$Depth)
|
function ListDir { param([string]$Directory, [int]$Depth)
|
||||||
$Depth++
|
$Depth++
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Pattern = "*")
|
param([string]$Pattern = "*")
|
||||||
|
|
||||||
function ListDir { param([string]$Pattern)
|
function ListDir { param([string]$Pattern)
|
||||||
$Items = get-childItem -path "$Pattern"
|
$Items = get-childItem -path "$Pattern"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "$PWD")
|
param([string]$DirTree = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$DirTree = resolve-path "$DirTree/"
|
$DirTree = resolve-path "$DirTree/"
|
||||||
|
@ -11,13 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "")
|
param([string]$DirTree = "")
|
||||||
|
|
||||||
if ($DirTree -eq "" ) {
|
|
||||||
$DirTree = read-host "Enter the path to the directory tree"
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($DirTree -eq "" ) { $DirTree = read-host "Enter the path to the directory tree" }
|
||||||
|
|
||||||
[int]$Count = 0
|
[int]$Count = 0
|
||||||
write-progress "Listing empty files in $DirTree ..."
|
write-progress "Listing empty files in $DirTree ..."
|
||||||
get-childItem $DirTree -attributes !Directory -recurse | where {$_.Length -eq 0} | foreach-object {
|
get-childItem $DirTree -attributes !Directory -recurse | where {$_.Length -eq 0} | foreach-object {
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "")
|
param([string]$DirTree = "")
|
||||||
if ($DirTree -eq "" ) { $DirTree = read-host "Enter path to directory tree" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($DirTree -eq "" ) { $DirTree = read-host "Enter path to directory tree" }
|
||||||
|
|
||||||
Get-ChildItem -path $DirTree -recurse | select FullName
|
Get-ChildItem -path $DirTree -recurse | select FullName
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#Requires -Version 3
|
#Requires -Version 3
|
||||||
|
|
||||||
param($Username = "", $Password = "")
|
param([string]$Username = "", [string]$Password = "")
|
||||||
|
|
||||||
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
||||||
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#Requires -Version 3
|
#Requires -Version 3
|
||||||
|
|
||||||
param($Username = "", $Password = "")
|
param([string]$Username = "", [string]$Password = "")
|
||||||
|
|
||||||
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
||||||
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "$PWD")
|
param([string]$DirTree = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$DirTree = resolve-path "$DirTree"
|
$DirTree = resolve-path "$DirTree"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 20)
|
param([string]$RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 20)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
[xml]$Content = (invoke-webRequest -uri $RSS_URL -useBasicParsing).Content
|
[xml]$Content = (invoke-webRequest -uri $RSS_URL -useBasicParsing).Content
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RSS_URL = "https://distrowatch.com/news/dwd.xml", [int]$MaxCount = 20)
|
param([string]$RSS_URL = "https://distrowatch.com/news/dwd.xml", [int]$MaxCount = 20)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& "$PSScriptRoot/write-big.ps1" "OS Updates"
|
& "$PSScriptRoot/write-big.ps1" "OS Updates"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD", $Pattern="*")
|
param([string]$RepoDir = "$PWD", [string]$Pattern="*")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "", [int]$NumberOfDaysUnused = 99)
|
param([string]$DirTree = "", [int]$NumberOfDaysUnused = 99)
|
||||||
|
|
||||||
write-host "Listing files in $DirTree with last access time older than $NumberOfDaysUnused days"
|
write-host "Listing files in $DirTree with last access time older than $NumberOfDaysUnused days"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Location = "") # empty means determine automatically
|
param([string]$Location = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Weather = (invoke-webRequest -uri http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
$Weather = (invoke-webRequest -uri http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($City = "")
|
param([string]$City = "")
|
||||||
if ($City -eq "" ) { $City = read-host "Enter the city name" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($City -eq "" ) { $City = read-host "Enter the city name" }
|
||||||
|
|
||||||
write-progress "Reading worldcities.csv..."
|
write-progress "Reading worldcities.csv..."
|
||||||
$Table = import-csv "$PSScriptRoot/../Data/worldcities.csv"
|
$Table = import-csv "$PSScriptRoot/../Data/worldcities.csv"
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($IPaddr = "")
|
param([string]$IPaddr = "")
|
||||||
if ($IPaddr -eq "" ) { $IPaddr = read-host "Enter IP address to locate" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($IPaddr -eq "" ) { $IPaddr = read-host "Enter IP address to locate" }
|
||||||
|
|
||||||
$result = Invoke-RestMethod -Method Get -Uri "http://ip-api.com/json/$IPaddr"
|
$result = Invoke-RestMethod -Method Get -Uri "http://ip-api.com/json/$IPaddr"
|
||||||
write-output $result
|
write-output $result
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -11,11 +11,12 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($CountryCode = "", $ZipCode = "")
|
param([string]$CountryCode = "", [string]$ZipCode = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($CountryCode -eq "" ) { $CountryCode = read-host "Enter the country code" }
|
if ($CountryCode -eq "" ) { $CountryCode = read-host "Enter the country code" }
|
||||||
if ($ZipCode -eq "" ) { $ZipCode = read-host "Enter the zip code" }
|
if ($ZipCode -eq "" ) { $ZipCode = read-host "Enter the zip code" }
|
||||||
|
|
||||||
try {
|
|
||||||
write-progress "Reading zip-codes.csv..."
|
write-progress "Reading zip-codes.csv..."
|
||||||
$Table = import-csv "$PSScriptRoot/../Data/zip-codes.csv"
|
$Table = import-csv "$PSScriptRoot/../Data/zip-codes.csv"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
function MakeDir { param($Path)
|
function MakeDir { param($Path)
|
||||||
$DirName = (get-item "$Path").Name
|
$DirName = (get-item "$Path").Name
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ParentDir = "$PWD")
|
param([string]$ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($EmailAddress = "markus@fleschutz.de")
|
param([string]$EmailAddress = "markus@fleschutz.de")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$URL="mailto:$EmailAddress"
|
$URL="mailto:$EmailAddress"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($URL = "http://www.fleschutz.de")
|
param([string]$URL = "http://www.fleschutz.de")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Start-Process $URL
|
Start-Process $URL
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Pattern = "*")
|
param([string]$Pattern = "*")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$Files = (get-childItem -path "$Pattern" -attributes !Directory)
|
$Files = (get-childItem -path "$Pattern" -attributes !Directory)
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Filename = "")
|
param([string]$Filename = "")
|
||||||
if ($Filename -eq "" ) { $Filename = read-host "Enter the M3U playlist filename" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Filename -eq "" ) { $Filename = read-host "Enter the M3U playlist filename" }
|
||||||
|
|
||||||
if (-not(test-path "$Filename" -pathType leaf)) { throw "Can't access playlist file: $Filename" }
|
if (-not(test-path "$Filename" -pathType leaf)) { throw "Can't access playlist file: $Filename" }
|
||||||
$Lines = get-content $Filename
|
$Lines = get-content $Filename
|
||||||
|
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Filename = "")
|
param([string]$Filename = "")
|
||||||
if ($Filename -eq "" ) { $Filename = read-host "Enter the MP3 filename" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Filename -eq "" ) { $Filename = read-host "Enter the MP3 filename" }
|
||||||
|
|
||||||
if (-not(test-path "$Filename" -pathType leaf)) { throw "Can't access audio file: $Filename" }
|
if (-not(test-path "$Filename" -pathType leaf)) { throw "Can't access audio file: $Filename" }
|
||||||
$FullPath = (get-childItem $Filename).fullname
|
$FullPath = (get-childItem $Filename).fullname
|
||||||
$Filename = (get-item "$FullPath").name
|
$Filename = (get-item "$FullPath").name
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
"🢃 Pulling updates..."
|
"🢃 Pulling updates..."
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ParentDir = "$PWD")
|
param([string]$ParentDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#Requires -RunAsAdministrator
|
#Requires -RunAsAdministrator
|
||||||
|
|
||||||
param($Directory = "")
|
param([string]$Directory = "")
|
||||||
|
|
||||||
|
|
||||||
function CheckIfInstalled {
|
function CheckIfInstalled {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($USERNAME = "", $PASSWORD = "")
|
param([string]$USERNAME = "", [string]$PASSWORD = "")
|
||||||
if ($USERNAME -eq "") {
|
if ($USERNAME -eq "") {
|
||||||
$USERNAME = read-host "Enter username for FRITZ!Box"
|
$USERNAME = read-host "Enter username for FRITZ!Box"
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($DirTree = "")
|
param([string]$DirTree = "")
|
||||||
if ($DirTree -eq "" ) { $DirTree = read-host "Enter the path to the directory tree" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($DirTree -eq "" ) { $DirTree = read-host "Enter the path to the directory tree" }
|
||||||
|
|
||||||
$Folders = @()
|
$Folders = @()
|
||||||
foreach ($Folder in (Get-ChildItem -path "$DirTree" -Recurse | Where { $_.PSisContainer })) {
|
foreach ($Folder in (Get-ChildItem -path "$DirTree" -Recurse | Where { $_.PSisContainer })) {
|
||||||
$Folders += New-Object PSObject -Property @{
|
$Folders += New-Object PSObject -Property @{
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Pattern = "", $Path = "")
|
param([string]$Pattern = "", [string]$Path = "")
|
||||||
if ($Pattern -eq "" ) { $Pattern = read-host "Enter search pattern" }
|
|
||||||
if ($Path -eq "" ) { $Path = read-host "Enter path to files" }
|
|
||||||
|
|
||||||
function ListScripts { param([string]$Pattern, [string]$Path)
|
function ListScripts { param([string]$Pattern, [string]$Path)
|
||||||
$List = Select-String -Path $Path -Pattern "$Pattern"
|
$List = Select-String -Path $Path -Pattern "$Pattern"
|
||||||
@ -28,6 +26,9 @@ function ListScripts { param([string]$Pattern, [string]$Path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Pattern -eq "" ) { $Pattern = read-host "Enter search pattern" }
|
||||||
|
if ($Path -eq "" ) { $Path = read-host "Enter path to files" }
|
||||||
|
|
||||||
ListScripts $Pattern $Path | format-table -property Path,Line,Text
|
ListScripts $Pattern $Path | format-table -property Path,Line,Text
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($TargetIP = "", [int]$TargetPort = 0, $Message = "")
|
param([string]$TargetIP = "", [int]$TargetPort = 0, [string]$Message = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
||||||
if ($TargetPort -eq 0 ) { $TargetPort = read-host "Enter target port" }
|
if ($TargetPort -eq 0 ) { $TargetPort = read-host "Enter target port" }
|
||||||
if ($Message -eq "" ) { $Message = read-host "Enter message to send" }
|
if ($Message -eq "" ) { $Message = read-host "Enter message to send" }
|
||||||
|
|
||||||
try {
|
|
||||||
$IP = [System.Net.Dns]::GetHostAddresses($TargetIP)
|
$IP = [System.Net.Dns]::GetHostAddresses($TargetIP)
|
||||||
$Address = [System.Net.IPAddress]::Parse($IP)
|
$Address = [System.Net.IPAddress]::Parse($IP)
|
||||||
$Socket = New-Object System.Net.Sockets.TCPClient($Address,$TargetPort)
|
$Socket = New-Object System.Net.Sockets.TCPClient($Address,$TargetPort)
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($TargetIP = "", [int]$TargetPort = 0, $Message = "")
|
param([string]$TargetIP = "", [int]$TargetPort = 0, $[string]Message = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
||||||
if ($TargetPort -eq 0 ) { $TargetPort = read-host "Enter target port" }
|
if ($TargetPort -eq 0 ) { $TargetPort = read-host "Enter target port" }
|
||||||
if ($Message -eq "" ) { $Message = read-host "Enter message to send" }
|
if ($Message -eq "" ) { $Message = read-host "Enter message to send" }
|
||||||
|
|
||||||
try {
|
|
||||||
$IP = [System.Net.Dns]::GetHostAddresses($TargetIP)
|
$IP = [System.Net.Dns]::GetHostAddresses($TargetIP)
|
||||||
$Address = [System.Net.IPAddress]::Parse($IP)
|
$Address = [System.Net.IPAddress]::Parse($IP)
|
||||||
$EndPoints = New-Object System.Net.IPEndPoint($Address, $TargetPort)
|
$EndPoints = New-Object System.Net.IPEndPoint($Address, $TargetPort)
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
param([int]$Seconds = 0)
|
param([int]$Seconds = 0)
|
||||||
if ($Seconds -eq 0 ) { [int]$Seconds = read-host "Enter number of seconds" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Seconds -eq 0 ) { [int]$Seconds = read-host "Enter number of seconds" }
|
||||||
|
|
||||||
for ($i = $Seconds; $i -gt 0; $i--) {
|
for ($i = $Seconds; $i -gt 0; $i--) {
|
||||||
clear-host
|
clear-host
|
||||||
./write-big "T-$i seconds"
|
./write-big "T-$i seconds"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($ImageFile = "", $Style = "Fit")
|
param([string]$ImageFile = "", [string]$Style = "Fit")
|
||||||
|
|
||||||
function SetWallPaper {
|
function SetWallPaper {
|
||||||
param([string]$Image, [ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')][string]$Style)
|
param([string]$Image, [ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')][string]$Style)
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($IPaddress = "")
|
param([string]$IPaddress = "")
|
||||||
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter IP address of Shelly1 device" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter IP address of Shelly1 device" }
|
||||||
|
|
||||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||||
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress on 0
|
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress on 0
|
||||||
start-sleep -s 10
|
start-sleep -s 10
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Directory = "")
|
param([string]$Directory = "")
|
||||||
|
|
||||||
function WriteCsvHeader { param([PSCustomObject]$File)
|
function WriteCsvHeader { param([PSCustomObject]$File)
|
||||||
foreach($Entry in $File.ata_smart_attributes.table) {
|
foreach($Entry in $File.ata_smart_attributes.table) {
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Name = "")
|
param([string]$Name = "")
|
||||||
if ($Name -eq "") { $Name = read-host "Enter the name of the checklist" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Name -eq "") { $Name = read-host "Enter the name of the checklist" }
|
||||||
|
|
||||||
$Lines = Get-Content -path "$PSScriptRoot/../Data/Checklists/$Name.txt"
|
$Lines = Get-Content -path "$PSScriptRoot/../Data/Checklists/$Name.txt"
|
||||||
clear-host
|
clear-host
|
||||||
$Step = 1
|
$Step = 1
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
if ("$Text" -eq "") { $Text = read-host "Enter the text to speak" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ("$Text" -eq "") { $Text = read-host "Enter the text to speak" }
|
||||||
|
|
||||||
$Voice = new-object -ComObject SAPI.SPVoice
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
$Voices = $Voice.GetVoices()
|
$Voices = $Voice.GetVoices()
|
||||||
foreach ($OtherVoice in $Voices) {
|
foreach ($OtherVoice in $Voices) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Filename = "")
|
param([string]$Filename = "")
|
||||||
|
|
||||||
function Speak { param([string]$Text)
|
function Speak { param([string]$Text)
|
||||||
write-output "$Text"
|
write-output "$Text"
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "")
|
param([string]$File = "")
|
||||||
if ($File -eq "") { $File = read-host "Enter path to text file" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "") { $File = read-host "Enter path to text file" }
|
||||||
|
|
||||||
$Text = Get-Content $File
|
$Text = Get-Content $File
|
||||||
|
|
||||||
$Voice = new-object -ComObject SAPI.SPVoice
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$Text = "")
|
param([string]$Text = "")
|
||||||
if ($Text -eq "") { $Text = read-host "Enter the text to speak" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Text -eq "") { $Text = read-host "Enter the text to speak" }
|
||||||
|
|
||||||
$Voice = new-object -ComObject SAPI.SPVoice
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
$Voices = $Voice.GetVoices()
|
$Voices = $Voice.GetVoices()
|
||||||
foreach ($OtherVoice in $Voices) {
|
foreach ($OtherVoice in $Voices) {
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
if ($Text -eq "") { $Text = read-host "Enter the text to speak" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Text -eq "") { $Text = read-host "Enter the text to speak" }
|
||||||
|
|
||||||
$Voice = new-object -ComObject SAPI.SPVoice
|
$Voice = new-object -ComObject SAPI.SPVoice
|
||||||
$Result = $Voice.Speak($Text)
|
$Result = $Voice.Speak($Text)
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($BranchName = "", $RepoDir = "$PWD")
|
param([string]$BranchName = "", [string]$RepoDir = "$PWD")
|
||||||
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
|
||||||
|
|
||||||
$RepoDir = resolve-path "$RepoDir"
|
$RepoDir = resolve-path "$RepoDir"
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
set-location "$RepoDir"
|
set-location "$RepoDir"
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Host = "", $TurnMode = "", [int]$Timer = -999)
|
param([string]$Host = "", [string]$TurnMode = "", [int]$Timer = -999)
|
||||||
|
|
||||||
|
try {
|
||||||
if ($Host -eq "") { $Host = read-host "Enter hostname or IP address of the Shelly1 device" }
|
if ($Host -eq "") { $Host = read-host "Enter hostname or IP address of the Shelly1 device" }
|
||||||
if ($TurnMode -eq "") { $TurnMode = read-host "Enter turn mode (on/off/toggle)" }
|
if ($TurnMode -eq "") { $TurnMode = read-host "Enter turn mode (on/off/toggle)" }
|
||||||
if ($Timer -eq -999) { [int]$Timer = read-host "Enter timer in seconds (0=endless)" }
|
if ($Timer -eq -999) { [int]$Timer = read-host "Enter timer in seconds (0=endless)" }
|
||||||
|
|
||||||
try {
|
|
||||||
$Result = Invoke-RestMethod "http://$($Host)/relay/0?turn=$($TurnMode)&timer=$($Timer)"
|
$Result = Invoke-RestMethod "http://$($Host)/relay/0?turn=$($TurnMode)&timer=$($Timer)"
|
||||||
|
|
||||||
write-host -foregroundColor green "✔️ Shelly1 device at $Host switched to $TurnMode for $Timer second(s)"
|
write-host -foregroundColor green "✔️ Shelly1 device at $Host switched to $TurnMode for $Timer second(s)"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($RepoDir = "$PWD")
|
param([string]$RepoDir = "$PWD")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Directory = "$PWD")
|
param([string]$Directory = "$PWD")
|
||||||
|
|
||||||
function TakeScreenshot { param([string]$FilePath)
|
function TakeScreenshot { param([string]$FilePath)
|
||||||
Add-Type -Assembly System.Windows.Forms
|
Add-Type -Assembly System.Windows.Forms
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Directory = "$PWD", [int]$Interval = 60)
|
param([string]$Directory = "$PWD", [int]$Interval = 60)
|
||||||
|
|
||||||
function TakeScreenshot { param([string]$FilePath)
|
function TakeScreenshot { param([string]$FilePath)
|
||||||
Add-Type -Assembly System.Windows.Forms
|
Add-Type -Assembly System.Windows.Forms
|
||||||
|
@ -11,11 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "", $SourceLang = "", $TargetLang = "")
|
param([string]$File = "", [string]$SourceLang = "", [string]$TargetLang = "")
|
||||||
|
|
||||||
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
|
||||||
if ($SourceLang -eq "" ) { $SourceLang = read-host "Enter language used in this file" }
|
|
||||||
if ($TargetLang -eq "" ) { $TargetLang = read-host "Enter language to translate to" }
|
|
||||||
|
|
||||||
function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$TargetLang)
|
function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$TargetLang)
|
||||||
$Parameters = @{"q"="$Text"; "source"="$SourceLang"; "target"="$TargetLang"; }
|
$Parameters = @{"q"="$Text"; "source"="$SourceLang"; "target"="$TargetLang"; }
|
||||||
@ -25,6 +21,10 @@ function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
||||||
|
if ($SourceLang -eq "" ) { $SourceLang = read-host "Enter language used in this file" }
|
||||||
|
if ($TargetLang -eq "" ) { $TargetLang = read-host "Enter language to translate to" }
|
||||||
|
|
||||||
$Lines = Get-Content -path $File
|
$Lines = Get-Content -path $File
|
||||||
foreach($Line in $Lines) {
|
foreach($Line in $Lines) {
|
||||||
if ("$Line" -eq "") { write-output "$Line"; continue }
|
if ("$Line" -eq "") { write-output "$Line"; continue }
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($FilePattern = "")
|
param([string]$FilePattern = "")
|
||||||
if ($FilePattern -eq "" ) { $FilePattern = read-host "Enter the file pattern" }
|
|
||||||
|
|
||||||
function DetectSourceLang { param([string]$Filename)
|
function DetectSourceLang { param([string]$Filename)
|
||||||
if ("$Filename" -like "*Deutsch*") { return "de" }
|
if ("$Filename" -like "*Deutsch*") { return "de" }
|
||||||
@ -30,6 +29,8 @@ function TranslateFilename { param([string]$Filename, [string]$SourceLang, [stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($FilePattern -eq "" ) { $FilePattern = read-host "Enter the file pattern" }
|
||||||
|
|
||||||
$TargetLanguages = "ar","zh","fr","de","hi","ga","it","ja","ko","pt","ru","es"
|
$TargetLanguages = "ar","zh","fr","de","hi","ga","it","ja","ko","pt","ru","es"
|
||||||
$SourceFiles = get-childItem -path "$FilePattern"
|
$SourceFiles = get-childItem -path "$FilePattern"
|
||||||
foreach($SourceFile in $SourceFiles) {
|
foreach($SourceFile in $SourceFiles) {
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "", $SourceLang = "en", $TargetLang = "any")
|
param([string]$Text = "", [string]$SourceLang = "en", [string]$TargetLang = "any")
|
||||||
if ($Text -eq "" ) { $Text = read-host "Enter text in English to translate" }
|
|
||||||
|
|
||||||
function Language2Code { param([string]$Language)
|
function Language2Code { param([string]$Language)
|
||||||
$Code = switch($Language) {
|
$Code = switch($Language) {
|
||||||
@ -50,6 +49,8 @@ function UseArgosTranslateCLI { param([string]$Text, [string]$SourceLang, [strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Text -eq "" ) { $Text = read-host "Enter text in English to translate" }
|
||||||
|
|
||||||
if ($TargetLang -eq "any") {
|
if ($TargetLang -eq "any") {
|
||||||
$TargetLanguages = "Arabic","Chinese","French","German","Hindi","Irish","Italian","Japanese","Korean","Portuguese","Russian","Spanish"
|
$TargetLanguages = "Arabic","Chinese","French","German","Hindi","Irish","Italian","Japanese","Korean","Portuguese","Russian","Spanish"
|
||||||
foreach($TargetLang in $TargetLanguages) {
|
foreach($TargetLang in $TargetLanguages) {
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($File = "", $URL = "", $Username = "", $Password = "")
|
param([string]$File = "", [string]$URL = "", [string]$Username = "", [string]$Password = "")
|
||||||
|
|
||||||
|
try {
|
||||||
if ($File -eq "") { $File = read-host "Enter local file to upload" }
|
if ($File -eq "") { $File = read-host "Enter local file to upload" }
|
||||||
if ($URL -eq "") { $URL = read-host "Enter URL of FTP server" }
|
if ($URL -eq "") { $URL = read-host "Enter URL of FTP server" }
|
||||||
if ($Username -eq "") { $Username = read-host "Enter username for login" }
|
if ($Username -eq "") { $Username = read-host "Enter username for login" }
|
||||||
@ -23,7 +24,6 @@ if ($Password -eq "") { $Password = read-host "Enter password for login" }
|
|||||||
[bool]$KeepAlive = $true
|
[bool]$KeepAlive = $true
|
||||||
[bool]$IgnoreCert = $true
|
[bool]$IgnoreCert = $true
|
||||||
|
|
||||||
try {
|
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
# check local file:
|
# check local file:
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($MACaddress = "", $IPaddress = "", [int]$Port=9)
|
param([string]$MACaddress = "", [string]$IPaddress = "", [int]$Port=9)
|
||||||
if ($MACaddress -eq "" ) { $MACaddress = read-host "Enter the MAC address (e.g. 00:11:22:33:44:55)" }
|
|
||||||
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter the IP address or subnet address (e.g. 255.255.255.255)" }
|
|
||||||
|
|
||||||
function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$port=9)
|
function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$port=9)
|
||||||
$broadcast = [Net.IPAddress]::Parse($ip)
|
$broadcast = [Net.IPAddress]::Parse($ip)
|
||||||
@ -28,6 +26,9 @@ function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$por
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($MACaddress -eq "" ) { $MACaddress = read-host "Enter the MAC address (e.g. 00:11:22:33:44:55)" }
|
||||||
|
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter the IP address or subnet address (e.g. 255.255.255.255)" }
|
||||||
|
|
||||||
Send-WOL $MACaddress $IPaddress $Port
|
Send-WOL $MACaddress $IPaddress $Port
|
||||||
start-sleep -milliseconds 100
|
start-sleep -milliseconds 100
|
||||||
Send-WOL $MACaddress $IPaddress $Port
|
Send-WOL $MACaddress $IPaddress $Port
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($GeoLocation = "") # empty means determine automatically
|
param([string]$GeoLocation = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(invoke-webRequest http://v2d.wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
(invoke-webRequest http://v2d.wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($GeoLocation = "") # empty means determine automatically
|
param([string]$GeoLocation = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(invoke-webRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
(invoke-webRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Abbreviation = "")
|
param([string]$Abbreviation = "")
|
||||||
if ($Abbreviation -eq "" ) { $Abbreviation = read-host "Enter the abbreviation" }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if ($Abbreviation -eq "" ) { $Abbreviation = read-host "Enter the abbreviation" }
|
||||||
|
|
||||||
write-progress "Searching ..."
|
write-progress "Searching ..."
|
||||||
|
|
||||||
$FoundOne = $false
|
$FoundOne = $false
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
|
|
||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
|
|
||||||
if ($Text -eq "" ) { $Text = read-host "Enter the text to write" }
|
if ($Text -eq "" ) { $Text = read-host "Enter the text to write" }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
|
|
||||||
function BrailleA { param([int]$Row)
|
function BrailleA { param([int]$Row)
|
||||||
switch($Row) {
|
switch($Row) {
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Text = "")
|
param([string]$Text = "")
|
||||||
|
|
||||||
if ($Text -eq "" ) { $Text = read-host "Enter the text to write" }
|
if ($Text -eq "" ) { $Text = read-host "Enter the text to write" }
|
||||||
|
|
||||||
write-host -foregroundColor green "$Text"
|
write-host -foregroundColor green "$Text"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user