Skip to content

Instantly share code, notes, and snippets.

View lucarin91's full-sized avatar

Luca Rinaldi lucarin91

View GitHub Profile
@lucarin91
lucarin91 / Script_backup-mega.md
Last active May 12, 2016 01:30
Backup script

##Backup script for mega

@lucarin91
lucarin91 / NGINX_configsite_generator.md
Last active August 29, 2015 14:15
NGINX site Generator

#NGINX site Generator generate a config file for html site or python,node site with passenger.

usage:

./nginx-genconfig.sh python|html|node [OPTION]"
option:
    -f root folder of the site
    -d subdomain of the site
 -o output file name
@lucarin91
lucarin91 / hadoop-setup.sh
Created October 23, 2015 10:42
This script start all the Hadoop demons and initialize the Hadoop File System with same data. Can be used after start the PC to start all the Hadoop framework.
#!/bin/bash
#
# This script start all the Hadoop demons and initialize the Hadoop File System with same data
# (Fill up the above variable)
#
HADOOP_PATH=#path to the Hadoop installation
DATA_PATH=#path to the data to put in the hadoop DFS
$HADOOP_PATH/stop-all.sh
@lucarin91
lucarin91 / MyAtomPackage.md
Last active March 13, 2016 01:14
the atom packages and themes that I use.

My Atom Package

This file was generated by the command: apm list --bare --installed > atom-package.txt

You can install all the package by typing: apm install --packages-file atom-package.txt

atom-package.pl pull to install the package

atom-package.pl push to upload the package

#!/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
@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?"/":
@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 -
# initialization file (not found)
@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/";
@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();