Skip to content

Instantly share code, notes, and snippets.

@Overdrivr
Overdrivr / coords-ligne3-metro-toulouse.json
Created October 31, 2016 11:32
Coordonnées GPS estimées de la ligne 3 du métro de Toulouse (parcours validé a ce jour, il manque les parcours optionnels). Voir la carte
[
{name: 'Airbus Colommiers', coords: [43.6164113,1.3505030]},
{name: 'Airbus Saint Martin', coords: [43.6119056,1.3726646]},
{name: 'Jean Maga', coords: [43.6217381,1.3969560]},
{name: 'Espace Job', coords: [43.6164200,1.4076825]},
{name: 'Boulevard de suisse', coords: [43.6170028,1.4220444]},
{name: 'Fondeyre (estimation)', coords: [43.6294087,1.4294307]},
{name: 'La Vache SNCF', coords: [43.6346464,1.4398956]},
{name: 'Toulouse Lautrec (estimation)', coords: [43.6270672,1.4443802]},
{name: 'Raynal', coords: [43.6168462,1.4508390]},
@Overdrivr
Overdrivr / Plot.py
Last active October 25, 2023 12:49
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
# -*- 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 / cffi-python-struct.py
Last active August 8, 2023 22:58
Pass and return structs (by copy) between C and Python using CFFI
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef struct T T;
struct T
{
int a;
float b;
};
@Overdrivr
Overdrivr / Plot.py
Created February 7, 2016 10:04
Runs a Pyqtgraph in a second process, liberating the main process to continue its work.
# -*- 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 March 8, 2023 09:37
Plots data to a PyQtGraph graph that is hosted another process, effectively liberating main thread immediately.
# -*- 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 / Notes on C&C++ package managers.md
Last active July 15, 2022 19:33
Why C/C++ package managers fail for now ?

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 / Plot.py
Created February 4, 2016 13:38
PyQtGraph animated sine and cosine functions - real smooth
# -*- 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
Created February 3, 2016 17:43
Matplotlib animated sine function with Tkinter canvas
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 / .gitlab-ci.yml
Last active December 23, 2019 02:36
Deploy static-files from Gitlab-CI to Firebase
# 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 March 25, 2019 08:27
Check Microsoft Visual C++ redist. is properly installed for Tensorflow
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)