Hello World! Every programming journey starts with it — so it’s only fitting that this blog does too.
First off, what a cool domain — I still can’t believe I was able to snap it up. I started this blog because I thought it might be fun to have a place to post: a home for knowledge I’d like to keep, share, or showcase. I mean mostly that is true… the other domain I had been using has been costing me a bit to much and I thought I would start over… I only had the old domain for Let’s Encrypt certificates with acme.sh
. So changing registrars and retooling my DNS I figured; I am a nerd so let’s try this blog thing too…
These days I work as a sysadmin at a tech company, where I manage a little bit of everything: networking, Windows, Active Directory, Azure, Office 365, and Linux systems, to name a few. There’s still plenty I don’t know, of course, and I’ve always believed that everyone knows something you don’t. Like any good sysadmin I subscribe to “jack of all trades”.
Expect posts that solve everyday issues, things reflecting my own experience, and the occasional PowerShell experiment like this rainbow Hello World.
And since no Hello World would be complete without a bit of code, here’s a fun rainbow shimmer version in PowerShell you can try yourself:
Rainbow Text Function
Here is a function that is a little more fun than a normal Write-Host "Hello World!"
.
function Start-RainbowText {
param(
[Parameter(Mandatory)]
[string]$String,
[int]$Seconds = 10
)
$colors = @(
$PSStyle.Foreground.Red,
$PSStyle.Foreground.Yellow,
$PSStyle.Foreground.Green,
$PSStyle.Foreground.Cyan,
$PSStyle.Foreground.Blue,
$PSStyle.Foreground.Magenta
)
$startTime = Get-Date
while ((Get-Date) -lt $startTime.AddSeconds($Seconds)) {
$line = ""
for ($i = 0; $i -lt $String.Length; $i++) {
# pick a color based on the current time + char index
$offset = [int](Get-Date).Second + $i
# The % operator wraps the color index so it loops endlessly through Red -> Yellow -> Green -> Cyan -> Blue -> Magenta
$color = $colors[$offset % $colors.Count]
$line += "$color$($String[$i])$($PSStyle.Reset)"
}
# print on one line, overwriting previous output
Write-Host "`r$line" -NoNewline
Start-Sleep -Seconds 1
}
Write-Host "" # final newline
}
Run that script in PowerShell 7+ and watch Hello World! shimmer in rainbow colors across your console. 🌈
That’s all for my Hello World. Next time: something actually useful (no promises).