Skip to content

Instantly share code, notes, and snippets.

View nshores's full-sized avatar
Working from home

Nick Shores nshores

Working from home
View GitHub Profile
hunterjm / frigate_notification.yaml
Last active August 23, 2023 02:53
Frigate Notification Blueprint
View frigate_notification.yaml
name: Frigate Notification
description: |
## Frigate Mobile App Notification
This blueprint will send a notification to your device when a Frigate event for the selected camera is fired. The notification will initially include the thumbnail of the detection, but will update to include actionable notifications allowing you to view the saved clip/snapshot when available, or silence the notification for a configurable amount of time.
With this blueprint, you may send the notification to multiple devices by leaving "Device" blank and instead use a [notification group][1].
### Required entities:
Dapacruz /
Created August 7, 2020 01:20
Panorama Dynamic Inventory for Ansible Tower
#!/usr/bin/env python2.7
import argparse
import json
import os
import sys
import urllib
import urllib2
import xml.etree.ElementTree as ET
janeczku /
Created June 10, 2020 14:10
How to register Rancher managed Kubernetes clusters in Argo CD

How to register Rancher managed Kubernetes clusters in Argo CD

Registering Rancher managed clusters in Argo CD doesn't work out of the box unless the Authorized Cluster Endpoint is used. Many users will prefer an integration of Argo CD via the central Rancher authentication proxy (which shares the network endpoint of the Rancher API/GUI). So let's find out why registering clusters via Rancher auth proxy fails and how to make it work.

Hint: If you are just looking for the solution scroll to the bottom of this page.

Why do i get an error when running argocd cluster add?

Service Account tokens and the Rancher authentication proxy

max-rocket-internet /
Last active September 29, 2023 03:22
How to display Kubernetes request and limit in Grafana / Prometheus properly

CPU: percentage of limit

A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.

This is specific to k8s and containers that have CPU limits set.

To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:

sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
phillijw / traefik-docker-compose.yml
Last active January 28, 2021 19:08
Working traefik + zoneminder docker setup
View traefik-docker-compose.yml
version: '3'
image: traefik
restart: always
- "80:80" #http
- "443:443" #https
- "8080:8080" #web ui
Dapacruz / Redirect-VMHostLogs.ps1
Last active October 16, 2018 21:29
Redirect VMware ESXi Host Logs
View Redirect-VMHostLogs.ps1
$hosts = '*'
$datastore_name = 'NS-VMFS-01'
$datastore = Get-Datastore -Name $datastore_name | Select-Object -First 1
$log_dir = '[{0}] Logs' -f $datastore.Name
$scratch_location = '{0}/Logs' -f $datastore.ExtensionData.Info.Url -replace 'ds://'
foreach ($h in (Get-VMHost $hosts | Sort-Object -Property Name)) {
Write-Host "$($h.Name): Redirecting log files ..."
$result = Get-AdvancedSetting -Entity $h -Name | Set-AdvancedSetting -Value "$log_dir/$h" -Confirm:$false
Write-Host "New syslog location: $($result.Value)"
Dapacruz / Configure-Ntp.ps1
Created December 7, 2017 00:02
Configure/Enable NTP on a VMware ESXi Host
View Configure-Ntp.ps1
$hosts = '*'
$ntp_servers = '', ''
Get-VMHostService -VMHost $hosts | Where-Object {$_.key -eq 'ntpd'}
Get-VMHostNtpServer -VMHost $hosts
Add-VMHostNtpServer -VMHost $hosts -NtpServer $ntp_servers
Get-VMHostService -VMHost $hosts | Where-Object {$_.key -eq 'ntpd'} | Start-VMHostService | Set-VMHostService -Policy 'automatic'
prasanthj / lirc-pi3.txt
Last active January 5, 2023 01:35
Getting lirc to work with Raspberry Pi 3 (Raspbian Stretch)
View lirc-pi3.txt
Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 (bought from Amazon [1]).
The vendor has some documentation [2] but that is not complete and sufficient for Raspbian Stretch.
Following are the changes that I made to make it work.
$ sudo apt-get update
$ sudo apt-get install lirc
# Add the following lines to /etc/modules file
lirc_rpi gpio_in_pin=18 gpio_out_pin=17
vidia / nginx-unificontroller.conf
Last active September 7, 2023 09:53
Example, working, NGINX config for proxying to Unifi Controller software and using letsencrypt. Includes websocket fix.
View nginx-unificontroller.conf
# I had a bit of trouble getting my unifi controller (hosted offsite) to use a proxy/letsencrypt. So here are the fruits of my labor.
# The unifi default port is 8443 running on localhost.
# License: CC0 (Public Domain)
server {
# SSL configuration
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
mobzystems / Start-FileSystemWatcher.ps1
Last active March 31, 2021 03:09
Using a FileSystemWatcher from PowerShell
View Start-FileSystemWatcher.ps1
# Start-FileSystemWatcher.ps1 - File System Watcher in Powershell.
# Brought to you by MOBZystems, Home of Tools
# The path to monitor
[Parameter(Mandatory=$true, Position=0)]
# Monitor these files (a wildcard)