Skip to content

Instantly share code, notes, and snippets.

View kjellwinblad's full-sized avatar

Kjell Winblad kjellwinblad

View GitHub Profile
@kjellwinblad
kjellwinblad / test.erl
Last active December 10, 2022 16:19
Erlang Literal Map vs Function Clauses
-module(test).
-export([ main/1, is_command/1, get_existing_commands_map/0 ]).
get_bin() ->
erlang:list_to_binary([rand:uniform(127), rand:uniform(127), rand:uniform(127), 1]).
do(0,_Fun) ->
ok;
@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
@kjellwinblad
kjellwinblad / erlang_experimental_feature_support_investigation_report.md
Last active March 29, 2021 11:04
Erlang Experimental Feature Support Investigation Report

Erlang Experimental Language Features Investigation Report

Erlang currently does not support selectively using experimental language features that are not officially part of the Erlang language. Having support for doing so can help users try out and experiment with a potential extension to the language without adding this extension to the main language. This report looks into how support for selectively including experimental language features looks in other languages and how such support might look in Erlang.

Support for Selectively Enabling Experimental Language Features in Other Languages

1. I confirm that I am the sole copyright owner for my contribution to the project or that my contribution to the project are public domain.
2. I confirm that I grant the project owner (Kjell Winblad, kjellwinblad@gmail.com) full right to relicense the code I contribute to the project under a different license so the project can be dual licensed.
@kjellwinblad
kjellwinblad / DelayedWritesLock.scala
Created March 27, 2013 12:58
Interface for delayed writes readers-writer lock
/**
* A trait for implementations of DelayedWritesLocks. The guarantees
* mentioned in the description of the methods in the trait are of
* course only given if all threads accessing the data protected by
* the lock are calling appropriate methods on the lock.
*/
trait DelayedWritesLock {
@kjellwinblad
kjellwinblad / GZIPDecompressMachine.scala
Created February 23, 2011 23:37
A Non-Blocking GZIP Decompress Machine Written in Scala
import java.util.zip.GZIPInputStream
import java.io.InputStream
import java.util.concurrent.ArrayBlockingQueue
import java.io.ByteArrayInputStream
import java.util.concurrent.TimeUnit
class GZIPDecompressMachine {
private abstract class DataHolder
private case class Data(val bytes: Array[Byte]) extends DataHolder