Skip to content

Instantly share code, notes, and snippets.

View sphaero's full-sized avatar

Arnaud Loonstra sphaero

View GitHub Profile
@sphaero
sphaero / zmq_dispatcher.py
Last active May 24, 2016 15:53
A Python Asyncore Dispatcher class for ZeroMQ (PyZMQ)
#!/usr/bin/python3
#
# A Python Asyncore Dispatcher class for ZeroMQ (PyZMQ)
# Copyright 2016 Arnaud Loonstra <arnaud@sphaero.org>
#
# I know Asyncore is sort of deprecated but it still used in many
# frameworks. Therefore this class makes it easy to implement
# ZeroMQ sockets into those frameworks.
#
# This Source Code Form is subject to the terms of the Mozilla Public
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#salaris_graph {
background-color: black;
color: white;
width: 400px;
height: 400px;
padding: 1em;
/*
ESPTest for ZMTP + ZRE + ZOCP
Original author: Ronald Hof <ronald@k-n-p.org>
license: MPLv2
*/
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <string.h>
if __name__ == "__main__":
c = MlmClient()
c.connect("tcp://192.168.1.223:9999", 1000, "PythonTest")
c.set_consumer("stream", ".+")
msg = c.recv().popstr()
while (msg == "hello"):
print(msg)
msg = c.recv().popstr()
@sphaero
sphaero / handover.py
Created June 4, 2015 08:40
Python passing object by reference through a socket
#!/usr/bin/python3
# WARNING: This is a very nast hack into passing the pointer of an
# object through a socket thus bypassing any copy. The garbage
# collector can remove an object before its being received so you
# should know what you are doing!
import threading
from PIL import Image, ImageDraw, ImageTk
import zmq
import time
@sphaero
sphaero / gstseamlessloop.py
Last active December 23, 2023 09:50
Gstreamer seamless loop test
#/usr/bin/env python3
#
# Seamless loop test
# Copyright (c) 2015 Arnaud Loonstra <arnaud@sphaero.org>
#
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@sphaero
sphaero / rpicamsrc_propset.py
Created March 5, 2015 15:13
Setting gstreamer element properties at runtime
#!/usr/bin/python3
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
print(Gst.version())
def bus_call(bus, msg, *args):
#print("BUSCALL", msg, msg.type, *args)
if msg.type == Gst.MessageType.EOS:
@sphaero
sphaero / uae_from_kodi.sh
Last active August 29, 2015 14:11
Start UAE from Kodi on the Raspberry PI (RaspBMC)
#!/bin/bash
#
# Start this script through the Advanced Launcher Addon
#
# This script fixes not getting a display after stopping Kodi
# After quitting UAE it will return to Kodi
#
# Expecting UAE4All in /home/pi/amiga/uae4all
#
# Author: Arnaud Loonstra <arnaud@sphaero.org>
@sphaero
sphaero / gstreamer-build.sh
Last active February 11, 2023 16:25
Install & build gstreamer from git
#!/bin/bash --debugger
set -e
BRANCH="master"
if grep -q BCM2708 /proc/cpuinfo; then
echo "RPI BUILD!"
RPI="1"
fi
[ -n "$1" ] && BRANCH=$1
@sphaero
sphaero / winipaddr.py
Last active April 10, 2023 00:12
Get windows ipadresses info
#!/usr/bin/env python
#
# For the sake of humanity here's a python script retrieving
# ip information of the network interfaces.
#
# Pay some tribute to my soul cause I lost a few years on this one
#
# based on code from jaraco and many other attempts
# on internet.
# Fixed by <@gpotter2> from scapy's implementation to