My PowerShell Notes

Moving to Gemini

I found a new home at flounder. You can learn more about Gemini here.

Created: Thursday, March 18, 2021

Modified: Thursday, March 18, 2021

HTML Link Bookmarklet

Use this bookmarklet to generate an HTML <a> tag containing the title and URL for the current page. To cope with HTML entities, the bookmarklet directly copies the <title> source. Note this doesn't fix any HTML escaping errors present in the source.

javascript:(function(){
  var myText = '<a href="' + window.location.href + '" rel="noopener">' + document.getElementsByTagName("title")[0].innerHTML + '</a>';
  prompt("Hyperlink Code", myText); 
})();

Created: Thursday, March 18, 2021

Modified: Thursday, March 18, 2021

My Bookmarks

Link to my list of bookmarks.

Created: Wednesday, March 17, 2021

Modified: Wednesday, March 17, 2021

My PowerShell Profile

Gist containing my PowerShell profile.

Created: Sunday, March 14, 2021

Modified: Sunday, March 14, 2021

BBCode Link Bookmarklet

Click on this bookmarklet to get a JS prompt with a BBCode link for the current page. This works for Ars Technica comments.

javascript:(function(){
  var title = document.getElementsByTagName("title")[0].innerText;
  var url = window.location.href; 
  var myText = '[url=' + url + ']' + title + '[/url]';
  prompt("BBCode Link", myText);
})();

Created: Thursday, March 4, 2021

Modified: Thursday, March 4, 2021

Network Status

Dashboards for public clouds.

Created: Wednesday, February 24, 2021

Modified: Friday, March 12, 2021

Glossary

My reference for words and phrases.

Created: Monday, February 22, 2021

Modified: Thursday, March 18, 2021

Hyperscale Switch Software

The networking switch software that powers the Microsoft Global Cloud.

Created: Wednesday, February 17, 2021

Modified: Wednesday, February 17, 2021

True Size Map

Drag countries to different latitudes to compare their areas.

Created: Wednesday, February 17, 2021

Modified: Wednesday, February 17, 2021

Microsoft Training is Shifting to Cloud-focused Certifications

Focus is switching away from on-premises servers to Azure.

Created: Wednesday, February 17, 2021

Modified: Wednesday, February 17, 2021

Optical Video Cables

Optical video cables that can travel 100m unpowered and resist EMI.

Created: Monday, February 15, 2021

Modified: Monday, February 15, 2021

USB-C Laptop Docking Stations

A list of USB-C docking stations that I've come across.

Created: Monday, February 15, 2021

Modified: Monday, February 15, 2021

Default Format-* Properties

Formatting cmdlets display a default set of properties. Those properties appear to be defined here:

Created: Wednesday, February 10, 2021

Modified: Wednesday, February 10, 2021

Note Bookmarklet

Sometimes it would be nice to add a note directly to a Web browser. Using this JavaScript bookmarklet, it is possible to add a note. You can use this to track the purpose of a particular window. I'll also drag a note tab along the tab bar to separate read and unread tabs.

Create a new, empty bookmark and save the following code to the "address" field. I suggest naming the bookmark "Page Note". Open a new Web browser tab. Click the bookmark. A window will open prompting for text. Whatever you type will be used as the title and heading for the tab. In this way you can type directly into the browser.

Feel free to update the code to change the default message.

Also, the URL in the address bar is not changed by this code. If you use this bookmarklet on an existing page and want to retrieve the original page contents, refresh the page.

javascript:{
  var note = prompt("Please enter your note:", "Default Message");
  if (note == null || note == "") {
    (function(){})();
  } else {
    "<html><head><title>" + 
      note + 
      "</title></head><body><h1>" + 
      note + 
      "</h1></body></html>"; 
  } 
}

Created: Tuesday, February 9, 2021

Modified: Tuesday, February 9, 2021

Emmet

Emmet is a plugin for many popular text editors which greatly improves HTML & CSS workflow

Created: Monday, February 8, 2021

Modified: Monday, February 8, 2021

Get-Command Includes the File Location for External Executables

I am accustomed to PowerShell listing the assembly under Source for built-in cmdlets. I didn't realize that it will show the location on disc for external executables.

> get-command pwsh | format-list

Name            : pwsh.exe
CommandType     : Application
Definition      : C:\Program Files\PowerShell\7\pwsh.exe
Extension       : .exe
Path            : C:\Program Files\PowerShell\7\pwsh.exe
FileVersionInfo : File:             C:\Program Files\PowerShell\7\pwsh.exe
                  InternalName:     pwsh.dll
                  OriginalFilename: pwsh.dll
                  FileVersion:      7.1.1.0
                  FileDescription:  pwsh
                  Product:          PowerShell
                  ProductVersion:   7.1.1 SHA:
                  adab3212a903db48a665eb29ccb0615b23a7d320
                  Debug:            False
                  Patched:          False
                  PreRelease:       False
                  PrivateBuild:     False
                  SpecialBuild:     False
                  Language:         Language Neutral

