Skip to content

Instantly share code, notes, and snippets.

View TurBoss's full-sized avatar

TurBoss TurBoss

  • Spain
View GitHub Profile
@TurBoss
TurBoss / building_pyqt5.md
Last active September 26, 2021 11:56 — forked from KurtJacobson/building_pyqt5.md
Building PyQt5 to support Python2 based QtDesigner Plugins

Building PyQt5 to support Python3 based QtDesigner Plugins

As far as I can tell, the reason Qt5 Designer does not load custom PyQt5 widgets is due to the 'stock' shared library libpyqt5.so (which comes with PyQt5) not being built for the correct combination of the Python and Qt versions. It seems the only way to get around this is to build PyQt5 from source so we will have a libpyqt5.so that is correct and will be able to load the custom widgets.

Install Python dev tools

#!/usr/bin/python2.7
"""Quick hack of 'modern' OpenGL example using pysdl2 and pyopengl
Based on
pysdl2 OpenGL example
http://www.arcsynthesis.org/gltut/Basics/Tut02%20Vertex%20Attributes.html
http://schi.iteye.com/blog/1969710
"""
import sys
@TurBoss
TurBoss / CMakeLists.txt
Created May 12, 2019 15:29 — forked from nocnokneo/CMakeLists.txt
VTK Rendered to an FBO in a Qt Quick 2 Scene Graph
cmake_minimum_required(VERSION 2.8.11)
project(VtkFboInQtQuick)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
@TurBoss
TurBoss / CMakeLists.txt
Created April 27, 2019 06:02 — forked from joinAero/CMakeLists.txt
Use Kinect with OpenCV (C++)
cmake_minimum_required(VERSION 2.8)
project(OCVSamples)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(OpenCV 3.0 QUIET)
if(OpenCV_FOUND)
add_definitions(-DUSE_OPENCV3)
else()
message(FATAL_ERROR "OpenCV > 3.0 not found.")
@TurBoss
TurBoss / camera.py
Created April 27, 2019 06:02 — forked from joinAero/camera.py
Use Kinect with OpenCV (Python)
import cv2
import sys
class Camera(object):
def __init__(self, index=0):
self.cap = cv2.VideoCapture(index)
self.openni = index in (cv2.CAP_OPENNI, cv2.CAP_OPENNI2)
self.fps = 0
@TurBoss
TurBoss / wstest.py
Created September 29, 2018 01:27 — forked from forslund/wstest.py
Connecting to the mycroft message bus.
#! /usr/bin/env python
import sys
from websocket import create_connection
uri = 'ws://' + sys.argv[1] + ':8181/core'
ws = create_connection(uri)
print "Sending " + sys.argv[2] + " to " + uri + "..."
if len(sys.argv) >= 4:
data = sys.argv[3]
else:

Install RTAI 5.0-test2 on Ubuntu 14.04 Kernel 3.18.20

Preparation

download and unzip

cd /usr/src
curl -L --insecure https://www.rtai.org/userfiles/downloads/RTAI/rtai-5.0-test2.tar.bz2 | tar xj
curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.20.tar.xz | tar xJ
curl -L http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.20-vivid/linux-image-3.18.20-031820-generic_3.18.20-031820.201508081633_amd64.deb -o linux-image-3.18.20-generic-amd64.deb
@TurBoss
TurBoss / async.py
Created April 10, 2018 01:07 — forked from diosmosis/async.py
Asynchronous function calling with python and GTK.
import threading
from gi.repository import GObject
# calls f on another thread
def async_call(f, on_done):
"""
Starts a new thread that calls f and schedules on_done to be run (on the main
thread) when GTK is not busy.
Args:
@TurBoss
TurBoss / gasyncspawn.py
Created April 9, 2018 23:03 — forked from fabrixxm/gasyncspawn.py
Run external process asynchronously with Python, GLib. Get stdout and stderr via signals.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#https://developer.gnome.org/pygobject/2.28/
#http://www.pygtk.org/articles/subclassing-gobject/sub-classing-gobject-in-python.htm#d0e570
from gi.repository import GObject
from gi.repository import GLib
class GAsyncSpawn(GObject.GObject):
@TurBoss
TurBoss / ffmpeg4matelight.sh
Created January 11, 2018 14:12 — forked from MichaelKreil/ffmpeg4matelight.sh
using ffmpeg to stream videos, gifs, the webcam or the screen to matelight
# Stream a video
ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Loop a gif
ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
# Stream webcam
# Mac
ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337