Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
A clear conscience is usually the sign of a bad memory

Pliable Pixels pliablepixels

💭
A clear conscience is usually the sign of a bad memory
View GitHub Profile
@pliablepixels
pliablepixels / main.py
Created Jul 17, 2021
ZMES Cloud Function (Trusted app)
View main.py
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
View Sample mlconfig for article
use_sequence = yes
ml_sequence= {
'general': {
'model_sequence': 'object,face,alpr'
},
'object': {
'general':{
'pattern':'(person)',
@pliablepixels
pliablepixels / GPU steps.md
Last active Mar 20, 2021
GPU support in dlandon's docker image - CUDNN image route
View GPU steps.md

Getting dlandon's docker image to work reliably with a GPU using a nvidia's pre-built CUDA/CuDNN image

Raw notes on what I did to get GPU/CUDA/CuDNN working in dlandon's docker image. Not optimized. So I don't forget later.

There are two ways:

  1. Use his docker image which derives from phusion and manually install CUDA/cuDNN. This did not work for me - I got all sorts of segfaults, install errors, driver mismatch errors (even though my host/docker cuda versions were identical). When things worked after various pacakge errors installing cuda, the image failed after a restart. I've come to the conclusion that CuDNN/CUDA install is very sensitive to environments and what works for one person may dramatically fail for the other especially when we are trying to link a host GPU to a docker container. May as well leave this to the experts (nvidia). So the next option:
View pyzmexample.py
import pyzm.api as zmapi
api_options = {
'apiurl': 'https://yourserver/zm/api',
'portalurl': 'https://yourserver/zm',
'user': 'admin',
'password': 'password',
'logger': None # use none if you don't want to log to ZM
}
View Dbell hook usage
dbell HTTP hook
===============
dbell HTTP hook usage:
User enter their server parameters, which will be stored in FTP field in http//example.com format, char HttpServer[256];
http server URL address example usage: http://192.168.1.183 where http server IP address is 192.168.1.183
Event:
dbell will do an HTTP POST to the server URL anytime someone presses the call button
dbell will do an HTTP POST to the server URL anytime a motion is detected
@pliablepixels
pliablepixels / NVIDIA GPU CUDA 10.1 Ubuntu 18.md
Last active Jan 13, 2021
All the stuff to get CUDA 10.1 working with NVIDIA GPUs on Ubuntu 18.04. My notes.
View NVIDIA GPU CUDA 10.1 Ubuntu 18.md

All the stuff to get CUDA 10.1 working with NVIDIA GPUs on Ubuntu 18.04. My notes.

Step 1: Install NVIDIA Driver

  • sudo apt install nvidia-driver-430
  • reboot
  • run nvidia-smi. If it does not show your GPU, stop, fix. If this doesn't work, nothing else will (the rest of the stuff will compile, but won't work)
@pliablepixels
pliablepixels / find_object.py
Last active Jun 7, 2019
Find object in recorded video
View find_object.py
Moved to https://github.com/pliablepixels/zmMagik
View zmes.patch
diff --git a/zmeventnotification.pl b/zmeventnotification.pl
index cd622ab..b20d663 100755
--- a/zmeventnotification.pl
+++ b/zmeventnotification.pl
@@ -41,7 +41,9 @@ use Time::HiRes qw/gettimeofday/;
use Symbol qw(qualify_to_ref);
use IO::Select;
-#use Data::Dump qw(dump);
+# debugging only
View face.py
import face_recognition
import cv2
import os
my_portal='https://yourserver:yourport/zm'
my_user='admin'
my_pass='yourpass'
my_monitor=11
# src=0 # this is for your first local camera
View Apache CORS
# This configuration is only needed for compatibility with zmninja
# Make sure you have enabled headers with sudo a2enmod headers
# If not using VirtualHosts, copy or symlink this file into the Apache config folder
# If using VirtualHosts, then this config must be placed inside the appropriate
# <VirtualHost> directive.
#zmNinja header permissions. Tweak to your needs
Header always set Access-Control-Allow-Credentials true
#zmNinja's WKWebView will set the origin header as localhost:8080