Skip to content

Instantly share code, notes, and snippets.

View sphaero's full-sized avatar

Arnaud Loonstra sphaero

View GitHub Profile
@sphaero
sphaero / main.cpp
Created March 20, 2024 14:13
SDL OpenGL Dear ImGui Example with libuv integration
// Dear ImGui: SDL2 + OpenGL + libuv
#include "imgui/imgui.h"
#include "imgui/backends/imgui_impl_sdl2.h"
#include "imgui/backends/imgui_impl_opengl3.h"
#include <stdio.h>
#include <uv.h>
#include <SDL.h>
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <SDL_opengles2.h>
@sphaero
sphaero / timelapse.py
Created February 11, 2022 14:15
RPI timelapser
#!/usr/bin/python3
from time import sleep
from picamera import PiCamera
camera = PiCamera()
camera.resolution = (1920, 1080)
#camera.start_preview()
# Camera warm-up time
sleep(5)
count = 0
@sphaero
sphaero / gurumed.c
Created April 13, 2021 19:30
Guru meditation example using ansi coding
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
wchar_t tl=0x250f;
wchar_t tr=0x2513;
wchar_t bl=0x2517;
wchar_t br=0x251b;
wchar_t vs=0x2503;
//wchar_t hs[23]={0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x2501,0x0};
@sphaero
sphaero / test-poll.c
Created December 16, 2020 15:01
zmq dgram test
// compile: gcc test-poll.c `pkg-config --cflags --libs libczmq`
#include "czmq.h"
// poll receive
int main()
{
zsock_t* mdgramr = zsock_new_dgram ("udp://239.255.42.99:1151");
assert (mdgramr);
char *mdmessage, *maddr;
@sphaero
sphaero / rpi_sender.py
Created June 20, 2019 20:03
ZOCP PiCam controller and sender
# PiCam h264 RTP Sender controllable by ZOCP
# Copyright (C) 2015 Arnaud Loonstra
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
@sphaero
sphaero / cffi_test.py
Created May 9, 2019 15:06
czmq python cffi test
from czmq_cffi import *
import pdb
Zactor.test(True)
output = Zsock(0) # 0 == PAIR
output.bind(b"inproc://zmsg.test")
assert(output)
input = Zsock(0) # 0 == PAIR
input.connect(b"inproc://zmsg.test")
@sphaero
sphaero / Nodes.cpp
Created December 12, 2018 15:07 — forked from ChemistAion/nodes.cpp
Second prototype of standalone node graph editor for ImGui
#include "Nodes.h"
namespace ImGui
{
template<int n>
struct BezierWeights
{
constexpr BezierWeights() : x_(), y_(), z_(), w_()
{
for (int i = 1; i <= n; ++i)
@sphaero
sphaero / rokoko-decode.py
Created October 18, 2018 14:10
Test to decode rokoko UDP data and send it through OSC
# author: A.J. Loonstra <arnaud@sphaero.org>
# Test to decode rokoko UDP data
#
import struct
import socket
from collections import namedtuple
import liblo
import time
UDP_IP = "0.0.0.0"
@sphaero
sphaero / chat-gossip.c
Last active February 12, 2018 09:42
Example Zyre chat client using gossip discovery
// --------------------------------------------------------------------------
// Example Zyre distributed chat application
//
// Copyright (c) 2010-2014 The Authors
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
@sphaero
sphaero / cast2kodi.py
Last active November 28, 2017 10:34
Cast screen to kodi
#!/usr/bin/python3
#
# Cast screen to kodi, sort of like Chromecast functionality
#
# original version found on reddit:
# https://www.reddit.com/r/kodi/comments/5googi/push_stream_of_linux_desktop_to_kodi_using_vlc/
import sys
import time
import os