Add unicode character

This commit is contained in:
Markus Fleschutz 2021-04-16 20:01:38 +02:00
parent ef5367ed53
commit 52d81a2bed
18 changed files with 50 additions and 81 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX build-repo.ps1 [<repo-dir>]
.DESCRIPTION builds a Git repository (supporting cmake,configure,autogen,Imakefile,Makefile)
@ -73,7 +73,7 @@ try {
exit 0
}
write-host -foregroundColor green "OK - built Git repository $RepoDir in $($StopWatch.Elapsed.Seconds) second(s)"
write-host -foregroundColor green "✔️ built Git repository $RepoDir in $($StopWatch.Elapsed.Seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX build-repos.ps1 [<parent-dir>]
.DESCRIPTION builds all Git repositories under the current/given directory
@ -9,7 +9,7 @@
param($ParentDir = "$PWD")
try {
"Building Git repositories under $($ParentDir)..."
"Building Git repositories at $($ParentDir)..."
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
@ -21,7 +21,7 @@ try {
$Count++
}
write-host -foregroundColor green "OK - built $Count Git repositories under $ParentDir in $($StopWatch.Elapsed.Seconds) second(s)"
write-host -foregroundColor green "✔️ built $Count Git repositories at $ParentDir in $($StopWatch.Elapsed.Seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>]
.DESCRIPTION closes the processes of the given program gracefully
@ -36,7 +36,7 @@ try {
start-sleep -milliseconds 100
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
}
write-host -foregroundColor green "Done - $FullProgramName has been closed ($($Processes.Count) proc)."
write-host -foregroundColor green "✔️ closed $FullProgramName, found ($($Processes.Count) process(es)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
.DESCRIPTION sets up the Git user configuration
@ -7,16 +7,9 @@
#>
param($FullName = "", $EmailAddress = "", $FavoriteEditor = "")
if ($FullName -eq "") {
$FullName = read-host "Enter your full name"
}
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 ($FullName -eq "") { $FullName = read-host "Enter your full name" }
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,...)" }
try {
& git --version
@ -34,7 +27,7 @@ try {
& git config --global core.symlinks true
& git config --global core.longpaths true
& git config --global init.defaultBranch main
write-host -foregroundColor green "Done - your Git user configuration is now:"
write-host -foregroundColor green "✔️ your Git configuration has been saved, it's now:"
& git config --list
exit 0
} catch {

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>]
.DESCRIPTION creates a new shortcut
@ -7,16 +7,9 @@
#>
param($Shortcut = "", $Target = "", $Description)
if ($Shortcut -eq "" ) {
$Shortcut = read-host "Enter filename of shortcut"
}
if ($Target -eq "" ) {
$Target = read-host "Enter path to target"
}
if ($Description -eq "" ) {
$Description = read-host "Enter description"
}
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
if ($Description -eq "" ) { $Description = read-host "Enter description" }
try {
$sh = new-object -ComObject WScript.Shell
@ -27,7 +20,7 @@ try {
$shortcut.Description = "$Description"
$shortcut.save()
write-host -foregroundColor green "Done."
write-host -foregroundColor green "✔️ shortcut $Shortcut created."
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX create-symlink.ps1 [<symlink>] [<target>]
.DESCRIPTION creates a symbolic link
@ -7,18 +7,13 @@
#>
param($Symlink = "", $Target = "")
if ($Symlink -eq "" ) {
$Symlink = read-host "Enter filename of symlink"
}
if ($Target -eq "" ) {
$Target = read-host "Enter path to target"
}
if ($Symlink -eq "" ) { $Symlink = read-host "Enter filename of symlink" }
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
try {
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
write-host -foregroundColor green "Done."
write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>]
.DESCRIPTION creates a new tag in the current/given Git repository
@ -27,9 +27,9 @@ try {
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
& git tag "$NewTagName"
if ($lastExitCode -ne "0") { throw "Error: 'git tag $NewTagName' failed!" }
if ($lastExitCode -ne "0") { throw "Error: 'git tag $NewTagName' failed!" }
& git push origin "$NewTagName"
& git push origin "$NewTagName"
if ($lastExitCode -ne "0") { throw "Error: 'git push origin $NewTagName' failed!" }
exit 0

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX enable-crash-dumps.ps1
.DESCRIPTION enables the writing of crash dumps
@ -289,3 +289,4 @@ Else
write-host "You did not enter a valid option. Please re-run Get-Dump.ps1"
start-sleep -s 5
}
exit 0

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX enable-god-mode.ps1
.DESCRIPTION enables the god mode (adds a new icon to the desktop)
@ -14,7 +14,7 @@ try {
}
$null = new-item @GodModeSplat
write-host -foregroundColor green "OK - see the new desktop icon"
write-host -foregroundColor green "✔️ new icon added to the desktop"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX remove-empty-dirs.ps1 [<dir-tree>]
.DESCRIPTION removes all empty subfolders within the given directory tree

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX switch-shelly1.ps1 [<host>] [<turn-mode>] [<timer>]
.DESCRIPTION switches a Shelly1 device in the local network
@ -14,7 +14,7 @@ if ($Timer -eq -999) { [int]$Timer = read-host "Enter timer in seconds (0=endles
try {
$Result = Invoke-RestMethod "http://$($Host)/relay/0?turn=$($TurnMode)&timer=$($Timer)"
write-host -foregroundColor green "Done - switched Shelly1 device at $Host to $TurnMode for $Timer second(s)"
write-host -foregroundColor green "✔️ Shelly1 device at $Host switched to $TurnMode for $Timer second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX take-screenshot.ps1 [<directory>]
.DESCRIPTION takes a single screenshot and saves it into the current/given directory
@ -6,7 +6,7 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Directory = "")
param($Directory = "$PWD")
function TakeScreenshot { param([string]$FilePath)
Add-Type -Assembly System.Windows.Forms
@ -20,10 +20,6 @@ function TakeScreenshot { param([string]$FilePath)
}
try {
if ($Directory -eq "") {
$Directory = "$PWD"
}
$Time = (Get-Date)
$Filename = "$($Time.Year)-$($Time.Month)-$($Time.Day)-$($Time.Hour)-$($Time.Minute)-$($Time.Second).png"
$FilePath = (Join-Path $Directory $Filename)

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX take-screenshot.ps1 [<directory>] [<interval>]
.DESCRIPTION takes screenshots every 60 seconds and saves them into the current/given directory
@ -6,7 +6,7 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Directory = "", [int]$Interval = 60)
param($Directory = "$PWD", [int]$Interval = 60)
function TakeScreenshot { param([string]$FilePath)
Add-Type -Assembly System.Windows.Forms
@ -20,10 +20,6 @@ function TakeScreenshot { param([string]$FilePath)
}
try {
if ($Directory -eq "") {
$Directory = "$PWD"
}
do {
$Time = (Get-Date)
$Filename = "$($Time.Year)-$($Time.Month)-$($Time.Day)-$($Time.Hour)-$($Time.Minute)-$($Time.Second).png"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX translate-text.ps1 [<text>] [<source-lang>] [<target-lang>]
.DESCRIPTION translates the given text into other languages

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX turn-volume-down.ps1 [<percent>]
.DESCRIPTION turns the audio volume down (-10% by default)
@ -13,7 +13,7 @@ try {
for ([int]$i = 0; $i -lt $Percent; $i += 2) {
$obj.SendKeys([char]174) # each tick is -2%
}
write-host -foregroundColor green "Done."
write-host -foregroundColor green "✔️ turned volume down by $Percent %"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX turn-volume-up.ps1 [<percent>]
.DESCRIPTION turns the audio volume up (+10% by default)
@ -13,7 +13,7 @@ try {
for ([int]$i = 0; $i -lt $Percent; $i += 2) {
$obj.SendKeys([char]175) # each tick is +2%
}
write-host -foregroundColor green "Done."
write-host -foregroundColor green "✔️ turned volume up by $Percent %"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX upload-file.ps1 [<file>] [<URL>] [<username>] [<password>]
.DESCRIPTION uploads the local file to the given FTP server
@ -46,7 +46,7 @@ try {
$ftpStream.Dispose()
$fileStream.Dispose()
write-host -foregroundColor green "OK - uploaded $File to $URL in $($StopWatch.Elapsed.Seconds) second(s)"
write-host -foregroundColor green "✔️ uploaded $File to $URL in $($StopWatch.Elapsed.Seconds) second(s)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
#!/usr/bin/pwsh
#!/usr/bin/pwsh
<#
.SYNTAX wakeup.ps1 [<MAC-address>] [<IP-address>]
.DESCRIPTION sends a magic packet to the given computer to wake him up
@ -6,8 +6,10 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($MACaddress = "", $IPaddress = "")
param($MACaddress = "", $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)
$broadcast = [Net.IPAddress]::Parse($ip)
@ -21,18 +23,11 @@ function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$por
}
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
Send-WOL $MACaddress $IPaddress $Port
start-sleep -milliseconds 100
Send-WOL $MACaddress $IPaddress
Send-WOL $MACaddress $IPaddress $Port
write-host -foregroundColor green "Done - magic packet sent twice to IP $IPaddress (MAC $MACaddress)"
write-host -foregroundColor green "✔️ magic packet $MACaddress sent twice to IP $IPaddress port $Port"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"