Skip to content

Instantly share code, notes, and snippets.

@Overdrivr
Overdrivr / Plot.py
Created Feb 4, 2016
PyQtGraph animated sine and cosine functions - real smooth
View Plot.py
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
from numpy import arange, sin, cos, pi
import pyqtgraph as pg
import sys
class Plot2D():
def __init__(self):
self.traces = dict()
@Overdrivr
Overdrivr / Plot.py
Last active Oct 6, 2021
Reads data from a thread, plots it in another Process, with main process being free all the time ! Using PyQtGraph, python standard multiprocessing and multiprocessing.Queue
View Plot.py
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from multiprocessing import Process, Manager, Queue
import sched, time, threading
# This function is responsible for displaying the data
# it is run in its own process to liberate main process
def display(name,q):
@Overdrivr
Overdrivr / Plot.py
Last active Sep 9, 2021
Plots data to a PyQtGraph graph that is hosted another process, effectively liberating main thread immediately.
View Plot.py
# -*- coding: utf-8 -*-
"""
This example is identical to https://gist.github.com/Overdrivr/efea3d363556c0dcf4b6
Except that here the plot is contained in a class.
The superplot.start method starts the graph and returns a standard multiprocessing.queue
the io function puts data in this queue, while the graph empties it regularly
The outcome is :
- a super fast application thanks to PyQtGraph
- a main process that is never blocked by the graph
Enjoy !
@Overdrivr
Overdrivr / Plot.py
Created Feb 3, 2016
Matplotlib animated sine function with Tkinter canvas
View Plot.py
import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import tkinter as Tk
import tkinter.ttk as ttk
class Plot2D(Tk.Frame):
def __init__(self,parent,**kwargs):
@Overdrivr
Overdrivr / Notes on C&C++ package managers.md
Last active Feb 19, 2021
Why C/C++ package managers fail for now ?
View Notes on C&C++ package managers.md

Motivation

As for now (mid 2016), there doesn't seem to be a C/C++ package manager that stands out of the crowd. To understand the reasons behind this failure, I will try to list in this README most C/C++ package managers, highlight differences between them, then list critics that are made about them.

Note: this README is merely a gathering of personnal notes, doesn't intend to be a reference in any way.

A standard proposal : http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0235r0.pdf

Package managers

@Overdrivr
Overdrivr / cffi-python-struct.py
Last active Dec 11, 2020
Pass and return structs (by copy) between C and Python using CFFI
View cffi-python-struct.py
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef struct T T;
struct T
{
int a;
float b;
};
@Overdrivr
Overdrivr / .gitlab-ci.yml
Last active Dec 23, 2019
Deploy static-files from Gitlab-CI to Firebase
View .gitlab-ci.yml
# See https://blog.cronobo.com/2018/03/22/deploy-firebase-from-gitlab-ci.html
stages:
- deploy
deploy:
image: node:8
stage: deploy
environment: production
script:
@Overdrivr
Overdrivr / check.py
Created Mar 25, 2019
Check Microsoft Visual C++ redist. is properly installed for Tensorflow
View check.py
from ctypes.util import find_library
import ctypes
msvcp140_path = find_library("msvcp140.dll")
if msvcp140_path is None:
raise Exception('msvcp140.dll not found on system')
# Check DLL is found in system32 folder and not somewhere else
print(msvcp140_path)
@Overdrivr
Overdrivr / Plot.py
Created Feb 7, 2016
Runs a Pyqtgraph in a second process, liberating the main process to continue its work.
View Plot.py
# -*- coding: utf-8 -*-
"""
This demo is similar to Pyqtgraph remote plotting examples (https://github.com/pyqtgraph/pyqtgraph/blob/develop/examples/RemoteGraphicsView.py)
Except that it does not use Pyqtgraph's buggy multiprocess module. Instead, it relies on standard python 3+ multiprocessing (https://docs.python.org/3.5/library/multiprocessing.html).
In this example, function f is executed in a second process, which liberates immediately the main process.
"""
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from multiprocessing import Process, Manager
@Overdrivr
Overdrivr / main.c
Last active Dec 3, 2016
Simple usage of the telemetry (https://github.com/Overdrivr/Telemetry) library on an embedded device
View main.c
#include "telemetry.h"
// Your UART library should match those signatures, otherwise quickly wrap them in a function that does
//int32_t read(void * buf, uint32_t sizeToRead)
//int32_t write(void * buf, uint32_t sizeToWrite)
//int32_t readable()
//int32_t writeable()
void main()
{