Skip to content

Instantly share code, notes, and snippets.

View marcodebe's full-sized avatar

Marco De Benedetto marcodebe

  • E. O. Ospedali Galliera
  • Genova - Italy
View GitHub Profile
@marcodebe
marcodebe / nginx-localnet-or-client-certificate.conf
Last active June 7, 2024 19:11
Nginx configuration for granting access to clients that are in the local net or presenting a valid SSL certificate.
# Reverse proxy for granting access to clients that are
# in the local net or presenting a valid SSL certificate.
# Credits to https://stackoverflow.com/a/48012499/2705147
geo $internal_ip {
default no;
10.0.0.0/16 yes;
}
map $internal_ip$ssl_client_verify $request_allowed {
@marcodebe
marcodebe / taylor.py
Last active April 13, 2020 23:03
Taylor for sin(x) animation in manim
# See https://github.com/3b1b/manim
# Animation: https://debe.galliera.it/pub/taylor.mp4
from manimlib.imports import *
import math
from functools import partial
class Graphing(GraphScene):
CONFIG = {
"x_min": -10,
@marcodebe
marcodebe / bardump
Last active July 5, 2019 15:26
Backup via pg_dump{,all} of all clusters defined in barman
#!/bin/bash -eu
# Uses connection strings defined in /etc/barman.d/*.conf
# to dump each single database and global objects
# do not run multiple instances
[ "${FLOCKER:-''}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :
BASE=/var/lib/barman/dumps
VERBOSE=0
QUERYDB="select datname from pg_database where datallowconn
@marcodebe
marcodebe / flatten.py
Last active April 23, 2019 20:39
Flatten list in Python
def flatten(l):
if isinstance(l, list):
out = []
out = flatten(l.pop()) + out
if l:
out = flatten(l) + out
return out
return [l]
# Example
@marcodebe
marcodebe / soa.md
Last active October 24, 2017 20:47
Microservizi

Microservizi

Si tratta di buzzword, comunque indica un'architettura in cui i singoli servizi sono accoppiati in modo lasco, oguno può essere sviluppato con tecnologie diverse e da vendor diversi. Garantiscono maggiore flessibilità rispetto ad un'implementazione concentrata su un server monolitico.

Tipicamente sono realizzati su HTTP, se non altro per il fatto che è ubiquo.

Servizi monolitici vs microservizi

Install nftables from git on Debian stretch

git clone git://git.netfilter.org/libnftnl
git clone git://git.netfilter.org/nftables
apt install autoconf libtool pkg-config libmnl-dev libjansson-dev \
bison flex libgmp-dev libreadline-dev
cd libnftnl
sh autogen.sh 
./configure --with-json-parsing
@marcodebe
marcodebe / cryptoquiz.md
Last active September 12, 2017 16:06
Crypto questions

Cosa rappresenta l’entropia di un messaggio e come si misura? Eventualmente fare un esempio.

Risposta

L'entropia misura l'incertezza media di una variabile casuale X o se vogliamo di un processo. Lavorando in base 2 è il minimo numero di bit necessari in media per rappresentare il valore x della variabile casuale X.

H(X) = - Σ p(x) · log(p(x)) x ∈ X

Epifani

Digital Evidence

  • Information of probative value that is either stored or transmitted in a binary form
  • Information or data, stored or transmitted in binary form that may be relied on as evidence

Digital Forensic

The use of scientifically derived and proven methods toward

I reati in ambito informatico e il processo penale

Responsabilità personale Art. 27 Cost.

  1. La responsabilità penale è personale.
  2. L’imputato non è considerato colpevole fino alla sentenza definitiva.

Principio di legalità Art. 25 Cost.

Nessuno può essere punito se non in forza di una legge che sia entrata in vigore prima del fatto commesso.