Skip to content

Instantly share code, notes, and snippets.

View zmstone's full-sized avatar

zmstone zmstone

View GitHub Profile
#!/bin/bash
docker run --rm -it -e EMQX_AUTHENTICATION='[{mechanism="password_based",backend="http", url="http://node:4000/mqtt/authn//",method="post",body={username="${username}", password:"${password}"}, enable=true}]' \
emqx/emqx:5.0.14 emqx console
#!/bin/bash
docker run --rm -it -p 18084:18084 -e EMQX_DASHBOARD__LISTENERS__HTTPS__ENABLE="true" \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__CACERTFILE='/opt/emqx/etc/certs/cacert.pem' \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__CERTFILE='/opt/emqx/etc/certs/cert.pem' \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__KEYFILE='/opt/emqx/etc/certs/key.pem' \
emqx/emqx:5.0.21 emqx console
{
"components": {
"schemas": {
"broker.sysmon_os": {
"properties": {
"cpu_check_interval": {
"default": "60s",
"description": "The time interval for the periodic CPU check.",
"label": "The time interval for the periodic CPU check.",
"summary": "The time interval for the periodic CPU check.",
@zmstone
zmstone / OTP-PUB-KEY.erl.patch.1
Last active February 22, 2024 14:07
Erlang OTP wrong_tag issues
%% Based on OTP 23 (generated code)
%% DomainComponent should have tag value 22, but got 19 (restricted-string)
dec_DomainComponent(Tlv) ->
try
dec_DomainComponent(Tlv, [22])
catch
exit : {error, {asn1, {wrong_tag, {{expected, _}, {got, Got, _}}}}} ->
dec_DomainComponent(Tlv, [Got])
end.
@zmstone
zmstone / bin_element.erl
Created April 11, 2022 17:06
binary pattern match performance
-module(bin_element).
-export([run/1]).
-define(CHUNK_SIZE, 1049).
run(Chunks) ->
BinL = [crypto:strong_rand_bytes(?CHUNK_SIZE) || _ <- lists:seq(1, Chunks)],
TotalBytes = ?CHUNK_SIZE * Chunks,
compare([hd(BinL) | BinL], TotalBytes).

EMQ X 5.0-beta.2-41aa958a Configuration

EMQ X configuration file is in HOCON format. HOCON, or Human-Optimized Config Object Notation is a format for human-readable data, and a superset of JSON.

Syntax

In config file the values can be notated as JSON like ojbects, such as

node {

EMQ X 5.0-beta.2-21505ed5 Configuration

EMQ X configuration file is in HOCON format. HOCON, or Human-Optimized Config Object Notation is a format for human-readable data, and a superset of JSON.

Syntax

In config file the values can be notated as JSON like ojbects, such as

node {
@zmstone
zmstone / 5.0-beta.2-2d9aee6d.md
Last active December 3, 2021 21:50
5.0-beta.2-d947c4c0

EMQ X 5.0-beta.2-2d9aee6d Configuration

Root Keys

Fields

  • listeners: listeners

    MQTT listeners identified by their protocol type and assigned names

  • zones: {$name -> zone}

EMQ X 5.0-beta.2-90f520fd Configuration

Fields

  • listeners: listeners

    MQTT listeners identified by their protocol type and assigned names

  • zones: {$name -> zone}

EMQ X 5.0-beta.2-2383e561 Configuration

Fields

  • listeners: listeners

    MQTT listeners identified by their protocol type and assigned names

  • zones: {$name -> zone}