Skip to content

Instantly share code, notes, and snippets.

Emanuele Ruffaldi eruffaldi

Block or report user

Report or block eruffaldi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eruffaldi
eruffaldi / pyonifix.py
Created Nov 13, 2013
Script for fixing truncated OpenNI stream files (.oni) containing RGB-D/Kinect data
View pyonifix.py
# OpenNI ONI fixer
#
# by Emanuele Ruffaldi PERCRO-SSSA 2013
#
# USE AT YOUR OWN RISK - ALWAYS BACKUP THE FILE
#
# Possible future:
# - split/cut/extract
# - dump stats
#
@eruffaldi
eruffaldi / gist:eb8953dd6aeefa35ac28
Last active Sep 3, 2019
Example of CMake easy libraries
View gist:eb8953dd6aeefa35ac28
# REPLACED BY: https://github.com/eruffaldi/cmakego
# assuming to ave the correct find_package above ...
# requires CMakew 3.0 for supporting INTERFACE library type
if(ZeroMQ_FOUND)
add_library(p::zeromq INTERFACE IMPORTED)
set_property(TARGET p::zeromq PROPERTY INTERFACE_LINK_LIBRARIES ${ZeroMQ_LIBRARY})
set_property(TARGET p::zeromq PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${ZeroMQ_INCLUDE_DIR}")
endif()
View dynamicinvoke
/**
* Binadable Class
*/
#include <functional>
#include <boost/any.hpp>
#include <vector>
#include <iostream>
#include <memory>
#include <type_traits>
#include <typeinfo>
@eruffaldi
eruffaldi / arucomarker.py
Last active Jun 25, 2018
Multiple Aruco PDF Marker generator
View arucomarker.py
import cairo,argparse,random
#TEST: https://jcmellado.github.io/js-aruco/getusermedia/getusermedia.html
#http://terpconnect.umd.edu/~jwelsh12/enes100/markergen.html
#http://terpconnect.umd.edu/~jwelsh12/enes100/markers.js
markers_opts = [[False,True,True,True,True],[False,True,False,False,False]
,[True,False,True,True,False],[True,False,False,False,True]];
import string
digs = string.digits + string.letters
@eruffaldi
eruffaldi / touchexif.py
Created Sep 28, 2015
Adjust JPEG and MOV file times from metadata
View touchexif.py
# Emanuele Ruffaldi 2015
#
# Touches JPG and MOV files using EXIF or MOV metadata, as happens when copied from iPhone
# or other device
#
# For JPG requires python myexif
# For MOV requires exiftool
#
# Last Updated: 2015/09/27
#
@eruffaldi
eruffaldi / cpponce.cpp
Last active Sep 29, 2015
Execution of a C++ code block only one (C++11)
View cpponce.cpp
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iostream>
#include <thread>
#include <chrono>
class OnceHard
{
public:
@eruffaldi
eruffaldi / iterkeys.cpp
Last active Oct 28, 2015
Iterate over keys or values of a std::map alike in C++
View iterkeys.cpp
#include <map>
#include <unordered_map>
#include <iostream>
/// Used to iterate over the values of a map
template <class Mapclass>
struct map_keys
{
using map_t = Mapclass;
@eruffaldi
eruffaldi / fixlevel4.m
Created Nov 13, 2015
MATLAB Simulink Level 4 MAT truncated file fix
View fixlevel4.m
% quick and dirty file fixer for MATLAB Simulink Level 4
%
% Limitations: only double, needs to support other types and complex data
% Limitations: cannot cut file when spurious, needs to append a dummy
% variable (dummy)
%
% Emanuele Ruffaldi
%
% See: http://it.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf
function fixlevel4(filename,dofix)
@eruffaldi
eruffaldi / varspec.cpp
Created Nov 17, 2015
C++ Type Specifier
View varspec.cpp
#include <typeinfo>
#include <functional>
#include <iostream>
#include <map>
struct TypeSpec
{
const char * name; // pure name
std::function<bool(std::ostream&,void*)> out; // conversion fx
const std::type_info & ti; // internal name (unique)
@eruffaldi
eruffaldi / lambdasignal.cpp
Last active Apr 5, 2019
Signal as Lambda Functions in C++
View lambdasignal.cpp
#include <functional>
#include <fstream>
#include <iostream>
#include <signal.h>
/// one holder per signal type
template <int q>
struct Signal
{
using sfx = void(int );
You can’t perform that action at this time.