Skip to content

Instantly share code, notes, and snippets.

@malefs
malefs / app.py
Created February 9, 2021 22:03 — forked from dmontagu/app.py
FastAPI + dash
# Based on the example from https://www.activestate.com/blog/dash-vs-bokeh/
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as obj
import uvicorn as uvicorn
from dash.dependencies import Input, Output
from fastapi import FastAPI
from starlette.middleware.wsgi import WSGIMiddleware
version: "3.6"
services:
db:
image: mariadb:10.3.8
deploy:
resources:
limits:
cpus: '1'
memory: 1G
environment:
version: '3.7'
services:
traefik_v2.0:
image: 'traefik:2.2'
container_name: traefik_v2
hostname: traefik_v2
ports:
- '443:443'
- '80:80'
- '8080:8080'
@malefs
malefs / README.md
Created November 23, 2020 11:25 — forked from shantanoo-desai/README.md
tiguitto (Telegraf, InfluxDBv1.x, Grafana, Mosquitto) stack with Traefik v2.3 reverse proxy using docker

tiguitto Stack with Traefik v2.3 as reverse-proxy

  • Tested on Raspberry-Pi 4 Model B 2GB RAM
  • Docker Version: 19.03.8
  • Docker-Compose version: 1.25.5

Directory structure:

 .
@malefs
malefs / README.md
Created September 30, 2020 19:21
Redis Pub/Sub with Python (notes for my collegue)

Redis Pub/Sub with Python

Overview:

  • Redis supports PUB/SUB
  • It supports pattern matching. Clients may subscribe to glob-style patterns in order to receive all the messages sent to channel names matching a given pattern.

Prerequisites

Assuming Fedora 23.

@malefs
malefs / InfluxDB_cheatsheet.md
Created September 9, 2020 14:45 — forked from tomazursic/InfluxDB_cheatsheet.md
InfluxDB cheatsheet

InfluxDB Cheatsheet

Connect to InfluxDB using the commandline:

$ influx

Create a database foo:

CREATE DATABASE foo
#Script to install Opencv 3.4.4 with optmizations for raspberry pi that can increase performance up to 50%!
#install pre-requisites
sudo apt-get install build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg-dev libjasper-dev libpng-dev libtiff5-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgtk2.0-dev libtbb-dev qt5-default libatlas-base-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
#add symlink for libv4l
sudo ln -s -f /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
#download and install Intel TBB precompiled for raspberry pi 2/3 b
git clone https://github.com/abhiTronix/TBB_Raspberry_pi.git
cd TBB_Raspberry_pi/
@malefs
malefs / README.md
Created July 8, 2020 13:34 — forked from willprice/README.md
Install OpenCV 4.1.2 for Raspberry Pi 3 or 4 (Raspbian Buster)

Install OpenCV 4.1.2 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
@malefs
malefs / can-id-png.md
Created June 3, 2020 10:35 — forked from agmangas/can-id-png.md
Relationship between CAN IDs and J1939 PGNs

CAN IDs & J1939 PGNs

Global PGN Example

Original CAN ID:

1    8    F    0    0    1    0    B
0001 1000 1111 0000 0000 0001 0000 1011
@malefs
malefs / simple_python_datasource.py
Created April 29, 2020 08:51 — forked from linar-jether/simple_python_datasource.py
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'