Skip to content

Instantly share code, notes, and snippets.

View wipash's full-sized avatar
🏠
Working from home

Sean McGrath wipash

🏠
Working from home
View GitHub Profile
@wipash
wipash / gcm-llm.fish
Last active August 27, 2024 02:27
AI-powered git commit message generator, for Fish shell
function gcm
# Check if llm is installed, if not, install it
if not type -q llm
echo "'llm' is not installed. Attempting to install it using brew..."
if brew install llm
echo "'llm' installed successfully."
else
echo "Failed to install 'llm'. Please install it manually and try again."
return 1
end
$MaxLogAge = 31
$LogFilesDirectory = 'C:\inetpub\logs\LogFiles\'
$ErrorActionPreference = 'SilentlyContinue'
if ($LogFilesDirectory) {
Set-Location $LogFilesDirectory
# For all directories that start with "W3SVC" run the following
foreach ($LogDirectory in Get-ChildItem $LogFilesDirectory | Where-Object { $_.PsIsContainer -and $_.Name -match '^W3SVC' }) {
{
"basics": {
"name": "Sean McGrath",
"label": "Solution Architect",
"image": "",
"email": "sean@mcgrath.nz",
"url": "https://sean.mcgrath.nz",
"summary": "A summary of Sean McGrath...",
"location": {
"city": "Auckland",
name: Intune Config Backup
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Runs daily at 2pm UTC
schedule:
- cron: "0 14 * * *"
@wipash
wipash / Fix-InheritedPermissions.ps1
Last active June 15, 2022 03:44
Fix inherited permissions on child folders of a specific folder
#requires -Version 7
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0)]
[string]$FolderPath,
[Parameter(Mandatory = $false, Position = 1)]
[string]$Filter,
[Parameter(Mandatory = $false, Position = 2)]
[switch]$OnlyReportSkippedFolders,
name: Azure AD Config Backup
on:
workflow_dispatch:
# Runs daily at 4pm UTC
schedule:
- cron: "0 16 * * *"
permissions:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 26h
kube-system kube-dns ClusterIP 10.43.0.10 <none> 53/UDP,53/TCP,9153/TCP 26h
kube-system metrics-server ClusterIP 10.43.56.59 <none> 443/TCP 26h
flux-system notification-controller ClusterIP 10.43.245.29 <none> 80/TCP 26h
flux-system source-controller ClusterIP 10.43.184.171 <none> 80/TCP 26h
flux-system webhook-receiver ClusterIP 10.43.92.83 <none> 80/TCP 26h
podinfo podinfo LoadBalancer 10.43.180.75 10.0.16.120 9898:30546/TCP,9999:31271/TCP 26h
kube-system traefik LoadBalancer 1
@wipash
wipash / list-zfs-unused-drives.sh
Created June 11, 2020 21:24
Tool to list drives that are unused by ZFS. Useful when you've just added a stack of new drives to a big ZFS system.
#Get all drive info from ZDB, trim all path off the front and drop partition info from the back
used=$(zdb | grep -e ' path:' | sed -r "s/^.*(ata-.*)/\1/" | sed -r "s/(.*)-part1'|'/\1/" | sort)
#Get all ATA disks from the system
all=$(ls /dev/disk/by-id/ | grep -v part | grep -e ata- | sort)
#Compare both lists
unmatched=$(comm -13 <( echo "$used" ) <( echo "$all" ))
#Zpool status output to catch cache drives
@wipash
wipash / Create-VM-cloud-init.ps1
Last active July 11, 2024 12:21
Create Linux VM on Hyper-V with cloud-init
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
# Description: Boxstarter Script
# Author: Sean McGrath <sean@mcgrath.net.nz>
# Last Updated: 2018-12-07
#
# Install Boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# Set: Set-ExecutionPolicy RemoteSigned
# Then: Install-BoxstarterPackage -PackageName <URL-TO-RAW-GIST> -DisableReboots
#