Skip to content

Instantly share code, notes, and snippets.

Luciano Giuseppe lucianogiuseppe

Block or report user

Report or block lucianogiuseppe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lucianogiuseppe
lucianogiuseppe / autoconnect.py
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():
@lucianogiuseppe
lucianogiuseppe / jpeg_sof_finder.html
Created May 6, 2017
Javascript JPEG SOF finder
View jpeg_sof_finder.html
<!doctype html>
<html>
<head>
</head>
<body>
<input type='file' accept='image/*' onchange='openFile(event)'>
<br>
<span id="sizes"></span>
<br>
<canvas id='output'></canvas>
@lucianogiuseppe
lucianogiuseppe / WordCount.java
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");
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
@lucianogiuseppe
lucianogiuseppe / harmonicCentrality.py
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
You can’t perform that action at this time.