Skip to content

Instantly share code, notes, and snippets.

View npm-debug.log
118059 verbose linkMans object-assign@3.0.0
118060 verbose rebuildBundles object-assign@3.0.0
118061 silly build graceful-fs
118062 info linkStuff graceful-fs@1.2.3
118063 silly linkStuff graceful-fs@1.2.3 has C:\Users\B48923\AppData\Roaming\npm\node_modules\strongloop\node_modules\globule\node_modules as its parent node_modules
118064 silly linkStuff graceful-fs@1.2.3 is part of a global install
118065 silly linkStuff graceful-fs@1.2.3 is installed into a global node_modules
118066 verbose linkBins graceful-fs@1.2.3
118067 verbose linkMans graceful-fs@1.2.3
118068 verbose rebuildBundles graceful-fs@1.2.3
@Overdrivr
Overdrivr / KL25Z_serial_easy_setup.c
Last active Jan 15, 2016
serial/UART simple program and setup with Kinetis KL25Z
View KL25Z_serial_easy_setup.c
/* --
This program shows how to configure and output 'AB\n' on the USB serial port of a KL25Z
It is using processor expert and was tested on Kinetis Design Studio (KDS) ver 3.0.0
-- */
// 1. Add Processor Expert module AsynchroSerial
// In KDS, in the 'Components' view, right click on 'Components' then "Show components library"
// In the opened window, select the category 'Kinetis/Peripheral Drivers/Communication' and double-click on AsyncroSerial
// this will add the AsyncroSerial module to your project
// 2. Configuration
@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 / 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 / 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 / telemetry-publish.c
Created Feb 5, 2016
Example to use telemetry to publish regularly a value on a topic (MBED)
View telemetry-publish.c
#include "telemetry/driver.hpp"
int main()
{
// User state - not used for now
TM_state state;
// Create a telemetry instance
Telemetry TM(&state);
@Overdrivr
Overdrivr / example_printer.py
Created Feb 5, 2016
Print received values from a telemetry-enabled serial connection using pytelemetry
View example_printer.py
import pytelemetry as tm
import pytelemetry.transports.serialtransport as transports
import time
def printer(topic, data):
print(topic," : ", data)
transport = transports.SerialTransport()
c = tm.pytelemetry(transport)
@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 / 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 !