Skip to content

Instantly share code, notes, and snippets.

package main
import (
"bytes"
"net/http"
"github.com/labstack/echo/v4"
"encoding/json"
"os"
)
import paho.mqtt.client as mqtt
import threading
import random
host = "192.168.99.100"
port = 1883
# Connexion
client = mqtt.Client("TomFlitterman")
client.connect(host, port)
@tofl
tofl / Algorithmes.js
Last active November 20, 2018 16:49
Agorithmes cools
// Closure
function multiplicateur(facteur) {
return nombre => nombre * facteur;
}
let doubler = multiplicateur(2);
alert(doubler(10));
// Détermine une séquence d'additions de 5 et de multiplications par 3 pour obtenir un nombre n spécifié en paramètres :
function findSolution(target)
@tofl
tofl / gist:6219530
Last active December 21, 2015 00:19
A simple "date translator"...
<?php
function date_translate($day, $month, $year, $text) {
// day
if ($day == '01') {
$day = '1';
} elseif ($day == '02') {
$day = '2';
} elseif ($day == '03') {