Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nick Shores nshores

🏠
Working from home
View GitHub Profile
@nshores
nshores / tinder.py
Created Jul 8, 2021
tinder prep.py
View tinder.py
string = "Horse Apple Cake"
print(string)
#Find check if a substring is contained
#The find method returns -1 if no match, and the index where the substring starts otherwise
word = 'hello'
search = (word.find('ll'))
if (word.find('ll') != -1):
View get_az_vm.py
#!/usr/bin/env python
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
import json
from json2html import *
# Tenant ID for your Azure subscription
TENANT_ID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
View frigate_config.yml
mqtt:
host: tasks.hivemq-broker
cameras:
front_door:
ffmpeg:
inputs:
- path: rtsp://admin:4118nick@192.168.99.148:554/live
roles:
- detect
- rtmp
@nshores
nshores / az_update_vm_disk.ps1
Created Apr 27, 2021
update vm disks in azure
View az_update_vm_disk.ps1
#select sub
Select-AzSubscription -Subscription 95a20cd8-ca92-4b1e-9d7a-f9ca650b8811
# Name of the resource group that contains the VM
$rgName = 'AMS-prd'
# Choose between Standard_LRS, StandardSSD_LRS and Premium_LRS based on your scenario
$storageType = 'Premium_LRS'
@nshores
nshores / azurerm_netapp_volume_debug
Created Mar 1, 2021
azurerm_netapp_volume_debug
View azurerm_netapp_volume_debug
(and 3 more similar warnings elsewhere)
Error: rpc error: code = Unavailable desc = transport is closing
Error: rpc error: code = Unavailable desc = transport is closing
View ansible-resize-lvm.sh
ansible -i /mnt/c/Users/nshores/Documents/repos/shoreslab/ansible/hosts.nshores swarm_nodes -m shell -a '/bin/bash -c " \
(echo n; echo ""; echo ""; echo ""; echo w) | sudo fdisk /dev/sda && \
sudo pvcreate /dev/sda4 && \
sudo vgextend ubuntu-vg /dev/sda4 && \
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv && \
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv"'
@nshores
nshores / check_snmp_rev.yml
Last active Nov 30, 2020
check_snmp_rev.yml
View check_snmp_rev.yml
---
- hosts: test
become: yes
#Is sudo actually needed? Only use it when needed.
become_method: sudo
#Use variables whenever possible. You can place them in the task, or in a outside file at the inventory level.
vars:
snmp_path: "/etc/snmp/snmpd_conf/snmpd.conf"
backup_path: "/etc/snmp/snmpd_conf/snmpd.conf.bak"
tasks:
@nshores
nshores / check_patio_monitor.sh
Created Jul 27, 2020
check_patio_monitor.sh
View check_patio_monitor.sh
#!/bin/sh
if pgrep -f "python3 patio_light_notify.py"; then
pid=$(pidof python3 patio_light_notify.py)
echo "pid of patio_light_notify:" $pid
echo "it is already running"
exit
else
echo "starting patio notify script"
cd /home/zoneminder/
@nshores
nshores / check_zm_alarm.py
Last active Jul 27, 2020
check_zm_alarm.py
View check_zm_alarm.py
import pyzm.ZMMemory as zmmemory
import requests
import time
#set monitor id
mid = 6
#HA Url
ha_webhook = 'http://slim-dev.local:8123/api/webhook/patio'
View rgb_patio_lights.yaml
- alias: Turn on patio lights when motion detected by camera
trigger:
platform: state
entity_id: camera.backyard
to: 'recording'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action: