Merge branch 'main' of github.com:fleschutz/PowerShell

This commit is contained in:
Markus Fleschutz 2024-05-13 19:35:21 +02:00
commit fa466955a4
7 changed files with 46 additions and 40 deletions

View File

@ -140,6 +140,7 @@ ARINC,Aeronautical Radio, Inc. (USA)
ARLNO,Airline Office
ARP,Airport Reference Point
ARTCC,Air Route Traffic Control Centre
ASACS,Air Surveillance and Control System
ASB,Airspace Block
ASDA,Accelerate Stop Distance Available
ASDE,Airport Surface Detection Equipment
@ -319,6 +320,7 @@ IGLR,Integrated Ground Lighting and Radar
ILS,Instrument Landing System
ISA,International Standard Atmosphere
IMC,Instrument Meteorological Conditions
JTAC,Joint Terminal Attack Control
KAT,Kaufbeuren ATM Training (DFS subcompany)
KCAS,Calibrated AirSpeed in Knots
KIAS,Indicated Airspeed in Knots
@ -368,6 +370,7 @@ OGE,Out of Ground Effect
OFZ,Obstacle Free Zone
OJT,On the Job Training
OODA,"Observation, Orientation, Decision, and Action"
OSC,On Scene Commander
PA,Pressure Altitude
PADS,Parallax Aircraft Docking System
PAPA,"Parallax Aircraft Parking Aid (docking system)"
@ -397,7 +400,7 @@ RB,Relative Bearing
RBI,Relative Bearing Indicator
RBAF,Royal Belgium Armed Forces
RCAF,Royal Canadian Air Force
RCC,Rescue Co-ordination Centre
RCC,Rescue Coordination Center
RCL,Runway Centre Line Lighting
RCR,Runway Condition Reading
RCS,Radar Cross Section
@ -421,7 +424,8 @@ RRPM,Rotor Rotations per Minute
RSA,Runway Safety Area
RSAF,Republic of Singapore Air Force
RSC,Runway Surface Condition
RSI,Remote Status Indicato
RSI,Remote Status Indicator
RSO,Range Safety Officer
RSRS,Reduced Same Runway Separation
RTCA,Radio Technical Commission for Aeronautics
RVR,Runway Visual Range
@ -462,6 +466,7 @@ SM,Statute Mile
SMR,Surface Movement Radar
SOF,Supervisor of Flying
SOW,Statement of Work
SRA,Surveillance Radar Approach
SRC,Safety Regulation Commission (EUROCONTROL)
SRU,Safety Regulation Unit (EUROCONTROL)
SSR,Secondary Surveillance Radar

Can't render this file because it has a wrong number of fields in line 139.

View File

@ -53,6 +53,7 @@ NSA,U.S. National Security Agency
NYPD,New York Police Department
OECD,Organization for Economic Cooperation & Development
ONCD,Office of the National Cyber Director
RSF,Reporters Sans Frontières (French for: Reporters Without Borders)
SAARC,South Asian Association for Regional Cooperation
TREAS,U.S. Department of the Treasury
ULA,United Launch Alliance

Can't render this file because it has a wrong number of fields in line 14.

View File

