Skip to content

Instantly share code, notes, and snippets.

@sideup66
sideup66 / enabled_motion_detection.py
Created May 7, 2025 17:03
enable motion detection python
import asyncio
from wyzeapy import Wyzeapy
from wyzeapy.services.camera_service import Camera, CameraService
async def async_main():
#Turns on motion detection
client = await login()
camera_service = await client.camera_service
cameras = await camera_service.get_cameras()
for camera in cameras:
@sideup66
sideup66 / watchdog.sh
Created April 8, 2024 03:08
watchdog script to monitor a script (in my case, home_away as i had issues with it being killed in dd-wrt for unknown reasons. This seems to be resolved, however I would like some peace of mind around this incase it happens again. ChatGPT was used to generate it. You can tie this to cron on any schedule you wish and even log if needed.
#!/bin/sh
# Define the name of the script to watch
SCRIPT_NAME="script.sh"
# Function to get current date and time
get_timestamp() {
date +"%Y-%m-%d %T"
}
@sideup66
sideup66 / mac_addresses.txt
Created April 8, 2024 02:56
Example mac_addresses.txt file for home_away_detect 1.5 script. Feel free to copy this into your own file to have an example with some comments.
# Place each MAC address on a separate line like below:
# 11:22:33:44:55:66
# AA:BB:CC:DD:EE:FF
@sideup66
sideup66 / home_away_detect.sh
Last active July 22, 2024 03:29
Home_away_detect v1.5
#!/bin/sh
PREVIOUS_STATE="home"
X=0
while true; do
# Read MAC addresses from file into a variable
MAC_ADDRESSES=$(cat /path/to/mac_addresses.txt)
ANYONE_HOME=0
@sideup66
sideup66 / Simple fizzbuzz in powershell
Created December 20, 2023 21:01
Fizzbuzz Powershell
#this script will run a simple fizzbuzz application in powershell
$num = Read-Host "Please enter a number to calculate"
#now we calculate the whole fizzbuzz bit
for (($i = 1); $i -le $num; $i++)
{
If (($i % 3 -eq 0) -And ($i % 5 -ne 0))
{
Write-Host "Fizz"
}
@sideup66
sideup66 / fizzbuzz.sh
Created December 18, 2023 03:27
Simple fizzbuzz shell script for Bash
#Simple fizzbuzz script for bash
#!/bin/bash
echo "Input a value for fizzbuzz"
read num
for (( i = 1; i <= $num; i++ ))
do
if [ $(( "$i" % 3 )) -eq 0 ] && ! [ $(( "$i" % 5 )) -eq 0 ]
then
echo "Fizz"
elif [ $(( "$i" % 5 )) -eq 0 ] && ! [ $(( "$i" % 3 )) -eq 0 ]
@sideup66
sideup66 / pihole_lock.sh
Created July 8, 2023 06:01
Little script made to control access to my pihole and prevent unwanted tampering. Will unlock for an hour every day to allow any work that needs to be done, then lock again after.
#!/bin/bash
# Set the desired reveal time (24-hour format) when the ports should be unblocked
unblock_time="01:00"
#block ports at startup, they will unblock when needed.
ufw deny 80
ufw deny 22
while true
#!/bin/sh
#little script to perform dyndns updates of ipv6 addresses for afraid.org
#assign last ip now so we have a var to check
last_ip=0
while sleep 300
do
current_ip=$(ip -6 addr list scope global $device | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1)
if [ "$current_ip" != "$last_ip" ]; then
#the check failed, update the ip
echo "The IP address is out of date.The Last IP logged is $last_ip .The Current IP is $current_ip, updating the IP"
@sideup66
sideup66 / dyndnsupdate.sh
Last active December 7, 2023 18:45
dyndns update script original from dd wrt https://wiki.dd-wrt.com/wiki/index.php/Useful_Scripts modified for ipv6
#!/bin/sh
# DynDNS Updater Script, with HTTPS/SSL Support
# This example uses NameCheap's HTTPS/SSL URL update method to update the IP for hostname.example.com. This script runs in an endless loop set to the UPDATE_INTERVAL which is currently 5 minutes.
# Edit the settings section to match your DynDNS provider, including the DDNS URL which will be unique for each provider.
# This script requires curl and its CA Bundle to be installed in /opt/usr/bin, see the DynDNS article for more information.
# alfer@fusebin.com
# Debug
#set -x
@sideup66
sideup66 / GeoIP block using IPSET
Created June 16, 2022 02:00
GeoIP block using ipsets. script was originally derived from a old thread on the dd-wrt forums located here: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=280462&postdays=0&postorder=asc&start=0
#!/bin/sh
set -x
##Verify the network is up before continuing
until ping -c1 www.google.com >/dev/null 2>&1; do :; done
### Block all traffic from listed. Use ISO code ###
ISO="br-aggregated cn-aggregated tw-aggregated ru-aggregated ir-aggregated ph-aggregated sg-aggregated hk-aggregated ua-aggregated ge-aggregated cz-aggregated in-aggregated ke-aggregated za-aggregated id-aggregated kh-aggregated vn-aggregated rs-aggregated tr-aggregated al-aggregated bg-aggregated kr-aggregated ph-aggregated"