Friday, July 21, 2023

Powershell 7+ and PSReadline, a key match made in heaven, Powerful and Customizable Keyboard shortcuts for Powershell

 I frequently use PSReadline, and if you're using Windows 10 (with/ PowerShell 7+), you definitely do too. However, you can modify it a little to make use of more of its functions. I'm going to give you a few instances in this blog post.

Upgrade Powershell

Check version currently running :





To update it to the latest version, you can run this command:

Install-Module PSReadline -Force



Customize your PowerShell profile

You can begin adding options to your PowerShell profile so that they'll be available when a new PowerShell session is launched once you've updated to the most recent version.

3 Sample configuration options :

Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -PredictionSource HistoryAndPlugin


Set-PSReadlineKeyHandler

With the help of this cmdlet, you may instruct a key—in this case, the TAB key—to do a specific action when hit. MenuComplete is the one I select. A screenshot of what this option accomplishes may be found below.



When you type ‘-‘ and press Tab, it typically lets you cycle through all the parameter options. MenuComplete option will show you all the parameters below your command line, browse pressing Tab.

Set-PSReadlineOption

The PredictionSource argument, which beautifully autocompletes from your History if you run a particular command a lot, is the second PSReadline option that I utilize. You can just press Enter to execute it after pressing the -> key to complete the line. For instance:



Using Get-PSReadlineKeyHandler 

You can check all the key bindings available by running:

Get-PSReadLineKeyHandler or Ctrl+Alt+?

Searching History: CTRL+R to Search history backward interactively

Editing functions

Key Function Description
— ——– ———–
Enter AcceptLine Accept the input or move to the next line if the input is missing a closing token.
Shift+Enter AddLine Move the cursor to the next line without attempting to execute the input
Backspace BackwardDeleteChar Delete the character before the cursor
Ctrl+h BackwardDeleteChar Delete the character before the cursor
Ctrl+Home BackwardDeleteInput Delete text from the cursor to the start of the input
Ctrl+Backspace BackwardKillWord Move the text from the start of the current or previous word to the cursor to the kill ring
Ctrl+w BackwardKillWord Move the text from the start of the current or previous word to the cursor to the kill ring
Ctrl+C Copy Copy the selected region to the system clipboard. If no region is selected, copy the whole line
Ctrl+c CopyOrCancelLine Either copy selected text to the clipboard, or if no text is selected, cancel editing the line with CancelLine.
Ctrl+x Cut Delete selected region placing deleted text in the system clipboard
Delete DeleteChar Delete the character under the cursor
Ctrl+End ForwardDeleteInput Delete text from the cursor to the end of the input
Ctrl+Enter InsertLineAbove Inserts a new empty line above the current line without attempting to execute the input
Shift+Ctrl+Enter InsertLineBelow Inserts a new empty line below the current line without attempting to execute the input
Alt+d KillWord Move the text from the cursor to the end of the current or next word to the kill ring
Ctrl+Delete KillWord Move the text from the cursor to the end of the current or next word to the kill ring
Ctrl+v Paste Paste text from the system clipboard
Shift+Insert Paste Paste text from the system clipboard
Ctrl+y Redo Redo an undo
Escape RevertLine Equivalent to undo all edits (clears the line except lines imported from history)
Ctrl+z Undo Undo a previous edit
Alt+. YankLastArg Copy the text of the last argument to the input

Cursor movement functions

Key Function Description
— ——– ———–
LeftArrow BackwardChar Move the cursor back one character
Ctrl+LeftArrow BackwardWord Move the cursor to the beginning of the current or previous word
Home BeginningOfLine Move the cursor to the beginning of the line
End EndOfLine Move the cursor to the end of the line
RightArrow ForwardChar Move the cursor forward one character
Ctrl+] GotoBrace Go to matching brace
Ctrl+RightArrow NextWord Move the cursor forward to the start of the next word

History functions

Key Function Description
— ——– ———–
Alt+F7 ClearHistory Remove all items from the command line history (not PowerShell history)
Ctrl+s ForwardSearchHistory Search history forward interactively
F8 HistorySearchBackward Search for the previous item in the history that starts with the current input – like Previous History if the input is empty
Shift+F8 HistorySearchForward Search for the next item in the history that starts with the current input – like NextHistory if the input is empty
DownArrow NextHistory Replace the input with the next item in the history
UpArrow PreviousHistory Replace the input with the previous item in the history
Ctrl+r ReverseSearchHistory Search history backward interactively

Completion functions

