Skip to content

Instantly share code, notes, and snippets.

View aggelis's full-sized avatar

Aggelis Aggelis aggelis

View GitHub Profile
@aggelis
aggelis / mult_prod_single_consume.py
Created July 22, 2022 05:55 — forked from brantfaircloth/mult_prod_single_consume.py
Python multiprocessing: multiple producers, single consumer
import time
import random
from multiprocessing import Process, Queue, JoinableQueue, cpu_count
""" Adjust time.sleep() values to see action of consumer """
def work(id, jobs, result):
while True:
task = jobs.get()
if task is None:
@aggelis
aggelis / sources.list
Created May 13, 2022 10:59 — forked from justbuchanan/sources.list
/etc/apt/sources.list from an Ubuntu 14.04 installation
#deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
@aggelis
aggelis / stream xserver
Created March 6, 2022 20:30 — forked from sakti/stream xserver
streaming screen capture on x server using gstreamer
gst-launch-0.10 ximagesrc use-damage=0 ! video/x-raw-rgb,framerate=15/1 ! ffmpegcolorspace ! video/x-raw-yuv ! jpegenc ! multipartmux ! tcpserversink host=0.0.0.0 port=11111
@aggelis
aggelis / README.md
Created February 6, 2022 12:46 — forked from okaufmann/README.md
Fix `warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)` error on Raspberry PI

Run the following:

echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment > /dev/null
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen > /dev/null
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf > /dev/null
sudo locale-gen en_US.UTF-8
@aggelis
aggelis / fetch_vcdist.py
Created January 12, 2022 17:48 — forked from donno/fetch_vcdist.py
Downloads and extract the Visual C++ Redistributables.
"""Downloads and extract the Visual C++ Redistributables.
This is useful when working with minidump files as the user may be running
with a new different version of the runtime. This script aims to maintain
a copy of the various versions.
Versions are normally added once I encounter them.
This requires dark.exe from Wix (http://wixtoolset.org/releases/) and
expand.exe (File Expansion Utility - this comes with Microsoft Windows).
@aggelis
aggelis / livespec.py
Created November 21, 2021 17:55 — forked from boylea/livespec.py
pyqtgraph live running spectrogram from microphone
"""
Tested on Linux with python 3.7
Must have portaudio installed (e.g. dnf install portaudio-devel)
pip install pyqtgraph pyaudio PyQt5
"""
import numpy as np
import pyqtgraph as pg
import pyaudio
from PyQt5 import QtCore, QtGui
@aggelis
aggelis / pyqt5-eventfilter-touch-example.py
Created November 9, 2021 06:40 — forked from stevenliebregt/pyqt5-eventfilter-touch-example.py
PyQt5 Example of the eventFilter, and a TouchEvent capture.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import QEvent
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow
@aggelis
aggelis / embed_vtk_qt5.py
Created May 15, 2021 20:19 — forked from paskino/embed_vtk_qt5.py
Minimal working example of VTK embedding in PyQt with Qt5
#!/usr/bin/env python
import sys
import vtk
from PyQt5 import QtCore, QtWidgets
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent = None):
@aggelis
aggelis / QImageViewer.py
Created May 15, 2021 19:55 — forked from acbetter/QImageViewer.py
Image Viewer Example by PyQt5 and Python 3
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QImage, QPixmap, QPalette, QPainter
from PyQt5.QtPrintSupport import QPrintDialog, QPrinter
from PyQt5.QtWidgets import QLabel, QSizePolicy, QScrollArea, QMessageBox, QMainWindow, QMenu, QAction, \
qApp, QFileDialog
@aggelis
aggelis / QGraphicsSceneTest.cpp
Created March 10, 2021 07:34 — forked from csukuangfj/QGraphicsSceneTest.cpp
Qt QGraphicsScene click, select, move, resize, delete QGraphicsItems
// Copyright 2017. All Rights Reserved.
// Author: csukuangfj@gmail.com (Fangjun Kuang)
#include <QtGui>
#include <QGraphicsRectItem>
#include <QGraphicsView>
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
class CustomItem : public QGraphicsEllipseItem