Notes on miscellaneous stuff
Copy-paste numbered list from HTML to text preserving the numbers
Excluding folder (or file) in .gitignore that has been committed to repo
Blogger seems to trip up on <wbr> tag; Blogger shows 'invalid' HTML in red
Blogger Compose View Limitation for Paragraphs in List Items
In Blogger’s Compose view, when writing inside an ordered (<ol>
) or unordered (<ul>
) list, pressing Enter always creates a new list item (<li>
). There is no direct way to insert multiple paragraphs or line breaks inside the same list item.
Common Workarounds & Trade-offs
-
<p></p>
inside<li>
: Has to be done in HTML view: Works but can cause Blogger to complain or strip tags; not ideal. -
<br><br>
inside<li>
: Has to be done in HTML view: Simple, valid, but creates inconsistent spacing between long items and subsequent short items. -
Nested bulleted or numbered list
<ul>
or<ol>
: Can be done in Compose view or HTML view: Maintains consistent spacing for long items. Limitation: Compose view does not easily allow adding a continuation sentence after the nested list within the parent<li>
.
Solution to Nested Bulleted or Numbered List Limitation for Sentences After Nested List
Switch to HTML view and manually add the sentences after nested list as follows:
The nested bulleted or numbered list with above solution ensures:
-
Proper line spacing and alignment
-
Ability to continue parent list item text after nested lists
Mobile Hotspot Internet Connection related Powershell scripts
ismetered.ps1 - Powershell script that reports whether Internet connection is metered or not
CheckUnmetered.ps1 - Powershell script that checks and notifies if Internet connection is Unmetered
CheckISP.ps1 - Powershell script that reports ISP name of Jio or Airtel and whether metered or not
-----------------------------------
TXT Files Concatenation Powershell Script
This PowerShell script allows a user to specify a top-level folder as input and recursively collects all .txt files within that folder and its subfolders. Before concatenation, it lists all found files along with the total count, prompting the user for confirmation to proceed. The output file is created in the current directory where the script is run, with a name that starts with the current date, followed by -concat-, and a truncated, sanitized representation of the input folder path.
-----------------------------------
Add a “TreeView” Option to the Send To Menu in Windows 11
Summary info. from ChatGPT chat 'GUI equivalent of tree' on 21 Sep. 2025 is given below.
If you often need a full folder tree listing like the tree
command provides, you can add a Send To context menu entry to quickly generate it for any folder. Here’s a simple, safe method using a batch file:
1️⃣ Create the PowerShell Script
Create a PowerShell script TreeView.ps1
with the following content:
-
Save it in a convenient folder, e.g.,
2️⃣ Create a Batch File Wrapper
Windows SendTo menu reliably passes folder paths to batch files, so we create a small wrapper .bat
file:
Save this as
TreeView.bat
in same folder as above TreeView.ps1
3️⃣ Add to SendTo Menu
Create a shortcut to your
TreeView.bat
.-
In Windows Explorer, open the folder: %APPDATA%\Microsoft\Windows\SendTo
-
Copy the shortcut you just created into this SendTo folder.
Rename the shortcut to
TreeView
(you can remove the.bat
in the name).-
(Optional) Change the icon of the shortcut for a cleaner look:
-
Right-click the shortcut → Properties → Change Icon
-
4️⃣ Using the TreeView Option
-
Right-click any folder → Send to → TreeView
-
A Notepad window opens showing the full folder and file hierarchy (like
tree /f
).
✅ Notes
-
The
.bat
wrapper ensures the folder path is passed correctly to PowerShell. -
No registry edits are needed.
-
You can create a second shortcut/batch for “folders only” (omit
/f
) if desired.
This method is safe, easy, and fully reversible: remove the shortcut from SendTo
to disable it.
[I used the above process and it is working for me.]
...
Why we use a batch file wrapper:
Windows Send To menu reliably passes the selected folder path only to executable files like .exe
or .bat
. If you try to put the PowerShell script (.ps1
) directly in SendTo, Explorer will not pass the folder argument correctly — the script sees a literal %1
instead of the folder path.
Using a small batch file wrapper ensures the selected folder path is correctly passed to the PowerShell script, making the Send To option work reliably.
...
[I have not tried what is suggested below but I think it should work ...]
Extending to Any PowerShell Script that takes a folder as the first argument
The same procedure can be used to add Send To context menu support for any PowerShell script that takes a folder as its first (or only) argument. Simply create a small batch file wrapper for your script, place a shortcut to the batch file in the %APPDATA%\Microsoft\Windows\SendTo
folder, and optionally rename or change the icon of the shortcut. This ensures the selected folder path is correctly passed to the script, allowing it to run reliably from the right-click menu.
Strange issue with Excel.
Insert Row context menu command is greyed out. Tried out some suggestions after Net search ... no solution.
But Home -> Insert -> Insert sheet Rows works. So I have a workaround.
==================
6 to 7 October 2025
ChatGPT:
Using PowerShell Script Shortcuts with System-Wide Hotkeys on Windows 11
Overview
You can create a shortcut that runs a PowerShell command or script and assign a global keyboard shortcut (e.g., Ctrl+Alt+T) to it. This allows you to trigger scripts anywhere in Windows without opening a terminal window.
Key Points
-
Shortcut Location
-
The shortcut can be on the Desktop or in a Start Menu Programs folder:
-
Windows monitors these locations for global shortcut keys.
-
-
Using
.ps1
Scripts-
In Windows 11, shortcut keys reliably work with PowerShell scripts (
.ps1
) or inline PowerShell commands. -
.bat
files sometimes do not respond to global hotkeys, especially if they require a console window or elevated privileges.
-
-
Creating a Self-Contained Shortcut
-
No
.ps1
file needed — you can embed the command directly in the shortcut. -
Example (copies timestamp to clipboard, no console visible): powershell -NoProfile -WindowStyle Hidden -Command "Get-Date -Format 'yyyy-MM-dd HH:mm:ss' | Set-Clipboard"
-
-
Assigning a Hotkey
-
Right-click shortcut → Properties → Shortcut key → type your letter (e.g.,
T
) → it will show Ctrl+Alt+T. -
Optional: set Run → Minimized to avoid flashing any window.
-
-
Testing
-
Press your assigned hotkey anywhere in Windows (Desktop, Notepad, browser, etc.)
-
The command executes silently.
-
-
Notes
-
If the shortcut needs admin rights, Windows may block the hotkey. Use PowerShell commands that do not require elevation for smooth operation.
-
For advanced automation or more complex scripts, consider AutoHotkey or a VBS launcher to make shortcuts fully invisible.
-
✅ Summary
-
Use
.ps1
scripts or inline PowerShell commands for reliable Windows 11 hotkeys. -
Desktop shortcuts usually work, but the Start Menu Programs folder is safest.
-
.bat
files are less reliable for global hotkeys in Windows 11. -
Inline PowerShell command in a shortcut is a simple, single-step solution.
--- end CG extract ---
I used a shortcut called CopyTimestamp on desktop with target as:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command "Get-Date -Format 'yyyy-MM-dd HH:mm:ss' | Set-Clipboard"
I specified keyboard shortcut of Ctrl + Alt + T. To check whether this shortcut key is used for some other command, I first tried using it on desktop. It gave a beep and did nothing indicating that it was not mapped to any command.
Note that I created the shortcut by specifying location as: powershell -NoProfile -WindowStyle Hidden -Command "Get-Date -Format 'yyyy-MM-dd HH:mm:ss' | Set-Clipboard"
🔍 VS Code Regex Search for Active console.log
Statements
When reviewing JavaScript or TypeScript code, you may want to find all active console.log
statements while skipping lines that are commented out.
You can do this directly in VS Code’s Search (Ctrl + Shift + F) using a regular expression.
Note: This excludes only inline // comments but does not exclude block comments like /* console.log(...) */
Regex pattern:
[Ensure that above pattern is used without any accidental newline after the pattern as that will not work. Also make sure the “Use Regular Expression” (.*) option is enabled in VS Code’s search box.]
Explanation:
-
^
→ Start of the line -
(?!\s*//)
→ Negative lookahead ensures the line does not begin with optional whitespace followed by//
-
.*
→ Any characters after that -
console\.log
→ Matches actualconsole.log
occurrences
✅ Matches
❌ Skips
...
Regex pattern for all commented console log statements in VS Code search (enable .*
for regex mode):
Note: This matches only inline // comments and does not match block comments like /* console.log(...) */
✅ Regex for commented-out console.log
lines
🧩 Explanation
Part | Meaning |
---|---|
^ | Start of the line |
\s* | Optional spaces or tabs before the comment |
// | Matches the start of a single-line comment |
.* | Any characters following that |
console\.log | Finds console.log (escaped dot for literal . ) |
✅ Matches
❌ Does NOT match
Comments
Post a Comment