Skip to content

Instantly share code, notes, and snippets.

@yujiterada
yujiterada / verkada_streaming_middleware.py
Created July 6, 2026 03:33
Verkada Streaming API Middleware
#!/usr/bin/env python3
"""
Verkada HLS middleware.
Verkada ---> [this script] ---> http://localhost:8000/stream.m3u8 ---> VLC
What it does:
1. Fetches a Verkada streaming JWT and refreshes it every 25 minutes
(kept in memory + written to token.json).
2. Polls the upstream stream.m3u8 (codec=hevc) every 1 second.
@yujiterada
yujiterada / main.py
Created June 30, 2026 06:59
Verkada Helix example
import os
import requests
import logging
import time
import json
import csv
from datetime import datetime
from zoneinfo import ZoneInfo
@yujiterada
yujiterada / reboot_meraki_devices.py
Created April 18, 2024 12:05
Reboot Meraki devices based on CSV file
import csv
import meraki
import os
from meraki.exceptions import APIError
# Constants
API_KEY = os.environ.get('MERAKI_API_KEY') # Replace with your Meraki Dashboard API key
GROUP_NUMBER = 1 # The target group number to check for
INPUT_CSV_FILE = 'input.csv' # Path to the input CSV file
OUTPUT_CSV_FILE = 'output.csv' # Path to the output CSV file
@yujiterada
yujiterada / dump_mx_l3_acl_to_csv.py
Created February 7, 2024 13:12
Sample script to output MX L3 ACL to CSV
import os
# run "pip3 install meraki"
import meraki
import json
MERAKI_API_KEY = os.environ.get("MERAKI_API_KEY")
ORG_ID = "734417"
dashboard = meraki.DashboardAPI(
api_key=MERAKI_API_KEY,
@yujiterada
yujiterada / reapply_port_schedule.py
Created December 4, 2023 22:27
Reapply port schedule to a port
import json
import meraki
import os
API_KEY = os.environ.get('MERAKI_API_KEY')
DATA = {
"Q4CD-XXXX-YYYY": {
11: "726205439913492796"
}
}
@yujiterada
yujiterada / mt30_receiver.py
Created December 4, 2023 22:25
Flask app to receive MT30 webhooks
from flask import Flask, request, jsonify
import meraki
import json
import os
import threading
import time
app = Flask(__name__)
@yujiterada
yujiterada / poe_monitor.py
Created December 4, 2023 22:23
Monitor PoE consumption, traffic received, traffic sent, and number of associated clients for MRs
import json
import os
import sys
import re
import logging
import time
import meraki
DATA = {
@yujiterada
yujiterada / snmpwalk.py
Created November 3, 2022 03:49
SNMP Walk
from pysnmp.hlapi import *
V2_COMMUNITY = 'meraki-rw'
MERAKI_DEVICE = '192.168.128.108'
iterator = nextCmd(
SnmpEngine(),
CommunityData(V2_COMMUNITY),
UdpTransportTarget((MERAKI_DEVICE, 161)),
ContextData(),
@yujiterada
yujiterada / receive_snmp_trap_from_meraki.py
Created November 3, 2022 03:42
Receive SNMP Trap from Meraki Dashboard
import socket
from pysnmp.proto import api
from pyasn1.codec.ber import decoder
port = 162
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", port))
while 1:
data, addr = s.recvfrom(4048)
@yujiterada
yujiterada / get_all_meraki_organization_license_status.py
Created October 21, 2022 09:21
Obtains license status for all Meraki organizations attached to the account. Compatible with PDL and Co-term.
import os
from datetime import datetime
import meraki
MERAKI_API_KEY = os.environ.get('MERAKI_API_KEY', None)
def device_needs_license(device):