Skip to content

Instantly share code, notes, and snippets.

View neuralpain's full-sized avatar
💻
Solving problems

neuralpain neuralpain

💻
Solving problems
View GitHub Profile
@neuralpain
neuralpain / New-ToastNotification.ps1
Last active August 12, 2024 14:00
Simple Toast Notification for Windows
<#
.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
@neuralpain
neuralpain / Format-Text.ps1
Last active August 8, 2024 03:02
Formats text in the console with Basic, 8-bit and 24-bit RGB colors and other formatting options
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.
@neuralpain
neuralpain / Show-WebRequestDownloadJobState.ps1
Last active May 1, 2024 07:11
Display a simple animation while waiting for a download job to complete
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.
@neuralpain
neuralpain / Measure-UserBandwidth.ps1
Last active April 6, 2024 01:40
Measures the user's Internet bandwidth
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
@neuralpain
neuralpain / Invoke-URLInDefaultBrowser.ps1
Created March 14, 2024 10:39 — forked from jkdba/Invoke-URLInDefaultBrowser.ps1
PowerShell cmdlet to open a URL in the user's default browser.
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
@neuralpain
neuralpain / Set-DpiAware.ps1
Created March 9, 2024 06:09
Add DPI awareness to Powershell-run .Net Windows Forms
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")]
@neuralpain
neuralpain / Get-FileFromWeb.ps1
Created October 8, 2023 01:34 — forked from ChrisStro/Get-FileFromWeb.ps1
Get-FileFromWeb | Function to show download progress in powershell
function Get-FileFromWeb {
param (
# Parameter help description
[Parameter(Mandatory)]
[string]$URL,
# Parameter help description
[Parameter(Mandatory)]
[string]$File
)
@neuralpain
neuralpain / cli_text_display_colors.sh
Last active February 8, 2024 01:27
Predefined functions for displaying colored CLI messages based on type, i.e., success, error and information
# extracted from: https://bun.sh/install
# https://github.com/oven-sh/bun
# Reset
Color_Off=''
# Regular Colors
Red=''
Green=''
Dim='' # White
@neuralpain
neuralpain / README_LIGHT_DARK.txt
Last active June 12, 2024 15:03
README head logo proper light & dark theme template
<p align="center">
<picture>
<source srcset="https://cdn.example.com/logo-light.svg" media="(prefers-color-scheme: light)" height="96px" alt="logo light">
<img src="https://cdn.example.com/logo-dark.svg" height="96px" alt="logo dark">
</picture>
</p>
@neuralpain
neuralpain / PwshBatch.cmd
Last active August 8, 2024 02:57
Run a PowerShell code block once in a batch script at any given time and return to Batch when done.
<# :# PowerShell comment protecting the Batch section
@echo off
:# Disabling argument expansion avoids issues with ! in arguments.
setlocal EnableExtensions DisableDelayedExpansion
:# Prepare the batch arguments, so that PowerShell parses them correctly
set ARGS=%*
if defined ARGS set ARGS=%ARGS:"=\"%
if defined ARGS set ARGS=%ARGS:'=''%