Skip to content

Instantly share code, notes, and snippets.

@keynslug
keynslug / bench-report
Created August 23, 2023 15:36
Perf comparison / release-52 (Orig) vs PR#11481 (Head)
> emqx_topicidx_bench:run(fixed).
Orig: [{memory,534},
{name,emqx_topic_index_r52},
{size,15},
{type,ordered_set},
{keypos,1},
{protection,public}]
Head: [{memory,504},
{name,emqx_topic_index},
{size,15},
@id
id / emqx-prometheus-cloudwatch.md
Created April 27, 2023 16:18
EMQX e4.4.17 --> Prometheus --> CloudWatch

EMQX e4.4.17 --> Prometheus --> CloudWatch

Tested on a stock Ubuntu 22.04 AMI.

EMQX

sudo apt update
sudo apt install ./emqx-ee-4.4.17-otp24.3.4.2-1-ubuntu22.04-amd64.deb
sudo systemctl restart emqx
curl -f "127.0.0.1:8081/api/v4/emqx_prometheus?type=prometheus"
@nickva
nickva / fixalloc.erl
Last active August 29, 2024 12:24
Erlang 24 and 25 fix_alloc memory leak
%
% Run on Erlang 24+
%
% (MFatags true is to enable instrumentation for fix_alloc)
%
% $ erl -name [email protected] +MFatags true
% ([email protected])>
%
% $ erl -name [email protected] +MFatags true
% ([email protected])2> c(fixalloc), fixalloc:go('[email protected]').
@qzhuyan
qzhuyan / EMQX_master_flaky_tcs.md
Last active June 1, 2023 14:09
Lastest Updates for master

Branch: master attempts max: 8 : https://api.github.com/repos/emqx/emqx/actions/runs/5136332850 Generated at 2023-06-01 16:09:31.526180

suite case total failed times
emqx_bridge_kafka_impl_consumer_SUITE sasl_plain.sasl_auth_kerberos.t_start_and_consume_ok 6
emqx_bridge_kafka_impl_consumer_SUITE sasl_ssl.sasl_auth_kerberos.t_start_and_consume_ok 5
emqx_bridge_cassandra_SUITE tls.async.with_batch.t_write_failure 5
emqx_bridge_pulsar_impl_producer_SUITE plain.t_send_when_down 5
emqx_ee_bridge_redis_SUITE rest.t_check_replay 5
@kjellwinblad
kjellwinblad / emqx_hot_upgrade.md
Last active December 21, 2022 09:55
Description of how to prepare EMQX for hot upgrading

This page describes how to create a new minor release of EMQX Enterprise Edition and test that hot upgrading from the previous minor release to the current one works. The steps to do the same for EMQX Community Edition should be very similar.

  1. Identify which internal apps have changed after the previous minor release
  2. Bump the version number in the APP_NAME.app.src files for the apps that have changed. For example, if the emqx_rule_actions has changed, then bump the version number under the vsn property in lib-ee/emqx_rule_actions/src/emqx_rule_actions.app.src. If the previous version number was "4.4.5" then the new one should be "4.4.6".
  3. Bump the version number for the main EMQX app. This means bumping the version number under the vsn property in the file src/emqx.app.src. If the previous version number was "4.4.5" then the new one should be "4.4.6".
  4. Bump the version numbers in include/emqx_release.hrl. The version numbers in include/emqx_release.hrl should be the same as in `src/e
@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).
@Gabriella439
Gabriella439 / HasCal.hs
Last active May 5, 2022 09:47
First steps towards modeling PlusCal as a Haskell eDSL
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
module HasCal where
import Control.Applicative (Alternative(..), liftA2)
@rexim
rexim / main.rs
Last active October 31, 2024 20:32
The Most Memory Safe Buffer Overflow in Rust!
// The Most Memory Safe Buffer Overflow in Rust!
//
// Consider all the code below under Public Domain
//
// How to build:
// $ rustc main.rs
//
// Wrong password:
// $ printf "hello\n" | ./main
//
@hwayne
hwayne / BubbleSort.tla
Last active September 17, 2022 00:10
Bubblesort Algorithm
---- MODULE BubbleSort ----
EXTENDS Integers, TLC, Sequences, FiniteSets
Counter(seq) ==
LET
Range == {seq[x] : x \in DOMAIN seq}
CountOf(x) == Cardinality({i \in 1..Len(seq): seq[i] = x})
IN
[val \in Range |-> CountOf(val)]
@hwayne
hwayne / explanation.md
Last active April 9, 2024 21:37
Sudoku DIMACS format

How the J Script Works

Going line by line:

b =: >: i. 9 9 9

This generates a 9 by 9 by 9 array with all values from 1 to 729. We can choose what each axis represents: I decided that each table is all of the boolean variables for one number, and the rows and columns map to sudoku rows and columns. For example: