Monday, July 24, 2023

Chrome DevTools : Network Tab HTTP Trace Filter Keywords

 

Introduction

Use the Advanced Network Panel Filtering function to focus your search on the HTTP Request trace resources you need. Finding trace items that are more than X megabytes in size or even resources that match a specific status code can be done with this.

More info can be found here:  Chrome Dev Tools Network Tab How Tos.

How to use this feature

Open DevTools via F12, load a page to view the HTTP traffic. Then in the Network Panel, enter your queries in the Filter input box (click the filter icon if it's not already selected. Then type in queries like:

Some Sample Filters

larger-than:100 will find and filter for resources larger than 100 bytes

You can negate a query by prepending a '-' to it. E.g. -larger-than:50k to find resources which are not larger than 50k.

status-code:204 to find resources with a status code response of 204.




Network Filter Keywords : 

domain

has-response-header

is - learn more about the is: network filter

larger-than

method

mime-type

mixed-content

priority

scheme

set-cookie-domain

set-cookie-name

set-cookie-value

resource-type

cookie-domain

cookie-name

cookie-path

cookie-value

status-code

url

Note: you get autocomplete in the filter text box

Friday, July 21, 2023

Powershell 7+: PSReadLine 2+ Favorites

  Some saved PS Keyboard Shortcuts:

Tab Support: Get Noun Commands for Module:

Get Commands for a noun:
Get Command Examples Help:

History

Ctrl-r: search hist backwards

Ctrl+S : search hist forwards 


Intellisense

ctrl-? : find all chords matching key

Right Arrow: accept the suggestion

menu-Spacebar: display suggestions

Ctrl+L : in PowerShell to clear the screen

Ctrl+@        MenuComplete        Complete the input if there ...

Ctrl+Spacebar : MenuComplete        Complete the input if there ...

Alt-H : param info


Show all key  functions

Ctrl+Alt+?

Get-PSReadLineKeyHandler -Bound

Set Prediction Options:

Set-PSReadLineOption -BellStyle None # Prevent annoying beeping noises

Set-PSReadLineOption -PredictionViewStyle ListView

Set-PSReadLineOption -PredictionSource HistoryAndPlugin



Output popup

Get-Process | Out-GridView

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