Key Function Description
— ——– ———–
Tab Complete Complete the input if there is a single completion, otherwise complete the input with a common prefix for all completions. Show possible completions if pressed a second time.
Ctrl+@ MenuComplete Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Ctrl+Spacebar MenuComplete Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Shift+Tab TabCompletePrevious Complete the input using the previous completion

Prediction functions

Key Function Description
— ——– ———–
F2 SwitchPredictionView Switch between the inline and list prediction views.

Miscellaneous functions

Key Function Description
— ——– ———–
Ctrl+l ClearScreen Clear the screen and redraw the current line at the top of the screen
Alt+0 DigitArgument Start or accumulate a numeric argument to other functions
Alt+1 DigitArgument Start or accumulate a numeric argument to other functions
Alt+2 DigitArgument Start or accumulate a numeric argument to other functions
Alt+3 DigitArgument Start or accumulate a numeric argument to other functions
Alt+4 DigitArgument Start or accumulate a numeric argument to other functions
Alt+5 DigitArgument Start or accumulate a numeric argument to other functions
Alt+6 DigitArgument Start or accumulate a numeric argument to other functions
Alt+7 DigitArgument Start or accumulate a numeric argument to other functions
Alt+8 DigitArgument Start or accumulate a numeric argument to other functions
Alt+9 DigitArgument Start or accumulate a numeric argument to other functions
Alt+- DigitArgument Start or accumulate a numeric argument to other functions
PageDown ScrollDisplayDown Scroll the display down one screen
Ctrl+PageDown ScrollDisplayDownLine Scroll the display down one line
PageUp ScrollDisplayUp Scroll the display up one screen
Ctrl+PageUp ScrollDisplayUpLine Scroll the display up one line
F1 ShowCommandHelp Shows help for the command at the cursor in an alternate screen buffer.
Ctrl+Alt+? ShowKeyBindings Show all key bindings
Alt+h ShowParameterHelp Shows help for the parameter at the cursor.
Alt+? WhatIsKey Show the key binding for the next chord entered

Selection functions

Key Function Description
— ——– ———–
Ctrl+a SelectAll Select the entire line. Moves the cursor to the end of the line
Shift+LeftArrow SelectBackwardChar Adjust the current selection to include the previous character
Shift+Home SelectBackwardsLine Adjust the current selection to include from the cursor to the start of the line
Shift+Ctrl+LeftArrow SelectBackwardWord Adjust the current selection to include the previous word
Alt+a SelectCommandArgument Make a visual selection of the command arguments.
Shift+RightArrow SelectForwardChar Adjust the current selection to include the next character
Shift+End SelectLine Adjust the current selection to include from the cursor to the end of the line
Shift+Ctrl+RightArrow SelectNextWord Adjust the current selection to include the next word

Search functions

Key Function Description
— ——– ———–
F3 CharacterSearch Read a character and move the cursor to the next occurrence of that character
Shift+F3 CharacterSearchBackward Read a character and move the cursor to the previous occurrence of that character

View Options by Get-PSReadlineOption 

Get list of configurable options which you can adjust: 

Get-PSReadLineOption

Shows the following output containing options :



We can configure many options to tweak the experience. 


Wednesday, July 19, 2023

Powershell 7+ : Change intellisense prediction style view and and source

Before:



 1. While typing click F2 to toggle or using Powershell...

2. Adjust using PS to change the POSReadLine Options via Set-PSReadLineOption:

If you want the same cmd prediction view as John, be sure to adjust the -PredictionViewStyle and -PredictionSource, the default InlineView is very plain.

PS C:\> Set-PSReadLineOption -PredictionViewStyle ListView PS C:\> Set-PSReadLineOption -PredictionSource HistoryAndPlugin

E.g: After




Sunday, June 18, 2023

How to Manage and Clear Google Drive Storage : Find large files and Folders

  

Manage Google Drive Storage

Clean Up / Remove Large Files :

1.       1 Review Storage Usage:

2.      2 Find and Remove Large Files

3.       3 Find and Remove Large and Medium Sizes Files.

4.       4 Search and Bulk Delete Large Emails:

5.      5 Find and Bulk Delete LARGE Photos           

6.      6 Find and Remove LARGE OLD files Shared with You


Clean Up / Remove Large Folders

1.       1: View LARGE Folders: Install THIS Freemium Google Drive Explorer App:

a.       How To View Folder Size Google Drive – Using Add-On [Working]

