Skip to content

Instantly share code, notes, and snippets.

View lucarin91's full-sized avatar

Luca Rinaldi lucarin91

View GitHub Profile
@lucarin91
lucarin91 / tree_visits_with_yield.py
Last active August 16, 2017 16:49
Tree visit made using yield and new from keywords of python 3
from pprint import PrettyPrinter
from random import randrange
def post_order(t, deep=0):
if isinstance(t, dotdict):
# is a node
yield deep, t.value
yield from post_order(t.left, deep+1)
yield from post_order(t.right, deep+1)
@lucarin91
lucarin91 / tosker-slide.md
Last active November 18, 2016 11:02
slide set to describe tosker

tosKer


Feature

  • descrizione del deployment attraverso un subset di TOSCA yaml
  • supporta il deployment di docker container e docker volumes
  • supporta il deployment di componenti software generici attraverso il TOSCA lifecycle
  • permette la connessione delle varie componenti in rete
@lucarin91
lucarin91 / Rotate_a_PDF.md
Created September 2, 2016 09:19
the pdftk command to rotate a pdf file
pdftk <file-path> cat 1-endleft output <file-path-rotated>
@lucarin91
lucarin91 / sign.html
Last active July 25, 2016 17:53
my email sign
<table cellpadding="0" cellspacing="0" border="0" style="background: none; border-width: 0px; border: 0px; margin: 0; padding: 0;">
<tr>
<td colspan="2" style="padding-bottom: 4px; color: #F7751F; font-size: 16px; font-family: Arial, Helvetica, sans-serif;">Luca Rinaldi</td>
</tr>
<tr>
<td colspan="2" style="color: #333333; font-size: 14px; font-family: Arial, Helvetica, sans-serif;"><i>Computer Science & Networking Student</i></td>
</tr>
<tr>
<td colspan="2" style="color: #333333; font-size: 14px; font-family: Arial, Helvetica, sans-serif;">
<strong>University of Pisa and Scuola Superiore Sant'Anna</strong>
@lucarin91
lucarin91 / pipe.js
Created July 14, 2016 11:18
Pipe two http request with node.js +Express.js
var app = require('express')();
var http = require('http');
app.get('/', function (req, res) {
http.get('http://127.0.0.1:8000/person',
function (resApi) {
res.writeHead(resApi.statusCode);
resApi.pipe(res);
}
).end();
@lucarin91
lucarin91 / preprocessing.pl
Last active June 26, 2016 18:15 — forked from sn1p3r46/preprocessing.pl
TEXT PREPROCESSING WITH PERL
#!/usr/bin/perl
use File::Basename;
# STOP WORDS FOLDER
my $stp = "/home/andrea/Downloads/DataMining/code/data/";
# STOP WORDS FILE
my $stf = "stopwords.txt";
# DATA MAIN PATH
my $dp = "/home/andrea/Downloads/DataMining/code/dwld/Gutenberg/dwdl/stripped/";
# initialization file (not found)
@lucarin91
lucarin91 / UNIPI Didawiki slide dowloader.md
Last active June 20, 2016 17:22
Downloader Slide from UNIPI-Didawiki

Change the URL with the professor page and run

URL=http://didawiki.cli.di.unipi.it/doku.php/magistraleinformaticanetworking/cpa/start &&\
wget -O- $URL | \
sed -n 's@.*<a href="\(.*\)" class.*Slides</a>.*@http\:\/\/didawiki.di.unipi.it\/\1@p' | \
wget -c -i -
@lucarin91
lucarin91 / text_spin.cpp
Created November 24, 2015 17:45
spawn a thread that print a loading spin on the terminal
#include <iostream>
#include <thread>
#include <unistd.h>
using namespace std;
int main(int argc, char* argv[]){
thread([](){
for(char symbol = 0;;usleep(100000)){
cout << "\r" << (0==++symbol%4?"|":
1==symbol%4?"/":
#!/bin/bash
printf "Install all the dependencies..\n"
sudo apt-get update
sudo apt-get install -y mercurial python3-dev python3-numpy libsdl-dev libsdl-image1.2-dev \
libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev \
libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev
printf "\nDownload pygame source..\n"
cd /tmp
hg clone https://bitbucket.org/pygame/pygame