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(): |
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> |
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 |
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 |