b.       Ganapthy has written an add-on which can be found in the Google Workspace Marketplace for free. It can be used to do different functions on Google Drive. Especially checking the Google Drive size of the folder

 

2.       2. Free Apps to View Folder Sizes:

a.       How to see the folders size in Google Drive | Without using any software | Google Colab

                                                               i.      Want to know how to see the size of folders in google drive or folders which are inside parent folders. This video is exactly for same and we'll see how to find out folders size without downloading any external software with the use of Google Colab in this video

                                                             ii.      Using this : app:

                                                           iii.      Sample Results

YouTube Watch Hitstory : Why is my YouTube History watch list filled with videos I haven't watched?

 

Why is my YouTube watch list filled with videos I haven't watched?

Symptoms:

My YouTube History watch list continues to be filled with unwatched videos. Why are there videos showing up in my history that I have not watched? Did my account get hacked?

·                        More Detail HERE

Example of hacked Google Youtube Account Video History:

·        




How to find the issue:

1. Go to this URL

                               YouTube Video History

                2. Look for videos that you did not watch / foreign for example, YoutUbe videos from India or China that are not English.

                3. If you find a video that you did not watch, document the estimated date that the video was watched.

                4. IF you find foreign videos in your history,

 

Troubleshooting: Basic

                5. IF your account was compromised / you find foreign videos in your history:

                                a. Go to https://myaccount.google.com/security?nlr=1

                                b. change your password and turn on 2FA

                                c. You can also Check your security here:

·         https://myaccount.google.com/security-checkup/3

·         https://myaccount.google.com/security?nlr=1

·         https://myaccount.google.com/device-activity

·         https://myaccount.google.com/notifications?pli%3D1=

·         https://myaccount.google.com/connections?filters=3,4&hl=en

·         Troubleshooting: Intermediate:

o   Remove all Extension on every browser client that supports extension, normally every windows machine.

o   Disable all mobile apps that have access to youtube account such as YouTueb Vanced or SmartTube.

o   Disable all YouTube alternative apps on Android TV

o   If above does not work, disable and logout of every deice for target Google Account: AndroidTV, Mobile and PC.

o    Use strong passwords, Undo SyncRemove unwanted extensions and toolbars, Disable autoplay mode

·         Troubleshooting: Advanced:

o   Create custom Google Script or Azure app to send alert when YouTube Watch history is updated with video anomaly, for example: Send email when a video shows in History that includes an Indian or Chinese language title.

o   See below refs for YoutUbe API examples:

§  https://groups.google.com/g/google-apps-script-community/c/NLiA-Cu9V3I

§  https://www.youtube.com/watch?v=QY8dhl1EQfI

§  https://www.youtube.com/feed/history

§  https://stackoverflow.com/questions/30849284/how-to-get-watched-history-of-youtube-user-using-youtube-javascript-api

§  https://stackoverflow.com/questions/73241866/how-to-get-watched-history-of-a-music-video-on-youtube-using-youtube-api

§  https://atonce.com/blog/how-to-get-youtube-api-key

§  https://saturncloud.io/blog/how-to-get-a-youtube-video-thumbnail-from-the-youtube-api/

§  https://github.com/matt8707/youtube-watching

§  https://www.reddit.com/r/YoutubeMusic/comments/w8naqu/youtube_ytmusic_history_api/

§  https://developers.google.com/youtube/v3/live/guides/auth/installed-apps

§  https://developers.google.com/youtube/v3/docs

§  https://developers.google.com/youtube/v3/sample_requests

§  https://stackoverflow.com/questions/23600372/how-to-get-all-your-watch-history-from-youtube?rq=4

 

Thursday, February 9, 2023

Android Context Menu : Long Press of text display Bing Search menu, Where did it come from?

What Android app is creating the menu 'Bing Search' in apps when long pressing text?

The Andorid app Outlook has an intent-filter in its Manifest file that enables it to show up in the long-press context menu when highlighting text. This intent-filter is disabled unless the feature flag "Edge Integration" is enabled.

<activity android:configChanges="0x4a0" android:enabled="false" android:label="@string/browser_bing_search" android:name="com.microsoft.emmx.webview.search.SearchBridgeActivity" android:theme="@style/BrowserDefaultLightTheme">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>

Now we know!


Sunday, January 29, 2023

Microsoft Edge Settings and Flags to boost performance : Part 2


Microsoft Edge Settings and Flags to boost performance : Part 2

Microsoft Edge on Windows Setting Tweaks

