PwshPaint: A pixel art editor for the terminal in PowerShell
github.com
github.com
If I'm doing stuff in Windows-land I'm going to use PowerShell because it's readily available and it's an "object"-ively good shell scripting language as it's tightly integrated with the OS (Windows treats everything as objects).
Bash is tightly integrated with the unix-like OS's where the OS treats everything as text and the shell scripting environment plays well with that. Trying to use PowerShell to integrate with tooling that assumes you want to always receive text can be a pain especially when it sends debug messages over stderr which PowerShell treats as an exception (looking at you git).
I still use pwsh on Linux for things like Github actions because being able to do something like this is nice considering how often you need to interact with JSON based apis, rather than getting the raw text of some json property using jq you get the actual type and can use .NET to deal with them:
$responseVariable = Invoke-RestMethod "https://jsonplaceholder.typicode.com/posts/1"
Write-Host "Title is '$($responseVariable.title)'"
Write-Host "Title is a '$($responseVariable.title.GetType())'"
Write-Host "UserId is '$($responseVariable.userId)'"
Write-Host "UserId is a '$($responseVariable.userId.GetType())'"
> Title is 'some text blah blah blah'
> Title is a 'string'
> UserId is '1'
> UserId is a 'long'
I think I've been using bash-like stuff for ~15 years and PowerShell for the last 3 and now that it's cross platform I reckon it's definitely worth having a look at, I wasn't so keen on learning when it only applied to Windows Server management.I just installed PowerShell 7 last week to work on some scripts that required this, and I am hoping that some of the quirks of PowerShell have been solved in this version.
Another of the author's projects sits solidly between awesome and terrifying: https://github.com/ShaunLawrie/PwshRayTracer
> A very slow raytracer in PowerShell that has been optimised from ~100 camera rays traced per second to 4000 rays per second on a 4GHz 6 core CPU with a few tricks
> Because I've been learning a bit of serverless stuff I was curious as to how much faster I could run this using PowerShell in a webscale™ setup by distributing the processing over as many concurrently running lambdas as I could get in my AWS account:
> By using Lambda with large memory sizes to get more cores I had >250,000 camera rays per second (~62x my laptop speed) but I managed to rack up a $200 bill over a couple of bad runs
Good times.
https://github.com/ShaunLawrie/PwshPaint/blob/main/PwshPaint...
I've done considerable work with it and niche cases like this the at a teensy bit of web to PowerShell is a perfect usecase
https://inconsolation.wordpress.com/2015/04/18/shpaint-for-t...
Reasons I love it:
- Objects > strings
- One tool instead of many
- The entire C# std lib is there if I need it.
- Sane syntax vs bash.
Also, I started with very little scripting experience and very little programming experience. I'm someone that learns tools best when I have something to either build or fix with them. Because PowerShell has access to .net, it ended up pushing me into C#.