Thanks a lot! Highly appreciated :)
comments
Great video!
And as a fellow content creator, I must say I love your presentation. The graphics and console examples were super clean and easy to read. That's always something I strive for, and you've seemed to nail it.
I search history like that:
$psHistorySavePath = (Get-PSReadLineOption).HistorySavePath
(gc $psHistorySavePath -Raw) -split '(?<=[^`])\r?\n' -replace '`\r?\n',"`n" -match 'ddrescue' | scb
It puts all ddrescue commands to clipboard, which I paste into empty Kate tab. Split and replace are to handle multiline cmds
It's funny that you mention that because I'm already working on a solution around that. I'm working on a solution that will periodically backup the contents from your PSReadline history and save it in a searchable format. Then have a cmdlet like Search-History "whatever keywords". I'd like to make it a daemon so it could record estimated times and what console it executed from. I know it would save me a ton for searching.
Also, my one huge-ass OneNote was the reason for me creating this. I found there were a few I kept going back for regularly and wanted a quicker way to get them. Glad to know I'm not the only one.
Wow, this is interesting!
My problem is it still relies on the human element working where it requires me to recognise I've done a cool thing, not move on to the next but instead consider how I'll need this in x months and should therefore store it somehow/where.
I've already got a huge-ass onenote of the frequent fliers, but the esoteric stuff still evades me
I actually wrote a module to do just that. You can install it and just run Get-PSWeekly to get the latest edition. https://www.powershellgallery.com/packages/PSWeekly/0.0.1
From a technical point of view the reason that script won't work is because of the way my site is set up. I'm using an add-on that has it's own content types the links. Each week has a unique tag, so they only show on that weeks page. Therefore, the actual post will only return the link tag for that week. Then you have to look up all of the links with that tag. You can see how I do it here:
Couple of little additions that you might like.
You can expand properties using foreach-object as well. Eg
Get-childitem | foreach-object name
If you specify a method name instead of a property, it will call the method on the input object.
You can also inspect types using [typename].getmembers() to list properties and methods without having to create an instance for get-member.
Glad you enjoyed it! I actually wrote a small JavaScript program to convert txt to html.
Nice resource! I really like that layout. What did you use to generate the HTML?
I'm sure I'm doing some dumb stuff here since I'm not super familiar with doing and working with webrequests, but I put together a messy "one liner" for grabbing the latest weekly's links and their titles:
$PSWLinks = ((Invoke-WebRequest -Uri 'https://psweekly.dowst.dev/wp-json/wp/v2/posts?per_page=1' -Method Get).Links | Where-Object { ($_.InnerHTML -notlike '<IMG title=*') -and ($_.InnerText -notlike '*<\/a>\n\u00a0submitted:*') }) | Select-Object -Property @{Name = 'Title'; Expression = { [System.Text.RegularExpressions.Regex]::Unescape($_.InnerText.SubString(0, $_.InnerText.IndexOf('<'))) } }, @{Name = 'Link'; Expression = { [System.Text.RegularExpressions.Regex]::Unescape($_.href) -Replace '"', '' } }
More than open to suggestions for improvements.
I just started learning poweshell, thanks for putting this together.
Just wanted to take a second to thank you for creating this, and keeping up with surfacing such good videos and articles from the PowerShell community weekly. I don't tend to keep up with every PoSh Weekly, but whenever I skim through them I find almost too many useful and neat tools to work into how I use PowerShell at work.
The article on parallelism is especially timely for me, as I was just starting to use Jobs in v5.1. I might have to add a version switch to that script so I can play around with foreach -parallel
PowerShell does not have a built in PDF reader, so it is not possible without installing a module or calling a third party app. The PSWritePDF module will do what you are asking. The module can be installed from the gallery, so you could technically install and import it in a single line.
Windows should have a built in Print to PDF option under printers you can use in conjunction with the print menu to "print" individual pages to PDF.
You can manage an install-less solution with a docker container assuming you can get docker on the client machines.
There are numerous PDF cli tools that will split pages for you, so the challenge is finding the right one that is trivial for you to use with docker.
My internet sleuthing revealed that there is already a ready-made docker image for an older version of Apache PDFbox, but there are likely other docker containers you could use.
You can incorporate usage into the above snippet pretty easily if you ask one of the AI chatbots. Your prompt will be something like: "Given this one-liner in Powershell (copypaste the one-liner), I want you to change it to also use this docker container (link to github) of Apache PDFBox 2.0 (link to PDFBox docs) to split PDFs into pages. Rewrite the one-liner to do this."
Based on https://en.wikipedia.org/wiki/PDF#Technical_details I'm going to guess that's not going to happen unless powershell has some built-in thing for manipulating PDFs. I'd start searching there.
Updated. Thanks!
I can't help you, but there's an issue with your formatting so the code won't show. You need the apostrophes on the same line, for the "format as code" things to work.
$names = cat "\path\to\names.txt"; $i=0; dir | % { ren $_ "$($names[$i]).pdf"}