Microsoft Edge on Windows Performance Tuning : Adjust Settings to increase performance and reduce IO/CPU load on Windows 10+

The majority of users merely use the standard functionality of the Microsoft Edge browser instead of exploring the many valuable choices and enhancements that are available. You should set aside some time to explore the fantastic capabilities of the Edge browser that are concealed behind settings. Use the Microsoft Edge web browser on platforms including desktop, laptop, Android, and iOS mobile phones.

Click the "three dots" in the top right corner of the screen to access Microsoft Edge settings.

Use Find (Ctrl + F or F3) in the top right corner of the browser, enter your search term, and hit enter to find it. 

Optimize Memory Usage and Battery Consumption of Device

Sleeping Tabs and Efficiency Mode | Two Ways for Boosting Device Performance

Microsoft Edge provides two main ways for improving performance of your device; Sleeping Tabs and Efficiency Mode.

Through both settings, Edge releases trapped memory resources for tabs which are inactive for some time and thus saving battery. You can control this time (for Edge action) in performance settings; say 15 minutes, 30 minutes, or some hours. However, when you turn ON the Efficiency Mode, the browser automatically activates Sleeping Mode relatively fast; say around 5 minutes after there is no activity in the tab.

When a tab becomes faded, it means, it has released CPU resources which now can efficiently be used somewhere else, where they are needed most, for example some media editing software. It is very useful when you have opened multiple webpages of websites, and you are busy in some specific website opened in a tab; so, browser will still utilize CPU and energy resources for the tab where a webpage is visible, but it will release resources for the tabs, you are not interacting with since some time.

On the other hand, Chrome does not provide such optimizations and may use excessive battery power as noted by a Chrome user in this support page.

How Much Memory and CPU Resources Are Saved by Sleeping Tabs?

Just hover mouse over any sleeping tab and it will display the information telling you the amount of memory and processing resources it saved. It is quite beneficial for the working and performance of your device.

According to a recent official Windows article:

On average, each sleeping tab saves 85% of memory and 99% CPU for Microsoft Edge.”

How to Access Efficiency Settings in Edge Browser?

Clicking the Heart symbol in the toolbar of Edge browser. To control settings for Sleeping Mode and its time intervals, click Heart symbol and then select three dots (ellipsis) in small window and select ‘manage performance settings’.

You can also access those settings by clicking three dots in top right corner of web browser, then Settings and System and Performance.

For Which Devices Efficiency Mode Should be Activated?

No need to activate Efficiency Mode for desktop computer (connected through mains supply). For desktop computer, it is enough to just activate Sleeping Tabs for efficient utilization of resources. However, you can activate Edge Efficiency Mode for all other battery-operated devices such as laptops.

Tracking Prevention

  • I have turned ON the toggle button next to ‘Tracking prevention’ option.


Privacy

  • I have turned ON the toggle next to ‘Send "Do Not Track" requests’ option.

Diagnostic Data

  • Turn OFF the ‘optional’ diagnostic data.

  • However, you can turn OFF this optional diagnostic data. You will have to restart your computer for this change. You can do this through your Windows computer settings: Click StartSettingsPrivacyDiagnostics and feedback → under diagnostic data select on ‘Required diagnostic data’ to turn OFF the optional diagnostic data sharing. To Access the same settings in Microsoft Edge mobile browser, click ‘three dots’ (…) on bottom of phone screen, Settings → Privacy and security → Diagnostic data.

Search and Service Improvement Data

  • I don’t mind turning the button OFF next to ‘Search and service improvement’ option. It is

Personalize your web experience

  • I have turned OF the toggle button next to this option so that Microsoft does not show me relevant ads.

Enhance Performance and Speed of Edge Browser

SettingsSystem and performance.

Steps to Improve Performance and Speed of Microsoft Edge Browser

Watch Video on YouTubeBoost Performance and Speed of Microsoft Edge

Follow these steps to improve speed and performance of Microsoft Edge.

  • Preload pages for faster browsing and searching’ = ON.

  • Preload the new tab page for a faster experience = ON

  • Continue running background extensions and apps when Edge is closed = OFF

  • Turn ON the Startup Boost.

  • Turn ON the

  • ‘Save resources with sleeping tabs’ and ‘Fade sleeping tabs’.

  • Use hardware acceleration when available’ = ON

  • If Edge is slow or often crashes, TURN THIS OFF.

  • Turn on efficiency mode: OFF else Battery = ON I keep it turned OFF on my computer. However, if you are using a battery-operated device like a laptop, you can turn it ON.

  • Put inactive tabs to sleep after the specified amount of time: = 15


