Skip to content

Instantly share code, notes, and snippets.

View MatteoRagni's full-sized avatar
🎱

Matteo Ragni MatteoRagni

🎱
View GitHub Profile
@MatteoRagni
MatteoRagni / README.md
Last active August 12, 2017 13:14
Creates a context-menu in nautilus that allows to open a directory (or a list of selected directory) as project folder. Only for current user (no root required).

Atom context menu

Synopsis

This simple script creates a new element in context menu that opens current directory (background click) or a list of directory (selected elements) as project folder. It does not open single files (that should be done as MIME type, search on google!)

Installation

@MatteoRagni
MatteoRagni / 00_README.md
Last active March 13, 2017 14:48
Scripts for paper: M. Ragni - "Mr.CAS - A Minimalistic (pure) Ruby CAS for Fast Prototyping and Code Generation"

Mr.CAS - A Minimalistic (pure) Ruby CAS for Fast Prototyping and Code Generation

Abstract

There are complete Computer Algebra System (CAS) systems on the marketm with complete solutions for analysis of analytical models. But exporting a model, for optimization or any other research activity, requires a lot of work, even with a good software.

This work presents a Ruby library that exposes minimalistic CAS capabilities - i.e. simplifications, substitutions, evaluations, etc. Library aims at rapid prototyping of numerical interfaces and code generation for different target languages, separating mathematical expression from exportation rules - e.g. models from numerical conditioning best practices.

The library is implemented in pure Ruby language and compatible with all Ruby interpreter flavours.

@MatteoRagni
MatteoRagni / .gitignore
Last active November 29, 2016 19:49
Class structure for Mr.CAS
*.dot
@MatteoRagni
MatteoRagni / adhesion.dat
Last active November 15, 2016 13:53
Ex. for 15 Nov. Lecture
19.8
15.4
11.4
19.5
10.1
18.5
14.1
8.8
14.9
7.9
@MatteoRagni
MatteoRagni / ad.h
Last active October 29, 2016 20:35
Automatic Differentiation in C
/* Test for Automatic differentiation in C */
/* MIT License - Ragni Matteo 2016 */
#include <math.h>
typedef double number;
// Math constants
#define AD_PI 3.141592653589793
#define AD_E 2.718281828459045
@MatteoRagni
MatteoRagni / TelegramNotifier.m
Last active June 9, 2016 10:08
A simple telegram notifier to send a message via bot when a simulation is completed, without the need to load an entire library for telegrams bot.
classdef TelegramNotifier
%TELEGRAMNOTIFIER is an extremely simple class to send a notification
% when a long simulation is ended.
properties
conf_file
config
end
methods
function self = TelegramNotifier(path)
%TELEGRAMNOTIFIER create a new telegram notifier object.
@MatteoRagni
MatteoRagni / PKGBUILD
Created June 3, 2016 10:04
GCC-4.9 for CUDA as secondary compiler on Linux Arch. Compiled as a package with `makepkg -sri`. Edited version of AUR package `gcc49`
# $Id$
# Maintainer: Matteo Ragni <[email protected]>
# Contributor: Matteo Ragni <[email protected]>
# Based on the original package by:
# Ruben Van Boxem <[email protected]>
# Allan McRae <[email protected]>
pkgname=('gcc49-cuda')
_pkgver=4.9
@MatteoRagni
MatteoRagni / tictoc.rb
Created June 2, 2016 16:27
A simple tic toc timer in ruby. Timed operations are wrapped in a proc
def tictoc
tic = Time.now
yield
toc = Time.now
ret = toc - tic
puts "Time elapsed #{'%.3f' % ret}"
return ret
end
@MatteoRagni
MatteoRagni / test.py
Last active June 3, 2016 14:28
Timer in python, that implements a tic - toc in a context
from timer import Timer
with Timer():
print("do something")
with Timer():
print("do something else")
@MatteoRagni
MatteoRagni / Makefile.config
Last active November 25, 2016 09:00
Makefile configuration for CAFFE on my system (Arch Linux - GCC 6.1 - cuDNN - Cuda7.1 - Python3.5m - Matlab R2015b)
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers