techie

    #TodayILearned that in VS Code there is a command called “View: Toggle Locked Scrolling Across Editors” which sync’s the scrolling between two windows (or are they called panes). Anyway it’s v handy for comparing two chunks of code #VsCode

    If I had a pound for every time I had to look up how to do Ctrl-Alt-Del on a remote machine I’d be slightly more wealthy

    <img src=“https://cdn.uploads.micro.blog/139254/2025/img-20250211-1140462.jpg" width=“347” height=“600” alt=“The image features the words “Ctrl - Alt - End” written in a stylized, possibly hand-painted font.">

    Proposed new entry for the Meaning of Liff, IT Workers Edition

    Bullock’s Horn - the situation in which you find yourself when someone asks you to help with something, and you go to consult with someone else who you think will know about it, and they direct you back to the person who asked for help in the first place

    Wikipedia - The Meaning of Liff

    map showing Bullocks Horn in north Wiltshire

    How to delete from a tweets micro.blog with powershell

    These were my last three tweets on the blog…and, I think, the last tweets I posted

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&q=source`&offset=0`&limit=3 `
      -Method get -Header $RestMethodHeaders | 
      select -expand items | 
      select -expand properties | 
      select url,content          
    
    url                                                                        content
    ---                                                                        -------
    {https://mattypenny-tweets.micro.blog/2022/12/31/1609327355398443008.html} {Happy new year to you and yours!}
    {https://mattypenny-tweets.micro.blog/2022/12/24/1606763511543209984.html} {God bless us, every one}
    {https://mattypenny-tweets.micro.blog/2022/12/23/1606293329544548352.html} {My word of the day today is 'myrrh'.}
    
    
    

    So, to delete a specific tweet from the micro.blog….

    Set up the headers

    $RestMethodHeaders = @{
        "Authorization" = "Bearer $BlogToken"
    }
    
    

    Delete the ‘happy new year’ one

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&url=https://mattypenny-tweets.micro.blog/2022/12/31/1609327355398443008.html`&action=delete `
      -Method post `
      -Header $RestMethodHeaders
    

    …and abracadbra

    invoke-restmethod https://micro.blog/micropub?mp-destination=https://mattypenny-tweets.micro.blog`&q=source`&offset=0`&limit=3 -Method get -Header $RestMethodHeaders | select -expand items | select -expand properties | select url,content
    
    
    url                                                                        content
    ---                                                                        -------
    {https://mattypenny-tweets.micro.blog/2022/12/24/1606763511543209984.html} {God bless us, every one}
    {https://mattypenny-tweets.micro.blog/2022/12/23/1606293329544548352.html} {My word of the day today is 'myrrh'.}
    {https://mattypenny-tweets.micro.blog/2022/12/22/1605866305227087873.html} {My word of the day today is 'eggnog'.}
    
    

    Things that annoy me #1035

    When you need a password and MFA to see some IT documentation.

    Especially when it doesn’t work in my default browser

    The job title ‘Platform Engineer’ sounds to me like I’m working on an oil rig

    After years and years of having an Android phone, I’ve only just discovered the usefulness of the Gboard personal dictionary, with the suggestion bar turned on.

    I’ve got ‘xxm’ set up to generate a markdown link

    Gboard settings can be accessed by long pressing the comma

    Smartprix page about Gboard

    Screenshot of micro.blog post screen with xxm generating the suggestion [xxx](yyy)

    That’s kind of irritating….the much-used-by-me ‘Format Document’ command in VS Code has a different keyboard shortcut in Linux

    • Windows is Shift + Alt + F
    • Linux is Ctrl + Shift + i
    screenshot from vs code

    I maybe need to get this tattoo-ed on something prominent

    “The road to programming hell is paved with “best practices” applied too early.”

    Winning is the worst thing that can happen in Vegas – Signal v. Noise

    I linux-ified my aging windows laptop over the weekend

    All good, in general, and I’ll be able to get another couple of years out of it

    I found that:

    • I had to run the installer twice before it worked

    • gpodder picked up all my subscriptions from gpodder.net, which was handy, because I’d forgotten to export the opml

    • I had to log out and back in again to get gpodder to save to the folder I specified

    • Spotify seems identical. I use custom order, which I wasn’t expecting to be there in the Linux version….I’m wondering whether it’s actually the windows version running under wine

    • it’s a shame PSClock won’t run

    • I installed the Mate desktop…I very much prefer that to the default Ubuntu one

    • I haven’t got gvim set up yet

    • or VS Code

    • or any powershell stuff beyond installing it

    ……but it’s all good

    Ubuntu mate wall paper with a new Brighton lighthouse apparently

    Shortcuts to fold and unfold text in VS Code #VsCode

    ctrl+shift+[ to fold and ctrl+shift+] to unfold

    Which absolute idiot wrote this?

     $ThisTimeYesterday = $(Get-Date).AddHours(24)
    

    I think it’s important, on a Monday morning, to set one’s goals for the working week.

    My goal for this week: stop spelling ‘Terraform’ as ‘Terrafrom’

    Today’s newly-acquired superpower is remembering that, in vim, ‘*’ jumps you to the next occurrence of the word the cursor is on. Super useful for jumping between a function and calls to that function.

    superman picking up a car

    This isn’t perfect, in that it doesn’t cope with the ‘nd’ in ‘2nd’, bit it’s good enough

    A vim mapping to insert the day and date as a header for notes, journals etc

    map <Leader>m :put =strftime('%A %dth %B %Y')<cr>:s/ 0/ /<cr>kJi## <Esc>
    

    #TodayILearned that:

    Initialisms are made from the first letter (or letters) of a string of words, but can’t be pronounced as words themselves (e.g. FBI, CIA). Acronyms are made from the first letter (or letters) of a string of words but are pronounced as if they were words themselves (e.g. NASA, hazmat). What I Learned: The Phoenix Project Audiobook - IT Revolution

    Personally, I’m not sure that this is a very useful distinction, but it’s interesting

    I guess ‘SQL’ is an initialism to those who pronounce it ‘S.Q.L’ and and acronym for those who say ‘sequel’.

    How to set default parameters for other people's Powershell cmdlets

    Not exactly #TodayILearned because I vaguely remember learning that you can do this, but had never got around to doing so.

    This is how you can set a default parameter in Powershell. As far as I know, it works with any cmdlet. I’m using it here to set the default for Pester to show me all the results of all the tests….because I love seeing that sea of green :)

    $PSDefaultParameterValues += @{ 'Invoke-Pester:Output' = 'Detailed' }
    

    #Powershell

    I got an email about HIMSS24. It stands for ' Healthcare Information and Management Systems Society 2024'….and I’m sure it’s marvellous, but being a sad, techie sort of geek I thought ‘HIMSS24’ looked like a datetime format gone wrong.

    Setting up a file-specific (not filetype-specific) colorscheme in vim

    Setting up a file-specific (not filetype-specific) colorscheme in vim is a two step process.

    First, you need a ‘modeline’[^1] in the file like this: [^1] a ‘modeline’ is a comment with vim instructions in it. My actual modeline for this file is ‘# vim: ft=readme syntax=markdown tabstop=2 shiftwidth=2 softtabstop=2 expandtab’. There’s some explanation of modelines here: https://vim.fandom.com/wiki/Modeline_magic

    # vim: ft=readme
    

    ‘ft’ here is, somewhat confusingly given my post’s title, short for filetype. The name of the filetype is kind-of arbitrary. It’s probably best to be descriptive, and better if it doesn’t correspond to an actual filetype like .md or ‘markdown’ or ‘txt’

    Second, you need like this in your vimrc

    autocmd FileType readme colorscheme peachpuff
    

    Why would I do such a thing

    I have a couple of ‘big old text files’ open most of the time.

    One is for general notes, and a record of what’s happened during the week. The other is when I’m doing a chunky-ish bit of coding which records decisions, todo’s, worries and web-clippings which are specific to that code

    Having a separate colour scheme just makes it handier to find either of the files I want when I’m alt-tabbing through my 103 open windows

    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>"
    
Older Posts →