Instantly share code, notes, and snippets.

# Luciano Giuseppelucianogiuseppe

• Sort options
Created Sep 24, 2015
A Python memory and computational optimized version of Harmonic Centrality
View harmonicCentrality.py
 #This function compute the harminic distance of graph's nodes #graph is a dictionary implementation of adjacency list { 1 : [1,2,3], ...} #return a dictionary where keys are nodes name and values are node harmonic distances def harmonic2(graph): #for dynamic programming harmRes = dict() for i in graph.keys(): harmRes[i] = 0.0 #for each node compute the distance from reachable nodes
Created Feb 22, 2016
View MakeKFold.r
 ### #Example of use k = 7; indici <- 1:length(tLabel) #take index of labels #indici <- sample(indici) #permutation lbl1 = which(tLabel == 0); #samples with label 0 lbl2 = which(tLabel == 1); #samples with label 1 lbl3 = which(tLabel == 2); #samples with label 2 #Make the k-fold for each label
Created Aug 13, 2016
Java WordCount on Spark using Dataset
View WordCount.java
 //tested on spark 2.0 import org.apache.spark.sql.*; import java.util.Arrays; public class WordCount { public static void main(String[] args) { if (args.length < 2) { System.err.println("Please provide the full path of input file and output dir as arguments");
Created May 6, 2017
Javascript JPEG SOF finder
Last active Sep 10, 2017
Script per automatizzare il processo di ascolto del Vinile sul bluetooth via RaspberryPi o altri Linux device
View autoconnect.py
 import bluetooth from bluetoothctl import BluetoothctlError, Bluetoothctl #Python3: fix Exceptions syntax import subprocess import time import pulsectl def setOutAudio(bName): try: with pulsectl.Pulse() as pulse: for sink in pulse.sink_list():
You can’t perform that action at this time.