Skip to content

Instantly share code, notes, and snippets.

View baudneo's full-sized avatar
👽
Mars 2034

baudneo baudneo

👽
Mars 2034
  • dAIngerous Consulting
  • Canada
View GitHub Profile
@baudneo
baudneo / main.py
Created July 19, 2021 02:18 — forked from pliablepixels/main.py
ZMES Cloud Function (Trusted app)
import firebase_admin
from firebase_admin import messaging
from firebase_admin import exceptions
from flask import jsonify
import json
from firebase_admin import auth
from functools import wraps
import jwt
import re
@baudneo
baudneo / usb_reset.py
Created July 19, 2021 20:18 — forked from 18516329677/usb_reset.py
Reset USB device from python
"""
Example code for resetting the USB port that a Teensy microcontroller is
attached to. There are a lot of situations where a Teensy or Arduino can
end up in a bad state and need resetting, this code is useful for
"""
import os
import fcntl
import subprocess
@baudneo
baudneo / configuration.yml
Created September 5, 2021 20:10
Zoneminder and Authelia example - with gmail smtp notifier (you must setup insecure app access and token for sending emails from authelia using gmail)
###############################################################
# Authelia configuration #
###############################################################
server.host: 0.0.0.0
server.port: 9091
log.level: debug
# This secret can also be set using the env variables AUTHELIA_JWT_SECRET_FILE
jwt_secret: DO_SECRET_HERE # get secret from here https://www.grc.com/passwords.htm
default_redirection_url: https://auth.EXAMPLE.com
@baudneo
baudneo / output.log
Created September 5, 2021 23:22
log output with new high confidence append and smart frame_set with out of bound logic
09/05/21 16:05:21.172364 zm_mlapi[1839] DBG1 Media:471 [media:read:image: self.frames_processed=7 --- self.fids_processed=['s-116', '70', '140', '206', 'a-92', '228'] --- self.frame_set[self.frame_set_index]='
350' --- self.get_last_frame()='228' --- self.max_frames=9]
09/05/21 16:05:21.175061 zm_mlapi[1839] DBG2 Media:488 [api:make_req: 'get'-><hidden>/api/events/29027.json?noframes=true query={'token': 'eyJ0eXAiOiJKV1QiLCJhbGciO...'}]
09/05/21 16:05:21.250609 zm_mlapi[1839] DBG1 Media:501 [media:read:image: fid=350 current frame buffer length '229' last API call frame buffer length was '229']
09/05/21 16:05:21.25084 zm_mlapi[1839] ERR Media:562 [media:read:image: skip_all=False --- self.skip_all_count=3]
09/05/21 16:05:21.255593 zm_mlapi[1839] DBG1 Media:582 [media:read:image: monitor 1 running at 9 FPS - threshold of 8 converts to 72 frames. frames over by -> 121 / fps -> 13.444444444444445 seconds]
09/05/21 16:05:21.257971 zm_mlapi[1839] DBG1 Media:613 [media:read:oob: the current requested f
@baudneo
baudneo / mjpegviewer.py
Created September 16, 2021 19:35 — forked from tito/mjpegviewer.py
MJpeg Viewer in Kivy
"""
MJpeg Viewer using pure Kivy + urllib
=====================================
.. author:: Mathieu Virbel <mat@meltingrocks.com>
"""
import io
import urllib
import threading
@baudneo
baudneo / gist:b3207c73cdcdae7bcdba23334d3f5013
Created September 28, 2021 08:39
ProxMox 7 - 'No Subscription' popup fix
sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
or open the file and go to line 505 ish where you will find a line containing most of the above string, delete everything inside the ()'s and replace with false.
So if it was ->
if (res === null || res === undefined || !res || res
.data.status.toLowerCase() !== 'active') {
It should now be ->
if (false) {
@baudneo
baudneo / gist:5cacf5e5d128b2d5f4ce255590e84bf8
Last active October 6, 2021 22:33
proxmox add DE to allow autologin and an X server
# install lightdm
apt install lightdm
# Config Auto Login for "Root" (Definitely it is not a good practice, but do what you want if you dont have a seperate user setup)
# Could also install a lightdm greeter and have a regular graphical login screen that transitions to terminal.
nano /etc/pam.d/lightdm-autologin
# Find #auth and comment out this line --->
# required pam_succeed_if.so user != root quiet_success
nano /etc/lightdm/lightdm.conf
2021-10-08 20:11:03 | razer | INFO | Initialising Daemon (v3.1.0). Pid: 18013
2021-10-08 20:11:03 | razer.screensaver | INFO | Initialising DBus Screensaver Monitor
2021-10-08 20:11:03 | razer | INFO | Found device.0: 0003:1532:025E.0004
2021-10-08 20:11:03 | razer.device0 | INFO | Initialising device.0 RazerCynosaV2
2021-10-08 20:11:03 | razer.device0 | INFO | Putting device into driver mode. Daemon will handle special functionality
2021-10-08 20:11:03 | razer | INFO | Serving DBus
2021-10-08 21:06:15 | razer | INFO | Stopping daemon on signal 15
2021-10-08 21:06:51 | razer | INFO | Initialising Daemon (v3.1.0). Pid: 1395
2021-10-08 21:06:51 | razer.screensaver | INFO | Initialising DBus Screensaver Monitor
2021-10-08 21:06:51 | razer | INFO | Found device.0: 000
@baudneo
baudneo / gist:d5a8b54843531fc2a5ae7c1826733d91
Created October 20, 2021 11:04
Log output of forked ZMES - This is on the MLAPI side, MLAPI is installed on a remote system without ZM or ZMES.
10/20/21 04:54:36.533656 zm_mlapi[25758] DBG1 mlapi:139 [mlapi:JWT: 'Neo' accessed this endpoint '/detect' with a v
alid JWT]
10/20/21 04:54:36.541542 zm_mlapi[25758] DBG1 mlapi_utils:418 [SENT TO LOGGER -> initilized STDOUT class]
10/20/21 04:54:36.543705 zm_mlapi[25758] DBG1 mlapi_utils:210 ['std.out' -> TESTING STDOUT FOR MLAPI]
10/20/21 04:54:36.545846 zm_mlapi[25758] INF mlapi_utils:212 [config:init: reading config file found at '/home/baudneo/
PycharmProjects/my_mlapi/mlapi/mlapiconfig.ini']
10/20/21 04:54:36.548096 zm_mlapi[25758] INF mlapi_utils:218 [config:init: reading secrets from: '/home/baudneo/Pycharm
Projects/my_mlapi/mlapi/secrets.ini']
10/20/21 04:54:36.553892 zm_mlapi[25758] DBG2 mlapi_utils:253 [config:init: found configuration overrides for monitor
'1', applying...]
@baudneo
baudneo / gist:a2b164954d37969e5aa5c052a5c83161
Created October 20, 2021 11:29
Log output from forked ZMES - this is the zmevenotnotification side, animation creation, Pushover, Home Assistant and MQTT add-ons enabled and working correctly.
# This is not the same event as the mlapi logs, this is a past event with animations turned on, MQTT and HomeAssistant add-ons integrated and the new pushover add-on enabled.
❯ es.baredebug.objdet 38619
==> /var/log/zm/zmesdetect_m4.log <==
10/20/21 05:21:18.907295 zmesdetect_m4[742399] INF ZMLog:285 [Setting up signal handlers for log rotation and log in
terrupt]
10/20/21 05:21:19.244361 zmesdetect_m4[742399] INF ZMLog:292 [Connected to ZoneMinder Logging system with user 'www-
data' -> /var/log/zm/zmesdetect_m4.log]
10/20/21 05:21:19.270691 zmesdetect_m4[742399] DBG1 pyzm_utils:1030 ['std.out' -> TESTING STDOUT FOR ZM_DETECT]
10/20/21 05:21:19.272079 zmesdetect_m4[742399] DBG1 pyzm_utils:1032 [10/20/21 05:21:18.206647 CNSL[DBG1] pyzm_utils: