MQTT is probably best known as a lightweight messaging protocol implemented for small sensors, but there is actually a JavaScript implementation called MQTT.js
. It's a JavaScript implementation, so of course it works in a browser. I think it's a great option for front-end engineers who are working with MQTT/IoT-related projects (for example, creating a dashboard to visualize MQTT data). In this article, I'd like to write about what I did when I tried to connect MQTT.js
to the test server (broker) of Mosquitto™
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
ESPNOW - Basic communication - Broadcast | |
Date: 28th September 2017 | |
Original Author: Arvind Ravulavaru <https://github.com/arvindr21> | |
modified by Daniel de kock | |
Purpose: ESPNow Communication using Broadcast | |
Resources: (A bit outdated) | |
a. https://espressif.com/sites/default/files/documentation/esp-now_user_guide_en.pdf |
之前在这里研究过的用iptables配置跨网段的端口转发
Assume we have the following network environments:
- Device:
- eth0 (
192.168.6.59
): for external access - enx000ec6a490c5 (
192.168.1.2
): for ip camera
- eth0 (
- IP Camera:
192.168.1.10
- PC:
192.168.6.2
Explanation of chosen options:
- Verbose output with speed and progress information
- Try to preserve all possible information: file attrs, hardlinks, ACLs and extended attrs,
- Exclude contents of pseudo-filesystems and mountpoints
- In this example source host is remote and destination local.
rsync --info=progress2 -vaHAX --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} source.host:/ /local/destination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from collections.abc import Coroutine | |
from typing import Any | |
async def gather_limit( | |
*tasks: Coroutine[None, None, Any], | |
return_exceptions: bool = False, | |
max_con: int = 100, | |
) -> Any: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo mount -o remount,size=10G,noatime /tmp | |
echo "Done. Please use 'df -h' to make sure folder size is increased." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import re | |
import string | |
from tqdm import tqdm | |
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory | |
class DataCleaning: | |
# Initialization | |
factory = StemmerFactory() | |
stemmer = factory.create_stemmer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
import imutils | |
template = cv2.imread('template.jpg') # template image | |
image_o = cv2.imread('image.jpg') # image | |
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY) | |
image = cv2.cvtColor(image_o, cv2.COLOR_BGR2GRAY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Arduino data manipulation and concatenation with structures and unions | |
* | |
* This simple (ish) sketch shows you how to organize your data into a struct | |
* and then access the whole thing as a byte array. | |
* | |
* Useful if you want to concatenate several variables into a single byte array | |
* to send over bluetooth, i2c, lora or any other protocol that works with arrays. | |
* In other words you have a fixed byte array, and we squeeze in variables of different | |
* data types and lengths into it, while still using it as a byte array afterwards. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ldap3 import Server, Connection, ALL | |
from tornado.web import create_signed_value, decode_signed_value | |
import pywebio | |
from pywebio.input import * | |
from pywebio.output import * | |
from pywebio.session import * | |
LDAP_AUTH_URL = "ldap://localhost:389" | |
LDAP_AUTH_SEARCH_BASE = "dc=example,dc=org" |
NewerOlder