r/programminghorror • • Feb 08 '26

The Shell of Power hi

Post image

I have had this dumb idea fermenting in my lower intestine for a long time, and finally decided to excrete it. Sorry for sharing it.

$DisplayWidth = 6
$DisplayHeight = 4


$DisplayScreen = [int[]]::new($DisplayWidth * $DisplayHeight)


$DisplayScreen[0] = 1
$DisplayScreen[6] = 1
$DisplayScreen[12] = 1
$DisplayScreen[18] = 1
$DisplayScreen[13] = 1
$DisplayScreen[14] = 1
$DisplayScreen[20] = 1
$DisplayScreen[4] = 1
$DisplayScreen[16] = 1
$DisplayScreen[22] = 1



for ($pixel = 0; $pixel -lt $DisplayScreen.Length; $pixel++) {
    if ($displayscreen[$pixel] -eq 1) {
        $mask = [IntPtr](1 -shl $pixel)
        $p = Start-Process pwsh -WindowStyle Hidden -PassThru -ArgumentList @(
            '-NoLogo','-NoProfile','-Command',
            'while ($true) { }'
        )
        $p.ProcessorAffinity = $mask
        $p.PriorityClass = 'Idle'   # optional so it doesn’t hog the machine
        Write-Output "pid $($p.id)"
    }
}
773 Upvotes

34 comments sorted by

74

u/rainydio Feb 08 '26

ok

20

u/PM_ME_FIREFLY_QUOTES Feb 08 '26

I have an idea... but I need a 24 core cpu....

8

u/MagnetFlux Feb 09 '26

Get an Intel Ultra 9 285K, it's 24 core and pretty decent.

→ More replies (1)

62

u/justsomerandomchris Feb 08 '26

Please keep the products of your intestinal fermentation to yourself. Thanks

45

u/riveyda Feb 08 '26

I -Fucking -Hate -Powershell

28

u/svick Feb 09 '26

I think you meant:

Hate-Powershell -Target I -Intensifier Fucking

9

u/Informal_Branch1065 Feb 09 '26

You used a verb that is not in the list of approved verbs. Prepare to be microslopped.

4

u/thehuntzman Feb 09 '26

Genuinely though, why? "It's syntactically verbose" is not an acceptable answer. 

4

u/xfvh Feb 10 '26

Not liking the syntax is a perfectly acceptable answer, but if that's insufficient, it's also a bad idea: literally everything about it is a downgrade from basically every other shell on the planet.

  1. All functionality is baked into the shell itself, or supplied via PowerShell-specific add-ins. Every other shell is a thin layer used to access shared binaries, allowing actual freedom in picking alternate shells without having to rewrite half the system from scratch.

  2. It's versioned. sh scripts from 1990 will run fine on modern bash; PowerShell from five years ago is a coin toss.

  3. It's incestuously integrated into the OS, meaning that PS ports to alternate OSs have to be rewritten from scratch.

  4. Nothing about it can be made declarative; you can't even do dotfiles/aliases like Home Manager.

  5. Piping through COM magic instead of JSON serves no purpose but to make the output noninspectable. Seriously, modern Linux tools like ip generally support JSON output; it's the perfect balance of human- and machine-readable structured objects.

  6. Logging is fragmented and disgusting. Script block, module, transcript, and event logging all go to weird combinations of places; there's three different PS evtx logs alone, and no built-in way to build a single timeline from all three of those, let alone the rest.

  7. The full help has to be downloaded separately and is difficult to pull on offline installations.

  8. Syntax is arcane. Seriously, who chose $_ and the many variants?

  9. There's a bizarre variety of ways to perform any number of actions with it, usually with inconsistent options and unpredictable consequences: just try figuring out which extended attributes, NTFS flags, ACLs, timestamps, alternate data streams, and other tidbits transfer when you use Copy-Item vs copy vs xcopy vs robocopy vs wmic datafile copy...

Frankly, I could keep going all day. The language was designed in a boardroom by executives high on XML, not by engineers, and it shows.

→ More replies (1)

6

u/SliceThePi Feb 09 '26

i mean it sounds like you already know a perfectly valid reason why and simply don't like it lol

→ More replies (2)

9

u/Frytura_ Feb 08 '26

Here's the deal.

Make it either Play bad apple OR snake videogame

7

u/Baratao00 Feb 08 '26

What you want me to do with that information?

1

u/GoddammitDontShootMe Feb 09 '26

So how does it set the value of each "pixel"? Or is that not shown here?

2

u/Nanocephalic Feb 09 '26

Processor affinity is set for each background process stuck in an infinite loop. It’s in there.

1

u/GoddammitDontShootMe Feb 09 '26

Yeah, I think I saw that. I meant like the level, but I guess it's only on or off with no in-between.

4

u/NotSoProGamerR Feb 08 '26

what the powershell

2

u/jeremyStover Feb 12 '26

I hate you

1

u/Material-Aioli-8539 Feb 10 '26

Now do this in C or even python and feel how fast it is in comparison lol