Skip to content

Instantly share code, notes, and snippets.

@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 = '.'
@ragingcomputer
ragingcomputer / MoodleUserPrivateBackupArea.sql
Created January 12, 2017 22:21
SQL query for Moodle to show space usage in User Private Backup Area by user
SELECT CONCAT(mu.firstname, ' ', mu.lastname, ' (', mu.email, ')' ) AS Teacher,
ROUND((SUM(mf.filesize)/1024)/1024, 2) AS Storage_Used_MB
FROM mdl_files AS mf
LEFT JOIN mdl_user AS mu ON mf.userid = mu.id
WHERE mf.component = 'user'
AND mf.filearea = 'backup'
AND NOT mf.filename = '.'
@ragingcomputer
ragingcomputer / README.md
Last active January 12, 2017 22:54
Aeon Labs Minimote in OpenHAB 1.8.3

The video https://www.youtube.com/watch?v=z0Dmdwt8gNE Is just a repetition of the directions on this post https://community.openhab.org/t/aeon-minimote-configuration-oh-1-8-2/9585/9

Quoting TheKorn from Apr '16

I'm going to write this up in stupid levels of detail, not because I think you're an idiot but for people who search and run across this thread. (Plus when it inevitably comes up in the future, I can link back here and say "do that". 😉 )

There are at least four variants of this remote, possibly more. They all seem to have identical hardware and report identically via zwave as far as device IDs go, and react the same way when you push the buttons despite them being labeled very differently. Version one has the buttons labeled 1,2,3,4. Version two has each button labeled with a square. (Very helpful, Aeon. /s) White/black versions of both exist, etc.

We need a common nomenclature for the buttons. I'm going to go with the original white remote's button numbering, since writing "hit the lower le