Preload Pages and Startup Boost in Microsoft Edge

Watch Video on YouTubePreload Pages and Startup Boost in Microsoft Edge. Should You Enable It?

Preload pages for faster browsing and searching. = OFF

edge://settings/system’ / Startup boost = OFF

For faster web browsing, user should also turn ON the toggle next to ‘Preload the new tab page for a faster experience’ option. This tweak can be accessed by typing or pasting (edge://settings/startHomeNTP) link in Edge browser.

For faster page loading, based on predictive preloading in background, you can also turn ON the ‘Startup Boost’ feature in Edge browser, by entering ‘edge://settings/system’ in Edge and hitting ‘Enter’ and then toggling ON the button next to ‘Startup boost’ option.

Should You Turn ON ‘Startup Boost’ and ‘Preload Pages’ in Edge Browser?

Normally, I prefer to keep the ‘Startup Boost’ and ‘Preload Pages’ options turned ON in Edge browser for faster browsing experience.

However, please keep in mind that though limited, this feature uses memory resources (RAM, SSD or HDD) as well as internet data for preloading of webpages in background.

Therefore, if you have limited data package, then you can turn it OFF.


How to Keep a Website Activated Always in Edge Browser?

Edge browser has great feature of sleeping tabs to save CPU and data resources from inactive tabs.

However, we do not want some important websites to sleep after a set time. You can tell those websites to your Edge browser in settings through below navigation path.

Click Three Dots for ‘Settings and More’ (or press Alt+F) in top right corner of Edge browser → SettingsSystem and performanceOptimize PerformanceNever put these sites to sleep.

Here you can enter URLs of websites which you want always active to get continuous notifications

Settings : Quiet notification requests

How to Hide/Show Performance Button in Microsoft Edge?

SettingsAppearanceSelect which buttons to show on the toolbar:Performance Button.

To access settings for enhancing performance and efficiency of your device, you can hide or show the ‘Performance button’ by toggling it in settings of Edge browser.

Performance enhancement means that Microsoft Edge browser saves both memory (CPU) and battery consumption of the device. When you turn ON the performance button, it appears on the right side of address bar in toolbar. It looks like a heart filled with pulse symbol.

Fix the New Tab page

By default, Edge’s New Tab page looks a lot like MSN of yore, sporting a bunch of news, ads, and promoted links. This clutter may potentially be a source of reduced performance in Microsoft Edge.

Open a new tab in Microsoft Edge and click the gear icon in the top-right corner of this page. Now, use the following settings:

  • Layout: Focused
  • Quick links: Off
  • Background: Off
  • Show greeting: Off
  • Office sidebar: Off
  • New tab tips: Off
  • Content: Content off

Other Settings

  • edge://flags/#enable-system-notifications = disabled
  •  edge://flags/#enable-quic =  disabled (privacy) enabled (speed)
    • Be aware that DoDo wants this OFF
  • edge://flags/#disable-accelerated-video-decode and 
  • edge://flags/#disable-accelerated-video-encode
If you get menus and dialog boxes not rendering correctly, a green screen appears when playing a video on Microsoft Edge, or there are rendering issues on a virtual machine, disabling hardware acceleration can resolve the problem

  •       edge://flags/#edge-global-media-controls =  enabled
  •       edge://flags/#enable-parallel-downloading =  enabled
  •       edge://flags/#smooth-scrolling = enabled
  •       edge://flags/#back-forward-cache = enabled
  •       edge://flags/#edge-experimental-tracking-prevention-features = enabled

---------------------

Disable or Replace ntp.msn.com

The exact URL, which is called every time you open a new tab, is ntp.msn.com. Unlike Google, Edge Chromium doesn’t offer any local page, which would load a lot faster. However, you can block the URL  via the Host file. Follow our guide on how you can edit the Hosts file,

Do this and then navigate to edge://settings/onStartup and then add about:blank against Open a specific page or pages under On Startup settings.



Some More Interesting Tweaks of Favorites in Edge Browser

Click on ‘Favorites’ + click ‘three dots’ : options such as importing favorites from another browser or removing duplicate links from favorites.

In the Favorites Bar, you can right-click any folder to see more interesting options; for example, you can open all Favorites links at once in a window.

In Favorites Bar, click any folder, then hover your mouse on any link and then right-click and you will see many useful options such as to edit, copy, cut or delete a specific link from the favorites.

---------------------