@ -20,34 +20,32 @@
param([int]$port = 8099, [string]$mediaFolder = "$HOME/Calibre Library", [string]$userDB = "$HOME/CalibreUsers.sqlite", [string]$logfile = "$HOME/CalibreServer.log")
try {
if ($IsLinux) {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if (-not $IsLinux) { throw "Sorry, currently only supported on Linux" }
"⏳ (1/5) Updating package infos..."
& sudo apt update -y
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
$stopWatch = [system.diagnostics.stopwatch]::startNew()
"⏳ (2/5) Installing Calibre..."
& sudo apt install calibre -y
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
"⏳ (1/5) Updating package infos..."
& sudo apt update -y
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
"⏳ (3/5) Searching for Calibre server executable..."
& calibre-server --version
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
"⏳ (2/5) Installing Calibre package..."
& sudo apt install calibre -y
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
"⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
mkdir $mediaFolder
Write-Host "⏳ (3/5) Searching for Calibre server executable... " -noNewline
& calibre-server --version
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
"⏳ (5/5) Starting Calibre server as background process..."
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $HOME/'Calibre Library'
"⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
mkdir $mediaFolder
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Installed Calibre server on Web port $port in $elapsed sec (media folder: $mediaFolder, user database: $userDB, log file: $logfile)"
exit 0 # success
} else {
throw "Currently only supported on Linux"
}
"⏳ (5/5) Starting Calibre server as background process..."
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $HOME/'Calibre Library'
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Installed Calibre server on port $port in $($elapsed)s (media at: $mediaFolder, user DB: $userDB, log to: $logfile)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -13,7 +13,8 @@
#>
try {
"📋 $(get-clipboard)"
[string]$text = (Get-Clipboard)
Write-Output "📋 `$text `"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -2,7 +2,7 @@
.SYNOPSIS
Lists Git repositories
.DESCRIPTION
This PowerShell script lists all Git repositories in a folder with details such as tag/branch/status/URL.
This PowerShell script lists all Git repositories in a folder with details such as latest tag/branch/status/URL.
.PARAMETER parentDir
Specifies the path to the parent directory (current working directory by default)
.EXAMPLE
@ -10,7 +10,7 @@
Local Repo Latest Tag Branch Status Remote Repo
---------- ---------- ------ ------ -----------
📂cmake v3.23.0 main clean git@github.com:Kitware/CMake 0
📂cmake v3.23.0 main clean 0 git@github.com:Kitware/CMake
...
.LINK
https://github.com/fleschutz/PowerShell
@ -35,8 +35,8 @@ function ListRepos {
$numCommits = (git -C "$folder" rev-list HEAD...origin/$branch --count)
$status = (git -C "$folder" status --short)
if ("$status" -eq "") { $status = "clean" }
elseif ("$status" -like " M *") { $status = "⚠️modified" }
New-Object PSObject -property @{'Local Repo'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Remote Repo'="$remoteURL";'Status'="$status$numCommits"}
elseif ("$status" -like " M *") { $status = "⚠️changed" }
New-Object PSObject -property @{'Local Repo'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Status'="$status";'Remote Repo'="$numCommits $remoteURL"}
}
}
@ -46,7 +46,7 @@ try {
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
ListRepos | Format-Table -property @{e='Local Repo';width=19},@{e='Latest Tag';width=18},@{e='Branch';width=15},'Remote Repo',@{e='Status';width=14}
ListRepos | Format-Table -property @{e='Local Repo';width=19},@{e='Latest Tag';width=16},@{e='Branch';width=19},@{e='Status';width=10},'Remote Repo'
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -59,7 +59,8 @@ function GetDescription { param([string]$text)
"Patchy snow possible" { return "❄️ patchy snow possible" }
"Sunny" { return "☀️ sunny" }
"Thundery outbreaks possible" { return "thundery outbreaks possible" }
default { return "$Text" }
"Thundery outbreaks in nearby" { return "thundery outbreaks in nearby" }
default { return $text }
}
}
@ -107,7 +108,7 @@ try {
$Desc = GetDescription $Hourly.weatherDesc.value
if ($Hour -eq 0) {
if ($Day -eq 0) {
Write-Host -foregroundColor green "TODAY 🌡°C ☂mm 💧 💨km/h ☀UV ☁️ 👁km at $Area ($Region, $Country)"
Write-Host -foregroundColor green "TODAY 🌡°C ☂mm 💧 💨km/h ☀UV ☁️ 👁km at $Area ($Region, $Country)"
} elseif ($Day -eq 1) {
$Date = (Get-Date).AddDays(1)
[string]$Weekday = $Date.DayOfWeek
@ -119,7 +120,7 @@ try {
}
$Day++
}
"$(($Hour.toString()).PadLeft(2))°° $Temp° $Precip $Humidity% $($WindDir)$WindSpeed $UV $Clouds% $Visib $Desc"
"$(($Hour.toString()).PadLeft(2))h $Temp° $Precip $Humidity% $($WindDir)$WindSpeed $UV $Clouds% $Visib $Desc"
}
exit 0 # success
} catch {

View File

@ -6,12 +6,12 @@
.PARAMETER pathToRepo
Specifies the file path to the local Git repository (default is working directory)
.EXAMPLE
PS> ./pull-repo.ps1 C:\Repos\rust
PS> ./pull-repo.ps1
(1/4) Searching for Git executable... git version 2.44.0.windows.1
(2/4) Checking local repository...
(2/4) Checking local repository... 📂C:\Repos\rust
(3/4) Pulling remote updates...
(4/4) Updating submodules...
Pulled updates into 📂rust repository in 14 sec.
Pulled remote updates into 📂rust repo in 14s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -27,10 +27,10 @@ try {
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/4) Checking local repository..."
Write-Host "⏳ (2/4) Checking local repository... 📂$pathToRepo"
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access folder: $pathToRepo" }
$result = (git -C "$pathToRepo" status)
if ("$result" -match "HEAD detached at ") { throw "Currently in detached HEAD state (not on a branch!), so nothing to pull" }
if ("$result" -match "HEAD detached at ") { throw "Nothing to pull due to detached HEAD state (not on a branch!)" }
$pathToRepoName = (Get-Item "$pathToRepo").Name
Write-Host "⏳ (3/4) Pulling remote updates..."
@ -42,7 +42,7 @@ try {
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ Pulled updates into 📂$pathToRepoName repository in $elapsed sec."
"✔️ Pulled remote updates into 📂$pathToRepoName repo in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"