Vim commands to write out parameter list
Executive summary :)
For each line
0
D
PP
From the colon prompt:
%s/^ */ write-dbg "`
%s/ *\$/: <\$
%s/$/>"
%s/,//g
The gory details
Starting with a parameter clause like this:
Param(
$Parameter1,
$Parameter2,
$Parameter3,
$Parameter4
)
The manual bits
First, take off the ‘Param(i’, and the bracket at the end
Second, for each line do this:
0
D
PP
… to get:
$Parameter1, $Parameter1,
$Parameter2, $Parameter2,
$Parameter3, $Parameter3,
$Parameter4 $Parameter4
The colon prompt bits
Replace spaces at the front with the write-dbg, a double-quote, and then a backtick. The backtick is because I need to escape the name of the variable
:%s/^ */ write-dbg "`
This gives:
write-dbg "`$Parameter1, $Parameter1,
write-dbg "`$Parameter2, $Parameter2,
write-dbg "`$Parameter3, $Parameter3,
write-dbg "`$Parameter4 $Parameter4
Replace the spaces between the repeated variables with ‘: <’
:%s/ *\$/: <\$
….giving:
write-dbg "`$Parameter1,: <$Parameter1,
write-dbg "`$Parameter2,: <$Parameter2,
write-dbg "`$Parameter3,: <$Parameter3,
write-dbg "`$Parameter4: <$Parameter4
End the string:
%s/$/>"
….which gives:
write-dbg "`$Parameter1,: <$Parameter1,
write-dbg "`$Parameter2,: <$Parameter2,
write-dbg "`$Parameter3,: <$Parameter3,
write-dbg "`$Parameter4: <$Parameter4
Finally get rid of the commas
%s/,//g
Leaving:
write-dbg "`$Parameter1: <$Parameter1>"
write-dbg "`$Parameter2: <$Parameter2>"
write-dbg "`$Parameter3: <$Parameter3>"
write-dbg "`$Parameter4: <$Parameter4>"
#TodayILearned that in 1929, the USSR replaced the 7 day week with a 5 day week, with a fifth of the workforce resting on any given day
This was a good episode to listen to in Leap Week :) 🎙️
Lee Anderson MP thinks that Sadiq Khan is “controlled by Islamists”
I think Lee Anderson is controlled by idiots
That was a shame….could have easily gone the other way. We’ll be back⚽
I just saw Wicked Little Lies….absolutely adored it. It won’t be everybody’s cup of tea, but probably my favourite film so far this millennium! 🎥
It’s worth avoiding spoilers
We had a lovely, long lunch yesterday at the Lahore Kebab House, just off the Commercial Road
On 10cc
I listened to the Word in your Ear podcast about 10cc and it occurred to me that I really like one of their number ones, and really, really, really dislike one of their others
The disparity of my feelings is greater than that for any two hits of any other band
The songs are ‘I’m Not in Love’ and ‘Dreadlock Holiday’, in that order 🎵
#TodayILearned that Lloyd Cole, of the Commotions, and Perfect Skin, is Chelsea 🎵⚽
I’ve been told that, ergonomically, the top of your monitor should be level with your eyes.
I’m sure this is good advice, but I’m wondering if it applies to people who live on the command line, because on the command line stuff tends to happen at the bottom of the screen #Powershell
I think my work laptop is being converted to Windows 11
I think ‘trepidatious’ is the word for how I’m feeling right now
Watched Catch Me if You Can. I really enjoyed it, and my enjoyment wasn’t at all marred by discovering that the ‘true story’ on which it was based has been called into question. It seems quite fitting.
The crocuses (croci?) are out
How to post to a test micro.blog from powershell
Sorry about the formatting of this post…I’m having trouble getting markdown not to convert the url to markdown links, even within code blocks
There’s a bit more detail on posting generally from powershell at mattypenny.micro.blog/2024/02/1…
This is the standard bit
$Token = 'whatever-the-token-is' | ConvertTo-SecureString -AsPlainText -Force
$Body = @{ content = 'Testing again. 1 , 2, 1, 2' h = 'entry' 'post-status' = 'draft' }
You then put ‘?mp-destination=’ followed by the URL of the test micro.blog on the end of the base URL as in the gist below. (The markdown conversion is nausing up the URL if I type it in here - sorry!
invoke-restmethod micro.blog/micropub -Method post -Authentication Bearer -Token $Token -Body $Body
url preview edit
mattypenny-test.micro.blog/2024/02/1… micro.blog/account/p… micro.blog/account/p…
The output confirms that the post has gone to mattypenny-test.micro.blog
How to post to micro.blog with powershell
Get the token
Go to the account page in micro.blog, scroll down to the bottom where there is ‘App tokens’ and click on the link which has the text ‘5 apps’ (or however many apps you’ve authorized)
Pick an app name (I went wild with my imagination and called it Powershell), and click on ‘Generate Token’
Reveal the token and Ctrl-C it.
Do the powershell bit
Convert the token into a securestring
$Token = 'whatever-the-token-is' | ConvertTo-SecureString -AsPlainText -Force
Set up the $Body
$Body = @{
content = 'Testing again. 1 , 2, 1, 2'
h = 'entry'
'post-status' = 'draft'
}
You need the quotes around ‘post-status’ because Powershell doesn’t like hyphens in variable names. I’m keeping this post as draft, because the content is even less interesting than my other posts
Then call invoke-restmethod as follows:
invoke-restmethod https://micro.blog/micropub -Method post -Authentication Bearer -Token $Token -Body $Body
…and Bob’s your uncle
There is, clearly, a lot more really basic stuff that I need to work out:
-
how to create a title
-
how to make the URL more meaningful (tbf, I don’t know how to do that through the browser as yet)
-
how to attach a photo
-
how to post to the testing blog rather than the default one
Then, I’d like to:
- create a function to select a particular post, download it, edit in in vim or vscode, then post the new version
So obviously I’m hoping for and expecting a win for Chelsea, but I’d settle for another 4-4, and if we did lose it would keep City on terms with Liverpool and Arsenal which is a good thing
I’m a multi-layered sort of person
⚽
People who followed me on Twitter may remember this quote, which I tweeted both before and after people here were poisoned
“When people ask me how to understand the Putin regime, I tell them to read Mario Puzo’s ‘The Godfather’” - Gary Kasparov on Desert Island Discs
I finished Trigger Point last week. It’s a cracking show and ‘her off Line of Duty’ is very good.
It was shame the way they used ‘sous les paves le plage’…I quite liked that slogan
I did find it slightly ‘triggering’, but for me it was oddly cathartic, if that’s the word
What I learned in 2018 (according to my twitter archive)
Dec 18, 2018
#TodayILearned that (the) Buzzcocks' song ‘Ever Fallen In Love’ was inspired by a line from Guys and Dolls. And the sleeve was influenced by René Magritte and Marcel Duchamp
Dec 1, 2018
#TodayILearned that Mrs Hudson wasn’t the housekeeper at 221b Baker Street, she was the landlady
(Via @barrycryer80 in the @RadioTimes )
Nov 29, 2018
#TodayILearned that The Bangles minor hit ‘Going Down to Liverpool’ was previously a Katrina and the Waves song
And before that is was recorded when they were just The Waves
Nov 28, 2018
#TodayILearned] why the woodpecker in ‘Bagpuss’ is called Professor Yaffle
Every day is, indeed, and school day
:) Quote Robert Macfarlane @RobGMacfarlane
Nov 28, 2018
Word of the day: “rain-bird” - common name for the green woodpecker (Picus viridis), because it was thought to herald bad weather. Also “yappingale” & “yaffle” (cf Professor Yaffle in Bagpuss) due to its laughing cry. A back-garden jester, in its fool’s cap of feathers…
Nov 22, 2018
#TodayILearned that Richard Osman off of Pointless is a brother of Matt (?) Osman out of Suede
And vice versa From bbc.co.uk
Nov 20, 2018
#TodayILearned that Gerald Ratner made his ‘its total crap’ speech TWENTY SEVEN YEARS AGO
…and afterwards, backstage, he said that he thought it had gone rather well
(via @cbwallop podcast)
Nov 20, 2018
#TodayILearned that N’Golo Kante has covered the most ground in the Premiership this season
Nov 22, 2018
#TodayILearned that Richard Osman off of Pointless is a brother of Matt (?) Osman out of Suede
And vice versa From bbc.co.uk
Nov 20, 2018
#TodayILearned that Gerald Ratner made his ‘its total crap’ speech TWENTY SEVEN YEARS AGO
…and afterwards, backstage, he said that he thought it had gone rather well
(via @cbwallop podcast)
Nov 20, 2018
#TodayILearned that N’Golo Kante has covered the most ground in the Premiership this season
Nov 15, 2018
#TodayILearned that today is the Christmas equivalent of Pancake Day
I think
Nov 15, 2018
#TodayILearned that 70% of players in Premier League academies are born in the first six months of the school year, compared to 30% in the last six months.
(Via @timwig )
#ICouldHaveBeenAContender
Nov 5, 2018
#TodayILearned there was a man on the Carpathia, the ship that picked up the Titanic survivors, who had nieces on the Titanic
The first he knew of the disaster was when his nieces knocked on the door of his cabin the following morning
Via @abcconvos
Oct 15, 2018
#TodayILearned that @StephenKing has sold an estimated 350 million books.
Which would mean that I’ve bought an estimated 0.00001% of them
Oct 9, 2018
#TodayILearned that when Gene Kelly danced the famous Singin' In The Rain scene he had a heavy cold and a temperature of 103
Oct 5, 2018
#TodayILearned that Captain Cook’s Endeavour was renamed the ‘Lord Sandwich’ (via @HistoryExtra and @petermoore )
Sep 27, 2018
#TodayILearned that graffiti-ist Banksy stuck this fake cave art up in the @britishmuseum
Sep 24, 2018
#TodayILearned that “Business Insider estimated that $1,666 was spent in marketing and advertising for every Windows Phone that was subsequently sold — for just $100, before that was slashed to $50.”
Pity - I liked the Windows Phone! computerworld.com/article/3… via @computerworld
Sep 10, 2018
#TodayILearned that the Proportional Representation referendum of 2011 was a ‘statutory referendum’ i.e a ‘Yes’ vote would have been legally binding
Sep 5, 2018
#TodayILearned that the carriage that Dorothy rides in in the Wizard of Oz was also used by Abraham Lincoln
I heard that on the radio in the night, so this may actually have been a particularly odd dream
Aug 31, 2018
#TodayILearned that Ian Paisley lived on Cyprus Avenue
Aug 20, 2018
#TodayILearned that Suzi Quatro’s real name was Quattrocchi.
The name was shortened by the immigration people en.m.wikipedia.org Suzi Quatro - Wikipedia
Aug 1, 2018
#TodayILearned that, at Sansovino, Sarri “was nicknamed Mr 33 because that was the number of set-piece routines he expected his players to memorise”
#cfc #utc #ktbffh https://theguardian.com/football/2018/aug/01/premier-league-preview-2018-19-chelsea?CMP=share_btn_tw
Jul 31, 2018
#TodayILearned that ‘COBRA’ (as in the government emergency committee) stands for ‘Cabinet Office Briefing Room A’
I guess it’s handy that it sounds a bit ‘James Bond’
(via @shippersunbound book about about Theresa May etc)
harpercollins.co.uk/978000826…
Jul 23, 2018
[#TodayILearned](https://mattypenny.micro.blog/categories/todayilearned[#TodayILearned](https://mattypenny.micro.blog/categories/todayilearned) that for every 100 calories of animal feed you give to an animal you get back 12 calories of animal meat
Jul 20, 2018
#TodayILearned that the pattern of the carpets in Andover Wetherspoons is inspired by the crop circles that proliferate around here
Jul 19, 2018
#TodayILearned that, in the original pitch, Friends was titled ‘The Insomnia Cafe’
Jul 18, 2018
#TodayILearned that Lennie Godber’s first TV role was arresting Ena Sharples
This tweet will only make sense to English people ‘of a certain age’
Jul 17, 2018
#TodayILearned that 97% of the food and drink that we import is from the EU
Jul 13, 2018
#TodayILearned that there are people who are experts in airport runway rubber removal Quote John Glen MP @JohnGlenUK
Jul 13, 2018
Visited Jetting Systems in Downton, experts in airport runway rubber removal. Great to see a local SME exporting innovative products around the world. We talked about how our banking system can better support SME exporters, and I will be taking some ideas back to @hmtreasury
Jul 12, 2018
#TodayILearned that the 2022 #WorldCup runs from 21 November – 18 December https://en.m.wikipedia.org/wiki/2022_FIFA_World_Cup
Jul 8, 2018
#TodayILearned that Fray Bentos is a place in Uruguay
Jun 29, 2018
#TodayILearned that the hitnDancing in the Moonlight was a cover youtu.be/sR47TZdJg…
Jun 20, 2018
#TodayILearned that the Bonzo Dog Doodah Band played their first gigs in what used to be my local Wetherspoons in Forest Hill
Can’t entirely imagine it, to be honest (via @WIYElondon
wordpodcast.co.uk/2018/05/0… )
Jun 20, 2018
#TodayILearned that the Bonzo Dog Doodah Band played their first gigs in what used to be my local Wetherspoons in Forest Hill
Can’t entirely imagine it, to be honest (via @WIYElondon
wordpodcast.co.uk/2018/05/0… )
Jun 14, 2018
#TodayILearned that the @poguesofficial considered calling themselves ‘The Men They Couldn’t Hang’ (via @rocksbackpages (£) rocksbackpages.com/Library/A…)
Jun 13, 2018
#TodayILearned that a bloke called Dan Scavino helps the @realDonaldTrump with his tweets n.pr/2HcxV79
Jun 3, 2018
#TodayILearned that Love, Actually was originally going to be set around Saint Valentines Day, rather than Christmas
May 29, 2018
#TodayILearned that the last prosecution under the Witchcraft Act in the UK was in 1944
(via @littleatoms )
May 28, 2018
#TodayILearned @WalkTheLinesLDN Happy 50th to Kylie Minogue, whose first name is the Aboriginal word for ‘boomerang’.
May 28, 2018
#TodayILearned that ‘Scooby’ is short for ‘Scoobert’
May 18, 2018
#TodayILearned that the Wheatsheaf does ‘thrice-cooked chips’
The Mucklowes would surely approve
May 16, 2018
#TodayILearned that the French for ‘extra time’ is ‘prolongation’
May 8, 2018
#TodayILearned that, in the late 1990s, Norwegian Prime Minister Kjell Magne Bondevik stood down temporarily while he was suffering from depression bbc.co.uk/programme…
Apr 30, 2018
#TodayILearned that the JD in JD Wetherspoons is a reference to J.D. ‘Boss’ Hogg from the Dukes of Hazzard bbc.co.uk/programme…
Apr 16, 2018
#TodayILearned that ‘pigsfoot’ was a codeword for ‘freedom’ among American slaves
Apr 11, 2018
#TodayILearned that poor old Good King Wenceslaus got stabbed to death by his brother
May 16, 2018
#TodayILearned that the French for ‘extra time’ is ‘prolongation’ Quote L’ÉQUIPE @lequipe
May 16, 2018
Replying to @lequipe Votre pronostic pour cette finale de la Ligue Europa à l’issue du temps réglementaire ? #UELfinal #OMAtleti #OMATM Show this poll
May 8, 2018
#TodayILearned that, in the late 1990s, Norwegian Prime Minister Kjell Magne Bondevik stood down temporarily while he was suffering from depression bbc.co.uk/programme…
Apr 30, 2018
#TodayILearned that the JD in JD Wetherspoons is a reference to J.D. ‘Boss’ Hogg from the Dukes of Hazzard bbc.co.uk/programme…
Apr 16, 2018
#TodayILearned that ‘pigsfoot’ was a codeword for ‘freedom’ among American slaves
Apr 11, 2018
#TodayILearned that poor old Good King Wenceslaus got stabbed to death by his brother
Apr 6, 2018
#TodayILearned that ‘buffet’ was originally ‘beaufet’
en.m.wiktionary.org/wiki/beau…
Mar 29, 2018
#TodayILearned that the story about @rockyoriordan going into a record shop to buy the Nips record and meeting Shane Macgowan isn’t true.
Shame
Via @joerooney1
Mar 27, 2018
#TodayILearned that the @PwC_UK bloke running Carillion in administration ‘paid himself £865 an hour – nearly 116 times the £7.50 minimum wage of some cleaners’
Mar 13, 2018
#TodayILearned that the first two British managers to win the European Cup, Jock Stein and Matt Busby, played for different teams in a 5-a-side tournament in Burnback, South Lanarkshire
Mar 12, 2018
#TodayILearned that ‘Null’ is a surname, meaning Ulsterman (or Ulsterwoman, presumably) - via @Phil_Factor
sqlservercentral.com/articles/…
Mar 8, 2018
#TodayILearned that the Prawn Mayonnaise has been Marks and Spencer’s best selling sandwich for 36 years
Feb 16, 2018
#TodayILearned the word ‘Scowegian’ - slang for Scandinavian oxfordindex.oup.com/view/10.1…
Feb 13, 2018
#TodayILearned that ‘rabbit’ is rhyming slang. ‘Rabbit and pork’ rhyming with ‘talk’.
Kind of.
Feb 7, 2018
#TodayILearned that @veeam backs up @SQLServer transaction logs to c:\ProgramData\Veeam\Backup\SqlLogBackup on the target VM, before shipping them off to the veeam repo
Dunno if you can specify a different folder
### Jan 30, 2018
#TodayILearned(https://mattypenny.micro.blog/categories/todayilearned/) that the ‘She’ who sold sea-shells on the sea-shore was fossil hunter Mary Anning of Lyme Regis bbc.co.uk/programme…
Jan 19, 2018
#TodayILearned that Isaac Newton lost the equivalent of 3 million dollars in the South Sea Bubble
Proving that what goes up can sometimes come down, I guess
openculture.com/2018/01/h… via @openculture
Jan 17, 2018
#TodayILearned that @NaomiAKlein ’s grandad was one of the Disney cartoonists who went on strike and got blacklisted bbc.co.uk/programme…
Jan 16, 2018
Replying to
#TodayILearned that Lilliput was possibly named after Lilliput House, which was possibly owned by Isaac Gulliver en.m.wikipedia.org/wiki/Lill…
Jan 16, 2018
#TodayILearned that Tony Blackburn comes from Lilliput, near Sandbanks
Jan 12, 2018
#TodayILearned that a ‘proposition man’ is a guy who offer bets on random stuff, like the number of watermelons in a lorry
(via @bigdaddybunce on The Unridden Realm - Bunces Tales of the Extraordinary)
Jan 7, 2018
Replying to
#TodayILearned cinema projectionists were once called ‘lanternists’
…which reminds me a bit of ‘turntablist’ as a word for ‘DJ’
Jan 5, 2018
#TodayILearned that Loudon Wainwright III wanted to call his 3rd LP ‘Loudon Wainwright the 3rd’s 3rd 33 and a 3rd’
Fresh Air for Nov. 24, 2017: Loudon Wainwright III : NPR
Jan 4, 2018
#TodayILearned that ‘The Shining’ was originally going to be set in a theme park
Stephen King, Author Of ‘Joyland’: On Growing Up, Believing In God And Getting Scared : NPR
#TodayILearned that for #Powershell’s Get-ADUser, using -identity will return an error:
$ $ErrorActionPreference = 'Stop'
$ try {Get-AdUser -identity phineas.fogg} catch {"In catch"}
In catch
….whereas using -filter won’t
$ try {Get-AdUser -filter {samaccountname -eq 'phineas.fogg'}} catch {"In catch"}
$