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
View dynamicinvoke
/**
* Binadable Class
*/
#include <functional>
#include <boost/any.hpp>
#include <vector>
#include <iostream>
#include <memory>
#include <type_traits>
#include <typeinfo>
@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 / enumeratefor.cpp
Created Nov 30, 2015
Enumerating C++ Range For
View enumeratefor.cpp
/// Emanuele Ruffaldi
#include <vector>
#include <iostream>
#include <algorithm>
template <class VT, class IT>
class counter_class {
public:
using value_t = std::pair<int,VT>;
@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 / GEV09_Scopus_Article.py
Created Jan 27, 2016
Tool for analyzing the GEV09 classification in VQR 2011-2014
View GEV09_Scopus_Article.py
#Emanuele Ruffaldi 2016 Scuola Superiore Sant'Anna
import csv,os,sys
from pyexcel_xls import get_data,save_data
all = []
#Year TopicId Topic Filename Titolo Rivista Codice identificativo SCOPUS valore SJR classe A classe B classe C classe D classe E IR in alto IR in basso
#4 + 3 + nclassi +
total = 4 + 3 + 5 + 2 +1
key2pos = {
"Titolo Rivista": 4,
View gist:2ea55ac42b4ccaf0e8dc
// Example program
#include <iostream>
#include <string>
/// boost splitter is too complex
class split_iterator
{
public:
split_iterator(const std::string & ain, char ac): in(ain),c(ac),ip(0)
{
You can’t perform that action at this time.