Skip to content

Instantly share code, notes, and snippets.

@ragingcomputer
ragingcomputer / esphome_samsung_exlink.yaml
Created June 19, 2024 01:07
ESPHome interface for Samsung EX-Link
@ragingcomputer
ragingcomputer / Random_Bluey_Episode.yaml
Created June 19, 2024 00:46
Play a random Bluey episode from Disney+ on AppleTV
service: media_player.play_media
data:
media_content_type: url
media_content_id: |
{{ ["https://www.disneyplus.com/play/72a18e44-5819-4b7d-984e-a57102237061",
"https://www.disneyplus.com/play/152269c3-1041-4e32-a672-578ec0183bfc",
"https://www.disneyplus.com/play/7f673afa-1313-4e1a-8284-e8b609e419ce",
"https://www.disneyplus.com/play/bce1d007-260d-4411-8b5d-d8704287ca4b",
"https://www.disneyplus.com/play/dfcdc0ae-483a-42ee-b197-7e07c28cece7",
"https://www.disneyplus.com/play/98a3744c-12d7-4989-8b13-c803b7048553",
@ragingcomputer
ragingcomputer / cnc_keypad.ino
Last active June 28, 2022 19:16
CNC Keypad / Custom USB Keyboard for LinuxCNC
#include "Keyboard.h"
#include <Keypad.h>
const int KEYDELAY = 100;
const int SEQDELAY = 500;
const byte ROWS = 2;
const byte COLS = 4;
// Define the Keymap
/*
@ragingcomputer
ragingcomputer / README.md
Last active March 4, 2022 20:55
LibreNMS Custom Alert for Spanning Tree STP Blocking Ports
@ragingcomputer
ragingcomputer / README.md
Last active November 1, 2022 12:34
Collect pfSense DHCP lease counts using telegraf and built-in tools

Collect pfSense DHCP lease counts using telegraf and built-in tools

Grafana Dashboard for pfSense highlighting DHCP Leases

Existing Collector

pfSense has the ability to collect DHCP lease statistics in it's Status -> Monitoring menu. That means it has some way to collect them.

searching through the source on github reveals dhcpd_gather_stats.php referenced in rrd.inc

pfSense runs this command to collect dhcpd lease counts from the lan interface: /usr/local/bin/php-cgi -q /usr/local/bin/dhcpd_gather_stats.php lan and this for the opt1 interface: /usr/local/bin/php-cgi -q /usr/local/bin/dhcpd_gather_stats.php opt1

@ragingcomputer
ragingcomputer / xprotect_corporate_db_to_icinga.py
Created February 3, 2020 23:18
Python script to run as cron job on Icinga2 host and create camera list by querying milestone xprotect corporate microsoft sql database. tested only with xprotect 2019
from pymssql import connect
import hashlib
import ipaddress
import subprocess
output_file = "/etc/icinga2/conf.d/ipcams/cameras.conf"
conn = connect(
host="milestone_sql.fq.dn",
user="read_user",
@ragingcomputer
ragingcomputer / README.md
Last active May 26, 2020 02:29
Python Requests Reboot Polycom Phones

Use Python & requests to reboot Polycom Phones

Tested on Polycom VVX 310, VVX 410, and Trio 8800 phones Assumes all phones have the same admin password

Usage: Update phones.py with a list strings containing IP address of phones to reboot Assuming you aren't using default admin password on the phones, update "restart_phone(phone, "Polycom:456")"

#include <Keypad.h>
#include "Keyboard.h"
const byte ROWS = 2;
const byte COLS = 4;
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3','4'},
{'5','6','7','8'}
};
@ragingcomputer
ragingcomputer / gigapan_lcd_KEYS_2316.ino
Last active November 12, 2017 21:28
DIY Gigapan using servos
#include <Servo.h>
#include <LiquidCrystal.h>
#define PIN_SERVO_SHUTTER 6
#define PIN_SERVO_TILT 10
#define PIN_SERVO_PAN 9
#define PIN_BEEP 8
#define SHUTTER_START_POINT 35
@ragingcomputer
ragingcomputer / MoodleCourseBackupArea.sql
Last active November 27, 2023 03:47
SQL query for Moodle to show space usage in Course Backup Area by course
SELECT mc.fullname AS CourseName,
ROUND((SUM(mf.filesize)/1024)/1024, 2) AS Storage_Used_MB
FROM mdl_files AS mf
LEFT JOIN mdl_context AS ctx ON mf.contextid = ctx.id
LEFT JOIN mdl_course AS mc ON ctx.instanceid = mc.id
WHERE mf.component = 'backup'
AND mf.filearea = 'course'
AND NOT mf.filename = '.'