PwshPaint: A pixel art editor for the terminal in PowerShell(github.com)
github.com
PwshPaint: A pixel art editor for the terminal in PowerShell
https://github.com/ShaunLawrie/PwshPaint
15 comments
Haha I didn’t expect to see my name while I scrolled through HN this morning. This is my PowerShell script I added to PowerShell Gallery this weekend. I submitted it as “Show HN” a while ago and the only feedback I got was “arrow keys are impractical” so I added basic Vim keybindings
What benefits do you see in PowerShell comparing to things like Bash and Python? Genuine curiosity.
I've always used shell scripting of various types and tend to work to whatever is available in the operating environments I'm working in.
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:
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 also just started using PowerShell around three years ago, when I started working in a Windows only environment. In the beginning I went through the whole circus with Cygwin, WSL, natively ported apps, etc. In the end I just decided to embrace PowerShell and it's really not bad. I quite like the object-oriented part of it.
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.
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.
Damn, and I thought I loved powershell. This is awesome.
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
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
The perfect enterprise use case for lambda! And since it all scales down to zero, it’ll certainly cost less than the equivalent EC2 instance when tracing a paltry 100k images per month.
“Solidly between terrifying and awesome” is a great description thanks
Reminds me of the text-mode font editors that used to float around in the 80s and 90s. There was one released by PC Magazine that let you create screen fonts for EGA and VGA. I wrote one myself -- in BASIC -- for the Tandy 2000.
Good times.
Good times.
Love the work with httplistener here:
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://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
I remember messing around with this when I tried linux on an old computer back in the day.
https://inconsolation.wordpress.com/2015/04/18/shpaint-for-t...
https://inconsolation.wordpress.com/2015/04/18/shpaint-for-t...
Dude I love it. I love PowerShell, super awesome stuff.
Genuine question, why? I have to use Windows at work and I am struggling with it.
I work in identity and access in a shop where active directory, sql server, and other MS stuff is prevalent (There's Linux too, but fate dropped me in Windows land). I'd never fight someone to make them love it, but it's been abundantly useful to me.
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#.
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#.
What are you struggling with? Everything you need is built into pwsh.
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.
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.
It isn't bash