Skip to content

Instantly share code, notes, and snippets.

Radek Szymczyszyn erszcz

Block or report user

Report or block erszcz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@erszcz
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
View opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md

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
erszcz / node-name.sh
Last active Oct 1, 2018
Sequential Erlang node name based on EPMD entries
View node-name.sh
#!/usr/bin/env bash
# file: node-name.sh
set -eu
PREFIX=history
MAXNODES=100
DEFAULT=${PREFIX}_$(uuidgen | sed 's/-//g')
@erszcz
erszcz / ct_helper.erl
Last active May 7, 2018
Erlang Common Test helper defining test-local setup/teardown
View ct_helper.erl
-module(ct_helper).
-compile([export_all]).
%% @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
erszcz / agent.erl
Last active Mar 9, 2018
Remotely load code into an Erlang node
View agent.erl
-module(agent).
-compile([export_all]).
test(CallerPid) ->
CallerPid ! {agent, node(), self()}.
@erszcz
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 https://github.com/docker/for-mac/issues/155#issuecomment-320509769
set -e
@erszcz
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/19.3.6.2/activate
18:20:41 erszcz @ x4 : ~
$ erl
Erlang/OTP 19 [erts-8.3.5.2] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
@erszcz
erszcz / docs-chunk-design.md
Last active Jun 24, 2017
Docs chunk design
View docs-chunk-design.md

Docs chunk format proposal

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

{elixir_docs_v1,
    [{docs,
         [{{'__using__',1},539,defmacro,[{'',[],'Elixir'}],false},
          {{abcast,3},
@erszcz
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
erszcz / graph_fsm.erl
Created Mar 15, 2016
Vance Shipley's graph_fsm - a tool for drawing Erlang gen_fsm diagrams (http://www1.erlang.org/pipermail/erlang-questions/2001-October/003716.html)
View graph_fsm.erl
%% graph_fsm.erl
%%
%% Author: Vance Shipley, Motivity Telecom Inc. <vances@motivity.ca>
%% 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.