Skip to content

Instantly share code, notes, and snippets.

View pbosetti's full-sized avatar
:octocat:

Paolo Bosetti pbosetti

:octocat:
View GitHub Profile
@pbosetti
pbosetti / virtual_ide.md
Last active November 8, 2016 11:43
Setup instruction for Manufacturing Automation class

Setup instruction for Manufacturing Automation class

Prerequisites

You need a laptop (Mac or PC) with at least 20 Gb of available disk space. The laptop needs a relatively recent CPU (Intel Core i3 or better).

Virtualization platform

In order to make the life easier for all of us avoiding the issues originating from the use of different platforms and operating systems, we will work on the same OS

@pbosetti
pbosetti / edison-x-compile.md
Last active October 17, 2016 07:05
Intel edison cross compiling tricks on OS X
@pbosetti
pbosetti / .bash_profile
Last active March 1, 2016 09:30
Bash prompt configuration for git branch names
# ASCII COLOR SEQUENCES: \[\033[***m\] where *** is one of the following codes:
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
# Green 0;32 Light Green 1;32
# Cyan 0;36 Light Cyan 1;36
# Red 0;31 Light Red 1;31
# Purple 0;35 Light Purple 1;35
# Brown 0;33 Yellow 1;33
# Light Gray 0;37 White 1;37
HL_CLR="\[\033[1;32m\]"
@pbosetti
pbosetti / segv_capture.c
Created February 11, 2016 11:25
Example on capturing and managing SIGSEGV in C99/Unix
//
// main.c
// segv_capture
//
// Created by Paolo Bosetti on 10/02/16.
// Copyright © 2016 UniTN. All rights reserved.
//
#include <setjmp.h>
#include <signal.h>
@pbosetti
pbosetti / prepare.rb
Last active December 1, 2015 07:37
Trying to illustrate the reason for using local includes (i.e. #include "") rather than system includes (i.e. #include <>) within public headers for mruby.
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
# This scripts tries to show why it is preferable to only use local include
# commands (#include "") within public headers of mruby when they include each
# other.
# To test it, first run this script with no arguments (it will stop on
# compilation), then with the `proposal` argument, which uses as mruby source
# the relative pull request.
# Note that the pull request does not alter in any way how users will have to
@pbosetti
pbosetti / mruby-play.c
Last active December 18, 2021 21:41
mruby gem example on how to use Data_Wrap_Struct for wrapping C structs into an mruby object
/***************************************************************************/
/* */
/* play.c - mruby testing */
/* Copyright (C) 2015 Paolo Bosetti and Matteo Ragni, */
/* paolo[dot]bosetti[at]unitn.it and matteo[dot]ragni[at]unitn.it */
/* Department of Industrial Engineering, University of Trento */
/* */
/* This library is free software. You can redistribute it and/or */
/* modify it under the terms of the GNU GENERAL PUBLIC LICENSE 2.0. */
/* */
@pbosetti
pbosetti / gist:4e6ebf5077ceaa8cc8ec
Last active August 29, 2015 14:18
Dependencies for Mechatronix package on Linux Debian

Dependencies for Mechatronix package on Linux Debian

Before installing the Mechatronix package, install the following dependencies:

sudo apt-get install libyaml-0-2 libyaml-dev
sudo apt-get install libreadline6 libreadline6-dev libreadline-dev readline-common
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install libblas3 libblas-dev libopenblas-base libopenblas-dev
sudo apt-get install liblapack3 liblapack-dev
@pbosetti
pbosetti / setup.sh
Last active August 29, 2015 14:13
Base debian setup
#!/bin/bash
RUBY_BASE=2.2
RUBY_TGZ=ruby-2.2.0
echo
echo "************************************"
echo "Updating package list"
if ! sudo apt-get update; then
echo "Could not update package list"
exit $?
@pbosetti
pbosetti / timeout.c
Created June 4, 2014 13:39
Simple timeout implementation using SIGALRM
//
// main.c
// timeout
//
// Created by Paolo Bosetti on 04/06/14.
// Copyright (c) 2014 UniTN. All rights reserved.
//
#include <stdio.h>
#include <signal.h>
@pbosetti
pbosetti / mruby-bug.rb
Last active August 29, 2015 13:57
This script replicates a weird bug in mruby
#!/usr/bin/env mruby
# Dataset, Container and self.dataset are a minimal set of prerequisites that
# we extrapolated from our application, in order to replicate the bug
class Container
attr_accessor :key_converter, :match
attr_reader :hsh
def initialize
@hsh= Hash.new