Created: Monday, February 8, 2021

Modified: Monday, February 8, 2021

Turing Machine

A physical example of a Turing machine.

Created: Sunday, February 7, 2021

Modified: Sunday, February 7, 2021

Favicon

To add a favicon for your HTML page, add a link tag to the head element. You will need to include the rel="icon" attribute.

You also need to specify an image. I wasn't interested in linking to an image. Instead, I wanted to embed the image using base64 encoding. This will put the data for the image directly in the page source. This is possible because of the data URI scheme. And it is a practical solution because a favicon is small and its encoded data will not take much space in the printed source code.

To create the base64 data, you need to encode an image. I found a link to a client-side encoder which will allow you to specify a file and then it will present that file's encoded text.

Make sure to uncheck "Automatically generate download link".

When the encoder is finished processing, you can copy the result from the text box and paste it after "data:image/png;base64," The value for the href= attribute must appear between double quotes. That includes the base64 data you are adding. Make sure to keep the trailing double quote for the href= attribute.

base64 encoding ignores line breaks. So, I suggest pasting the data on a new line and keeping the embedded breaks from the encoder.

Line breaks are not allowed in base64 data. First, paste your base64 data into the link tag. Then save the HTML document. This way you can reload the document if there is a problem while replacing the newlines.

I replaced the newlines using Notepad++. Start by selecting the entire link tag in the editor. Then open the Search > Replace dialog box. We'll be using a regular expression to identify the newlines. \r\n represents a newline. Place that expression in the "Find what" box. I left the "Replace with" field empty. This will effectively delete newlines. I checked the box to limit the find-and-replace to "In selection". This limits changes to just the link tag we selected. I also switched the Search Mode to "Regular expression". After making these adjustments, I clicked the Replace All button.

Note that I encountered a minor bug in Notepad++ v7.9.1. Sometimes the "In selection" checkbox was greyed out. Switching tabs within the search window refreshed the control. Also, the issue went away after restarting Notepad++.

If something goes wrong, you can close your document without saving and then load it again. Otherwise, save after deleting the newlines.

If you are creating an image from scratch, I created a 400x400 pixel image and used that for editing. When I was done, I saved a copy and resized that to 32x32 pixels. I used the 32x32 image as input for the encoder. I used Paint.NET for editing.

My final link tag has the following form. Keep in mind you have the option of linking to an image file for href= instead of using base64 encoding.

<link href="data:image/png;base64,<!-- base64 data -->" rel="icon" >

Displaying HTML code on a Web page requires using HTML entities for reserved characters. Using an HTML entity encoder makes this work faster and the output more reliable. I was able to encode my link example using Mothereff.in.

Created: Sunday, February 7, 2021

Modified: Sunday, February 7, 2021

Firefox Reload and Override Cache

Shift + Reload Button bypasses the cache if you're using the mouse. You can also use Ctrl + Shift + R or Ctrl + F5.

Created: Sunday, February 7, 2021

Modified: Sunday, February 7, 2021

Customized Search Forms







Created: Sunday, February 7, 2021

Modified: Wednesday, February 10, 2021

News

Links to news Web sites.

Daily

Weekly

Español

RSS Feeds

Here are the RSS feeds I use with Thunderbird.

Created: Saturday, February 6, 2021

Modified: Wednesday, March 10, 2021

Weather Link

Chicago Weather Graph

Created: Saturday, February 6, 2021

Modified: Saturday, February 6, 2021

HTML Reference

Links for coding HTML directly.

Created: Saturday, February 6, 2021

Modified: Thursday, March 18, 2021

GitHub Pages Publishing Steps

Basic git commands for publishing to GitHub Pages.

  1. git status
  2. git add .\index.html
  3. git status
  4. git commit -m "Commit Message"
  5. git push -u origin main

Created: Saturday, February 6, 2021

Modified: Sunday, February 7, 2021

Git for Windows with Git Credential Manager Core

Git prompt packaged with a credential manager.

Created: Saturday, February 6, 2021

Modified: Saturday, February 6, 2021

Change the prompt in Git CMD

Use this to change the Git prompt in Windows to display just a >. You can also include a trailing space in the command to add a space between the prompt and your future commands.

prompt $g

Created: Saturday, February 6, 2021

Modified: Saturday, February 6, 2021

HTML Validator