Skip to content

Instantly share code, notes, and snippets.

View davibe's full-sized avatar

Davide Bertola davibe

  • Vercelli/Torino, Piedmont, Italy
View GitHub Profile
import React, { Component, Fragment, useState, useEffect, useRef } from 'react'
const VideoPool = () => {
const videoSrc = 'data:video/mp4;base64,AAAAFGZ0eXBNU05WAAACAE1TTlYAAAOUbW9vdgAAAGxtdmhkAAAAAM9ghv7PYIb+AAACWAAACu8AAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAnh0cmFrAAAAXHRraGQAAAAHz2CG/s9ghv4AAAABAAAAAAAACu8AAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAFAAAAA4AAAAAAHgbWRpYQAAACBtZGhkAAAAAM9ghv7PYIb+AAALuAAANq8AAAAAAAAAIWhkbHIAAAAAbWhscnZpZGVBVlMgAAAAAAABAB4AAAABl21pbmYAAAAUdm1oZAAAAAAAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAVdzdGJsAAAAp3N0c2QAAAAAAAAAAQAAAJdhdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAFAAOABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAAEmNvbHJuY2xjAAEAAQABAAAAL2F2Y0MBTUAz/+EAGGdNQDOadCk/LgIgAAADACAAAAMA0eMGVAEABGjuPIAAAAAYc3R0cwAAAAAAAAABAAAADgAAA+gAAAAUc3RzcwAAAAAAAAABAAAAAQAAABxzdHNjAAAAAAAAAAEAAAABAAAADgAAAAEAAABMc3RzegAAAAAAAAAAAAAADgAAAE8AAAAOAAAADQAA
[
{
"type": 4,
"data": {
"href": "http://localhost:1234/workflow1.html",
"width": 877,
"height": 927
},
"timestamp": 1570639615140
},
@davibe
davibe / laptop_thinnest_2019.md
Created November 9, 2019 20:12
Thinnest 15" laptops (macbook pro alternatives) - 2019
@davibe
davibe / monopattini_torino_email_bezzon_municipale.txt
Last active November 9, 2019 19:53
Monopattini torino email bezzon municipale
Davide ----
Salve,
Mi scuso per il disturbo. Ho provato a cercare chiarimenti tramite la email generica della polizia municipale ma ho ricevuto risposte che non mi sono sembrate aderenti alle mie domande. Per questo motivo ho deciso di scrivere direttamente a lei.
In questi giorni molto del rumore causato dalle vicende legate alla mobilità elettrica si basano sul fatto che la polizia equipara i monopattini a motocicli. Il riferimento normativo su cui vi basate non mi sembra sia direttamente il codice della strada, ma piuttosto il "decreto del 31
gennaio 2003". Tale decreto è stato emanato per recepire una direttiva europea del 2002.
Rif: https://www.asaps.it/1705-decreto_31_gennaio_2003__gu_n_123_del_29-5-2003-_suppl_ordinario_n86.html
Nel 2013 però è stato emanato un altro regolamento europeo "168/2013" che è del tutto analogo alla direttiva del 2002 ma rende chiaro che i mezzi che non hanno un posto a sedere sono esclusi esattamente come i mezzi per disabili e i mezzi che costruttivamente vanno a meno di
@davibe
davibe / network_security_config.xml
Created August 21, 2019 15:20
app/src/main/res/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
@davibe
davibe / architecture-with-type-intersection-based-DI.swift
Last active July 16, 2022 18:39
Using protocol composition (intersection types) as simple DI in Swift
// Providers
class Provider1 { }
protocol HasProvider1 { var provider1: Provider1 { get } }
class Provider2 { }
protocol HasProvider2 { var provider2: Provider2 { get } }
// a Provider that depends on the other two needs to be configured
protocol Configurable {
func configure(providerBag: HasProviders)
@davibe
davibe / rpicam-gstreamer.txt
Created October 19, 2018 06:15 — forked from muellermartin/rpicam-gstreamer.txt
Stream video from Raspberry Pi with camera attached to CSI port via RTP (UDP) using GStreamer
Useful Links:
- http://stackoverflow.com/questions/25941171/how-to-get-gstreamer1-0-working-with-v4l2-raspicam-driver
- http://raspberrypi.stackexchange.com/questions/26675/modern-way-to-stream-h-264-from-the-raspberry-cam
- http://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc
- http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
- http://archpi.dabase.com/#sending-and-receiving-pi-camera-video-over-the-network
- http://emmanuelgranatello.blogspot.de/2013/10/raspberry-pi-gstreamer-streaming-h264.html
- http://stackoverflow.com/questions/15712983/why-rtp-streaming-of-a-avi-video-file-fails-to-be-received
sudo apt-get update && sudo apt-get install -y hostapd dnsmasq iptables-persistent
export DEBIAN_FRONTEND=noninteractive
export ID=$(cat /sys/class/net/wlan0/address | sed 's/://g')
export AP_NAME=AP_$(date +%s)
export AP_PASS=raspberry
export WIFI_NAME=wifi_name
export WIFI_PASS=wifi_password
sudo bash -c 'cat > /etc/network/interfaces.d/ap' << EOF
@davibe
davibe / rpi_zero_w_wifiapclientbridge_configure.sh
Last active September 29, 2018 09:59 — forked from lukicdarkoo/configure.sh
Raspberry Pi: AP + client mode
#!/bin/sh
# The script configures simultaneous AP and Managed Mode Wifi on Raspberry Pi Zero W (should also work on Raspberry Pi 3)
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s WifiSSID WifiPass APSSID APPass
# Licence: GPLv3
# Author: Darko Lukic <[email protected]>
# Special thanks to: https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/
MAC_ADDRESS="$(cat /sys/class/net/wlan0/address)"
CLIENT_SSID="${1}"
CLIENT_PASSPHRASE="${2}"
@davibe
davibe / kotlinStructuredConcurrency.kt
Created November 13, 2017 06:55
Example of structured concurrency in Kotlin
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.Channel
import java.util.*
/*
* Structured concurrency means that child co-routines should die when their father dies
* http://libdill.org//structured-concurrency.html
*
* In kotlin in order to have parent->child relationship you need to explicitly pass
* the coroutineContext to the child coroutine.