Skip to content

Instantly share code, notes, and snippets.

@lucianogiuseppe
lucianogiuseppe / android11_sms_adb.md
Created March 29, 2022 13:48
Android 11 send SMS by ADB

Android 11

Before run the adb command you must enable the Developer Options on your Android phone, then enable USB Debug (to use ADB) and disable Permission Monitoring

Run:

adb shell service call isms 5 i32 1 s16 "com.android.mms.service" s16 "null" s16 "+39phonenumber" s16 "null" s16 "hello\ world\ " s16 "null" s16 "null" i32 1 i32 0

The method is :

@lucianogiuseppe
lucianogiuseppe / WordCount.java
Created August 13, 2016 15:18
Java WordCount on Spark using Dataset
//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");
@lucianogiuseppe
lucianogiuseppe / autoconnect.py
Last active September 10, 2017 13:02
Script per automatizzare il processo di ascolto del Vinile sul bluetooth via RaspberryPi o altri Linux device
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 11:33
Javascript JPEG SOF finder
<!doctype html>
<html>
<head>
</head>
<body>
<input type='file' accept='image/*' onchange='openFile(event)'>
<br>
<span id="sizes"></span>
<br>
<canvas id='output'></canvas>
###
#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 September 24, 2015 14:02
A Python memory and computational optimized version of Harmonic Centrality
#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