Skip to content

Instantly share code, notes, and snippets.


Radek Szymczyszyn erszcz

View GitHub Profile
erszcz / fu.ex.do_parse_spec.diff
Created Mar 15, 2019
Gradualizer fix for Membrane.Element.RTP.H264.FU
View fu.ex.do_parse_spec.diff
diff --git a/lib/rtp_h264/nal_formats/fu.ex b/lib/rtp_h264/nal_formats/fu.ex
index 873cf26..3811210 100644
--- a/lib/rtp_h264/nal_formats/fu.ex
+++ b/lib/rtp_h264/nal_formats/fu.ex
@@ -29,12 +29,25 @@ defmodule Membrane.Element.RTP.H264.FU do
| {:error, :packet_malformed | :invalid_first_packet}
| {:incomplete, t()}
def parse(data, seq_num, acc) do
- # actual code
- data

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost
erszcz /
Last active Oct 1, 2018
Sequential Erlang node name based on EPMD entries
#!/usr/bin/env bash
# file:
set -eu
DEFAULT=${PREFIX}_$(uuidgen | sed 's/-//g')
erszcz / ct_helper.erl
Last active May 7, 2018
Erlang Common Test helper defining test-local setup/teardown
View ct_helper.erl
%% @doc Like ct:get_config/1, but calls error/1 if Key is not found / undefined.
%% This guarantees to fail fast if required config options are missing from
%% the config file, saving trouble with `undefined` value propagation.
%% Use alongside with the CT `require` mechanism.
%% See s2s_SUITE for an example.
-spec get_config(atom()) -> any().
erszcz / agent.erl
Last active Mar 9, 2018
Remotely load code into an Erlang node
View agent.erl
test(CallerPid) ->
CallerPid ! {agent, node(), self()}.
erszcz / docker.fix-network
Created Nov 9, 2017
Fix Docker4Mac container routeability (steps needed every host VM restart)
View docker.fix-network
#!/usr/bin/env bash
## Make Docker4Mac containers routable in a private network.
## This is mostly a copy-paste from the original solution.
## IT'S NOT A COMPLETE SOLUTION - this script only does the
## steps necessary every time Docker4Mac is restarted.
## Beforehand, you have to run the steps marked as ONCE yourself.
## See
set -e
erszcz / kerl-install-docsh.log
Created Oct 25, 2017
kerl install-docsh log
View kerl-install-docsh.log
Last login: Wed Oct 25 18:19:04 on ttys005
e18:20:30 erszcz @ x4 : ~
$ erl
-bash: erl: command not found
18:20:30 erszcz @ x4 : ~
$ . ~/apps/erlang/
18:20:41 erszcz @ x4 : ~
$ erl
Erlang/OTP 19 [erts-] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
erszcz /
Last active Jun 24, 2017
Docs chunk design

Docs chunk format proposal

Let's first look at some elixir_docs_v1 examples (Erlang syntax). The general chunk structure (from GenServer) is:

erszcz / cVimrc
Last active Feb 3, 2017
cVim config file
View cVimrc
" d closes a tab
map d closeTab
" C-d/C-u scrolls down/up
map <C-d> scrollPageDown
map <C-u> scrollPageup
" M-§ / A-§ switch to previous active tab / last used tab
map <M-§> lastUsedTab
map <A-§> lastUsedTab
erszcz / graph_fsm.erl
Created Mar 15, 2016
Vance Shipley's graph_fsm - a tool for drawing Erlang gen_fsm diagrams (
View graph_fsm.erl
%% graph_fsm.erl
%% Author: Vance Shipley, Motivity Telecom Inc. <>
%% Date: November, 2000
%% This library is free software; you can redistribute it and/or
%% modify it under the terms of the GNU Lesser General Public
%% License as published by the Free Software Foundation; either
%% version 2 of the License, or (at your option) any later
You can’t perform that action at this time.