onecompiler / cheatsheets
Large collection of Developer Cheat Sheets, created and maintained by the awesome developers across the globe
Large collection of Developer Cheat Sheets, created and maintained by the awesome developers across the globe
| re='^[0-9]+$' | |
| if ![[ $yournumber =~ $re ]]; then | |
| echo "error: Not a number" >&2 | |
| fi |
| <# | |
| .SYNOPSIS | |
| Creates and displays a Windows Toast notification | |
| .DESCRIPTION | |
| Creates a Windows Toast notification and displays it to the user | |
| .PARAMETER AppId | |
| The AppId of the application that will display the notification |
| function Format-Text { | |
| <# | |
| .SYNOPSIS | |
| Writes text with color and formatting | |
| .DESCRIPTION | |
| Writes text with color, formatting and RGB support | |
| .INPUTS | |
| This function accepts pipeline input. |
| function Show-WebRequestDownloadJobState { | |
| <# | |
| .SYNOPSIS | |
| Display a simple animation while waiting for a download job to complete. | |
| .DESCRIPTION | |
| Waits for a download job to complete, displaying a | |
| progress bar while it is running. When the download is complete, the | |
| function will write a completion message to the console. | |
| function Measure-UserBandwidth { | |
| <# | |
| .SYNOPSIS | |
| Measures the user's Internet bandwidth. | |
| .DESCRIPTION | |
| Measures internet bandwidth using the Ookla Speedtest CLI, which is a command-line interface to the Speedtest.net website. | |
| The function will download the CLI from the internet if necessary. | |
| .PARAMETER Type |
| function Invoke-URLInDefaultBrowser | |
| { | |
| <# | |
| .SYNOPSIS | |
| Cmdlet to open a URL in the User's default browser. | |
| .DESCRIPTION | |
| Cmdlet to open a URL in the User's default browser. | |
| .PARAMETER URL | |
| Specify the URL to be Opened. | |
| .EXAMPLE |
| using assembly System.Windows.Forms | |
| using namespace System.Windows.Forms | |
| using namespace System.Drawing | |
| #Enable visual styles | |
| [Application]::EnableVisualStyles() | |
| #Enable DPI awareness | |
| $code = @" | |
| [System.Runtime.InteropServices.DllImport("user32.dll")] |
| function Get-FileFromWeb { | |
| param ( | |
| # Parameter help description | |
| [Parameter(Mandatory)] | |
| [string]$URL, | |
| # Parameter help description | |
| [Parameter(Mandatory)] | |
| [string]$File | |
| ) |
| # extracted from: https://bun.sh/install | |
| # https://github.com/oven-sh/bun | |
| # Reset | |
| Color_Off='' | |
| # Regular Colors | |
| Red='' | |
| Green='' | |
| Dim='' # White |