Skip to content

Instantly share code, notes, and snippets.

View pbosetti's full-sized avatar
:octocat:

Paolo Bosetti pbosetti

:octocat:
View GitHub Profile
# -*- encoding: utf-8 -*-
# Stub for gemspec
Gem::Specification.new do |s|
s.name = %q{GEMNAME}
s.version = "GEMVERSION"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Paolo Bosetti"]
s.date = %q{2009-05-04}
@pbosetti
pbosetti / EEPROM_hack.cpp
Created June 29, 2009 14:30
Pair of functions to read and write values of any type in Arduino's EEPROM memory.
/*
Functions to write and restore value of any type in Arduino's EEPROM
*/
#include <EEPROM.h>
// Functions
template <class T> int EEPROM_write(int ee, const T& value)
{
byte const *p = reinterpret_cast<byte const *>(&value);
int i;
#include <MsTimer2.h>
#include <EEPROM.h>
// Serial data rate
#define BAUD 115200
// Version number
#define CODEID "Sampler.1"
// Constants
@pbosetti
pbosetti / fft.rb
Created September 7, 2009 18:18
Adds a method to Array to compute the 1-D radix-2 fast Fourier Transform
#!/usr/bin/env ruby
# Adds a method to Array to compute the 1-D radix-2 fast Fourier Transform
#
# Created by Paolo Bosetti on 2009-09-07.
# Copyright (c) 2009 University of Trento. All rights reserved.
#
require "mathn"
require "complex"
include Math
@pbosetti
pbosetti / entities.rb
Created September 11, 2009 09:12
ASCII encoder
#!/usr/bin/env ruby
# entities.rb
#
# Created by Paolo Bosetti on 2009-09-11.
# Copyright (c) 2009 University of Trento. All rights reserved.
#
$KCODE = 'U'
OUT_DIR = "Converted"
if ARGV.size == 0
@pbosetti
pbosetti / FFT.c
Created October 9, 2009 14:42
Small Ruby C extension to compute the FFT of an Array of power of 2 elements (Float).
/*
fft extension to Array class.
(C) Paolo Bosetti 2009 - University of Trento
Credits to fft.c
(c) Douglas L. Jones
University of Illinois at Urbana-Champaign
January 19, 1992
*/
#include "ruby.h"
#include <math.h>
@pbosetti
pbosetti / transimage.rb
Created December 30, 2010 09:36
Makes an image by stripping a bunch of images
#!/usr/bin/env ruby
# transimage.rb
#
# Created by Paolo Bosetti on 2010-12-03.
# Copyright (c) 2010 University of Trento. All rights reserved.
#
require "rubygems"
require "RMagick"
@pbosetti
pbosetti / prepare-system.sh
Created December 30, 2010 09:38
Prepare VoDiSys system
#!/usr/bin/env bash
#echo "Adding universe repository"
#if ! apt-add-repository "deb http://archive.ubuntu.com/ubuntu lucid universe"; #then
# echo "Could not add source list"
# exit $?
#fi
echo "Updating package list"
if ! apt-get update; then
echo "Could not update package list"
@pbosetti
pbosetti / simpleipc.rb
Created January 5, 2011 08:28
Simple InterProcessCommunication library
#!/usr/bin/env ruby
# test
#
# Created by Paolo Bosetti on 2011-01-04.
# Copyright (c) 2011 University of Trento. All rights reserved.
#
require "yaml"
require "socket"
require "timeout"
require "fileutils"
@pbosetti
pbosetti / metaprog.rb
Created January 19, 2011 16:25
Metaprogramming examples in Ruby
#!/usr/bin/env ruby
# untitled
#
# Created by Paolo Bosetti on 2011-01-19.
# Copyright (c) 2011 University of Trento. All rights reserved.
#
def header(string)
border = "=" * string.length