Skip to content

Instantly share code, notes, and snippets.

View PhilMurwin's full-sized avatar

Phil Murwin PhilMurwin

View GitHub Profile
@PhilMurwin
PhilMurwin / MakeMP4.ps1
Created February 3, 2025 18:49
Script to remux video files to mp4
function makemp4 {
# List of supported video file extensions, including 3G2
$extensions = @("*.mkv", "*.avi", "*.mov", "*.3g2") # Add other extensions as needed
# Display the supported formats at the start of the script.
$formats = $extensions -replace "\*\.", "" -join ", "
Write-Host "Supported formats: $formats"
# Get all video files in the current directory that match the supported extensions.
$videoFiles = Get-ChildItem .\* -Include $extensions
@PhilMurwin
PhilMurwin / pdf2png.ps1
Created February 3, 2025 18:47
Script to convert a PDF to a PNG using imagemagick and ghostscript
function Command-Exists {
param($command)
$oldPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
$exists = Get-Command $command -ErrorAction SilentlyContinue
$ErrorActionPreference = $oldPreference
return $exists -ne $null
}
function Check-ImageMagick {
@PhilMurwin
PhilMurwin / Start-VisualStudio-fromsln.ps1
Created February 3, 2025 18:35
Script to list sln files in a directory and start user selected sln from powershell
## Open sln in Visual Studio from the containing folder
function Start-VisualStudio([string]$folder)
{
# Set folder to current directory if not specified
if ([string]::IsNullOrWhiteSpace($folder))
{
$folder = $(Get-Location).Path
}
# Ensure folder path ends with a backslash
@PhilMurwin
PhilMurwin / makemp4.ps1
Created October 19, 2024 22:02
Powershell script to convert video files to mp4 using ffmpeg
<#
.SYNOPSIS
Converts video files of various formats (e.g., MKV, AVI, MOV) to MP4 using FFmpeg.
.DESCRIPTION
This script searches the current directory for video files with specified extensions
and converts them to MP4 format without re-encoding (using stream copy).
The script uses FFmpeg for conversion and suppresses detailed output during the process.
Any errors encountered during the conversion are logged.
@PhilMurwin
PhilMurwin / garlic-os-tips.md
Created May 23, 2023 18:43 — forked from milnak/garlic-os-tips.md
[GarlicOS Tips for Windows] My set of GarlicOS tips

Garlic OS Tips

GarlicOS Installation

This is for a single SD card. You can use two SD cards, but I find a single SD card is cheap and easy to manage.

Download RG35XX-MicroSDCardImage.7z.001 and RG35XX-MicroSDCardImage.7z.002

Extract RG35XX-MicroSDCardImage.7z.001 using 7-zip (open the .7z.001 file) to somewhere on your hard drive (not the USB card!).

@PhilMurwin
PhilMurwin / pwsh_makecert.ps1
Created March 16, 2023 17:26
Powershell New Self Signed Cert
# https://mattou07.net/posts/create-a-self-signed-certificate-for-iis-with-powershell/
# https://www.yaplex.com/how-to-create-a-self-signed-certificate-for-iis-using-powershell/
# https://adamtheautomator.com/new-selfsignedcertificate/
$binding = Read-Host -Prompt 'Enter the site you need a cert for: '
$cert = New-SelfSignedCertificate -DnsName "$binding" -NotAfter (Get-Date).AddMonths(72) -CertStoreLocation "cert:\LocalMachine\My"
Write-Host "Cert [$binding] has been created in the local machine cert store."
Write-Host "Cert will expire in 6 years."
@PhilMurwin
PhilMurwin / SQLServer_FindString.sql
Created January 12, 2023 19:59
SQL Server - Find a string in any table in the database
DECLARE @SearchStr nvarchar(100) = 'SEARCH_TEXT'
DECLARE @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
WHILE @TableName IS NOT NULL
@PhilMurwin
PhilMurwin / node_notes.md
Created July 11, 2022 04:06
Windows Nodejs Notes
@PhilMurwin
PhilMurwin / GenerateSelfSignedCert_2022.ps1
Created February 3, 2022 16:46
Generate Self Signed Cert using powershell
#GenerateSelfSignedCert_2022.ps1
# Information from: https://www.tutorialspoint.com/how-to-create-a-self-signed-certificate-using-powershell
# Additional/Similar information from: https://petri.com/create-self-signed-certificate-using-powershell
# Get Current Directory
$curDir = Get-Location
#Write Header
Write-Host "`n WARNING: This script is provided AS-IS with no warranties and confers no rights." -ForegroundColor Yellow
@PhilMurwin
PhilMurwin / selfsigned_wildcard_cert.md
Created September 24, 2021 17:55 — forked from PSGM/selfsigned_wildcard_cert.md
Creating a self-signed wildcard certificate for server authentication in a Windows environment

Creating a self-signed wildcard certificate for server authentication in a Windows environment

We are increasingly using, or being required to use, SSL-encrypted sessions (or technically, TLS-encrypted sessions) for application services. In technical terms, because the Fully Qualified Domain Name (FQDN) in the Uniform Resource Locator (URL) used by a client to access a service needs to match the Common Name (CN) in the certificate used by that service, we potentially have a proliferation of certificates (at least one per server) that need to be available to clients

One approach to addressing this proliferation is to use wildcard certificates that match multiple FQDNs within a domain. Below is a discussion on generating self-signed wildcard certificates as a way of addressing this

What