Skip to content

Instantly share code, notes, and snippets.

@rbleattler
rbleattler / docker-compose.yml
Last active February 24, 2022 02:11
Docker Compose for nginx proxy manager
version: "3"
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
# These ports are in format <host-port>:<container-port>
- '80:80' # Public HTTP Port
- '443:443' # Public HTTPS Port
- '81:81' # Admin Web Port
@rbleattler
rbleattler / Find-ChocoApp.ps1
Last active January 25, 2024 18:39
A command which will search chocolatey for a given package, and return a PowerShell object.
<#PSScriptInfo
.VERSION 1.0.1
.GUID d8d8b0bc-d1dd-4138-9166-dab64a38e8f6
.AUTHOR Robert Bleattler
.COMPANYNAME Coast Technologies LLC
@rbleattler
rbleattler / Find-StringInFile.ps1
Last active April 16, 2021 12:22
Finds String(s) in any non-excluded file (text-readable) in the target directory. Supports recursion. !MAY BE BROKEN!
function Find-StringInFile {
<#
.SYNOPSIS
Find strings within the contents of files in a given directory.
.DESCRIPTION
Find strings within the contents of files in a given directory. Supports recursion
.EXAMPLE
PS C:\> Find-StringInFile -String "SomeExampleText" -RootPath $PWD
This will search the current directory for files containing the string "SomeExampleText"
.EXAMPLE
@rbleattler
rbleattler / PSReadLineKeyHandlerSettings.ps1
Created April 11, 2021 15:07
Allows the Import and Export of PSReadLineKeyHandlerSettings in JSON format (to be expanded in the future)
Function Import-PSReadLineKeyHandlerSettings {
param(
[Parameter(Mandatory)]
[string]
$Path
)
begin {
$ObjectToProcess = Get-Content $Path -Raw | ConvertFrom-Json
}
process {
@rbleattler
rbleattler / ConvertFrom-HashTable.ps1
Last active March 23, 2021 18:58
Converts [HashTable]s to [PSCustomObject]s
function ConvertFrom-HashTable {
<#
.SYNOPSIS
This function will convert a hashtable to a [PSCustomObject]
.DESCRIPTION
This command will convert a hashtable to a [PSCustomObject]
.EXAMPLE
PS C:\> $HashTable
Name Value
@rbleattler
rbleattler / AdvancedFunction.powershell.snippet
Last active March 23, 2021 19:09
A VSCode PowerShell snippet that builds an advanced function template with begin/process/end, and transcript logging.
# @prefix Function Advanced
# @description Advanced Function Block
function Write-MyFunction {
[CmdletBinding()]
param (
$$MyVariable1
)
begin {
Write-Debug "Enter [$($$PSCmdlet.MyInvocation.MyCommand.Name)]..."
@rbleattler
rbleattler / Get-FileAttributes.ps1
Created March 8, 2021 15:35
PowerShell Function: Get Extended File Attributes
function Get-FileAttributes {
[CmdletBinding()]
param (
[string]
$FilePath
)
begin {
Write-Debug "Enter [$($PSCmdlet.MyInvocation.MyCommand.Name)]..."
$PSBoundParameters.Keys.ForEach{
if ($PSBoundParameters.PSItem -is [string]) {
@rbleattler
rbleattler / Get-RepositoryStats.ps1
Created March 3, 2021 15:29
A useful tool that can determine Work Directory information such as number of files and directories, as well as the number of characters and lines in the files + some Easter Eggs ;)
function Get-RepositoryStats {
[CmdletBinding()]
param (
[string]
$WorkDirectory,
[switch]
$UseGitignore,
[switch]
$Novels
)
@rbleattler
rbleattler / Write-Verbose.ps1
Created February 18, 2021 14:57
PowerShell Write Verbose with Timestamp Parameter
function Write-Verbose {
[CmdletBinding()]
Param(
[Parameter(Mandatory, ValueFromPipeline, Position = 0)]
[string]
$Message,
[Parameter()]
[switch]
$TimeStamp
)
@rbleattler
rbleattler / Set-NaturalScrolling.ps1
Last active February 17, 2021 16:27
Enable/Disable Natural Mouse Scrolling in Windows via PowerShell (requires restart to take effect)
param (
[Parameter(ParameterSetName = 'Enable', Mandatory)]
[switch]
$Enable,
[Parameter(ParameterSetName = 'Disable', Mandatory)]
[switch]
$Disable
)
function Set-MouseScrollDirection {