Skip to content

Instantly share code, notes, and snippets.

@giacobenin
giacobenin / protobuf-3.1-android-config.sh
Created October 3, 2018 20:54
Script to build protobuf 3.1.0 for Android
#!/bin/bash
# Place this script in protobuf's root folder, where autogen.sh and configure are located
# Change config
API=21
# No need to change henceforth
BIN_ROOT=/tmp/android-toolchain
BIN=${BIN_ROOT}/bin
@giacobenin
giacobenin / udp2tcp.py
Last active January 20, 2021 05:21 — forked from vxgmichel/udpproxy.py
UDP to TCP 1-Way Relay using asyncio
"""
1-way UDP to TCP relay.
Test with netcat
1) Run TCP server:
nc -l 999
2) Run UDP proxy:
python udpproxy.py
3) Run UDP client:
nc -u 127.0.0.1 8888
@giacobenin
giacobenin / VideoStreamer.java
Created August 5, 2016 20:12
Media Streaming using VLCJ
package us.ihmc.netcacher.net;
import java.io.File;
import java.util.Collection;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.co.caprica.vlcj.binding.internal.libvlc_media_t;
import uk.co.caprica.vlcj.player.MediaPlayer;
@giacobenin
giacobenin / checkjavaversion.sh
Created June 14, 2016 15:45
It outputs the major java version of the input class file, or the major java version of each class file contained in the input directory.
#!/bin/bash
root=$1
VERSION=""
function major_to_version {
local major="$1"
case $major in
46) VERSION="1.2";;
47) VERSION="1.3";;
@giacobenin
giacobenin / neo4j-contact networks
Last active April 5, 2016 22:01 — forked from mdalp/neo4j-contact networks
This Gist wants to show how to take advantage of the Neo4j graph modeling to represent and navigate contact networks.
:neo4j-version: 2.2
:author: Marcello Dalponte
:twitter: @m_dalp
## Contact networks
A contact network is one of the typologies of dynamic networks described in the famous paper of Holme and Saramäki[1].
A dynamic network is a mathematical representation of the evolution of the relationships between entities through graphs.
It's interesting to catch this dynamicity because describes the transitivity of the order of the interactions: if A meets B and after B meets C then A can transmit something to C but not the opposite; this is useful to study the spreading of informations or infections.
An interesting project that aims to collect this kind of data is Sociopatterns[2], where Cattuto and others developed a framework to collect contacts data from RFID sensors [3].
@giacobenin
giacobenin / 51-android.rules
Created September 30, 2011 21:37
udev rule file containing USB configuration of popular idVendors.
#############################################################################
# Place it in /etc/udev/rules.d, name it 51-android.rules and restart udev #
# (/etc/init.d/udev restart). #
# #
# The List of idVendors code can be found at #
# http://developer.android.com/guide/developing/device.html#VendorIds) #
# #
# If your Android device is not in this list, you can find its vendor ID by #
# plugging the device to your computer and using the "lsusb" command. #
# #