Skip to content

Instantly share code, notes, and snippets.

@gimiki
gimiki / func_ID_01.yaml
Last active December 1, 2021 17:42
Turing machine that calculates the function f(x)=x. View it on https://turingmachine.io/?import-gist=ID with ID that you see in the URL
name: func_ID_01
source code: |
# Macchina di Turing che calcola la funzione f(x)=x
# Alfabeto: {0,1, ' '}
blank: ' '
input: '10110'
start state: q0
table:
q0:
@gimiki
gimiki / componentsToCerts.py
Last active April 10, 2020 17:11
Example - Get a public key given the modulus and public exponent from an Identity Provider metadata service
import sys
import base64
from typing import Tuple, Dict, List
import json
import urllib.error
from urllib.request import urlopen
import ssl
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@gimiki
gimiki / traefik_tcp_mqtt_mosquitto_docker_compose.md
Last active May 19, 2024 23:51
Traefik Reverse Proxy - Mosquitto MQTT Broker - Docker Container

This gist is to configure a Mosquitto MQTT Broker behind a Traefik reverse-proxy, both in a docker container. Mosquitto will be configuread as a TCP Service.

This is a simple configuration used on the same single server. Probably to be adapted for other cases. Having mosquitto behind a reverse proxy enables you to configure TLS on Traefik (likely you already do that for other applications as well) and to load balance different MQTT instances, but that goes beyond this gist.

As noted in Traefik docs, in the router you must use the rule HostSNI(`*`) when using non-TLS routers like in this example. Ref. https://docs.traefik.io/routing/routers/#rule_1

docker-compose.yml