Skip to content

Instantly share code, notes, and snippets.

View sirkirby's full-sized avatar
:octocat:

Chris Kirby sirkirby

:octocat:
View GitHub Profile
@sirkirby
sirkirby / unr-general-rules.md
Last active March 24, 2025 16:47
Unfi Network Rules Home assistant custom integration general rules

Rules

  • Always keep the code DRY for testability and separation of concerns
  • Prefer modern idiomatic Python 3.13 and open source conventions, Leverage type hints, use CONST over hard coded strings
  • Prioritize native Home Assistant libraries, like aiounifi, and other core capabilities to respect available resources and to avoid building duplicate fuctionality. Leverage the latest Home Assistant documentation.
  • Diagnostics enabled for observability and debugging should be targeted, respecting the resources of the system
  • When designing a new feature, prefer elegant solutions using established best practices and patterns.
  • When fixing a problem or bug, avoid treating the symptom, look for the root cause.
  • Details matter, ensure to always preserve existing functionality unless otherwise instructed.
@sirkirby
sirkirby / openwebui-values.yaml
Created January 23, 2025 19:38
Open WebUI helm chart custom values
pipelines:
# -- Automatically install Pipelines chart to extend Open WebUI functionality using Pipelines: https://github.com/open-webui/pipelines
enabled: true
# -- This section can be used to pass required environment variables to your pipelines (e.g. Langfuse hostname)
extraEnvVars: []
tika:
# -- Automatically install Apache Tika to extend Open WebUI
enabled: true
@sirkirby
sirkirby / ollama_service_win.bat
Created January 21, 2025 22:19
ollama windows service config
:: set global environment variables
setx OLLAMA_ORIGINS "*" /m
setx OLLAMA_HOST "0.0.0.0" /m
:: install service via non-sucking service manager, confirm dialog
nssm install OllamaService "C:\Users\chris\AppData\Local\Programs\Ollama\ollama.exe" serve
:: start the service
net start OllamaService
@sirkirby
sirkirby / ollama_service_startstop.sh
Created January 21, 2025 22:05
Ollama start and stop service on mac
# to start
launchctl load ~/Library/LaunchAgents/com.user.ollama.plist
launchctl start com.user.ollama
# to stop
launchctl stop com.user.ollama
launchctl unload ~/Library/LaunchAgents/com.user.ollama.plist
@sirkirby
sirkirby / com.user.ollama.plist
Last active January 24, 2025 15:21
ollama launch agent configuration file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.ollama</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/ollama</string>
@sirkirby
sirkirby / create-cert.sh
Created December 20, 2024 16:37
Create let's encrypt wildcard cert through Cloudflare with acme.sh
curl https://get.acme.sh | sh -s email=blog@chriskirby.net
# Source the installed script (or restart your terminal)
source ~/.bashrc # or source ~/.zshrc for macOS
# Export Cloudflare API Token
export CF_Token="your-cloudflare-api-token"
# Optional: Add this to your ~/.bashrc or ~/.zshrc to make it permanent
# Issue the certificate
@sirkirby
sirkirby / adguard-values.yaml
Created December 19, 2024 19:45
AdGuard Home Helm Chart values
image:
repository: adguard/adguardhome
pullPolicy: IfNotPresent
tag: latest
env:
TZ: America/Detroit
# customizing my web and dns services
# using the LoadBalancer to expose outside of the cluster
@sirkirby
sirkirby / AdGuardHome.yaml
Last active December 19, 2024 20:21
AdGuard Home yaml configuration example
bind_host: 0.0.0.0
bind_port: 3000
# I recommend adding a user account, but this is optional
# requires hashed password htpasswd -B -n -b <USERNAME> <PASSWORD>
users:
- name: admin
password: XXXXXXXXXXXXXXXXXXXXXXXX
auth_attempts: 5
block_auth_min: 15
http_proxy: ""
@sirkirby
sirkirby / migrate-dns-rewrites.py
Created December 17, 2024 22:34
Migrate pi-hole A and CNAME dns records to AdGuard DNS Rewrite rules
import sys
import yaml
import re
from typing import List, Dict, Any
class NoAliasDumper(yaml.SafeDumper):
"""Custom YAML dumper that ignores aliases."""
def ignore_aliases(self, data):
return True
@sirkirby
sirkirby / migrate-domains-user-rules.py
Last active December 20, 2024 16:31
Migrate Pi-hole whitelists and blacklists to AdGuard custom rules configuration
import json
import yaml
import sys
from datetime import datetime
import re
def clean_comment(comment):
"""Clean up comment by removing newlines and extra spaces."""
if not comment:
return ""