Skip to content

Instantly share code, notes, and snippets.

View reconfigurable_supervisor_SUITE.erl
-module(reconfigurable_supervisor_SUITE).
-compile(nowarn_export_all).
-compile(export_all).
% This test is checking modified supervisor code that can do hot reconfiguration of whole tree.
%
% Idea is following: our processes configuration should be dependent from start args.
% If we want to reconfigure process on fly, we should change his start args (just like we do in React.js)
%
View type_mapper_SUITE.erl
-module(type_mapper_SUITE).
-compile(nowarn_export_all).
-compile(nowarn_unused_record).
-compile(nowarn_unused_type).
-compile(export_all).
-compile({parse_transform,type_mapper}).
all() ->
[{group, from_json}].
View prepare-docker-arm64-qemu.sh
#!/bin/sh
# How to prepare your linux box to run ARM64 images in docker
# https://codepyre.com/2019/12/arming-yourself/
wget https://download.qemu.org/qemu-4.2.0.tar.xz
tar xf qemu-4.2.0.tar.xz
cd qemu-4.2.0
apt install -y bison flex build-essential libglib2.0-dev libpixman-1-dev qemu binfmt-support
./configure --target-list=aarch64-linux-user,arm-linux-user --static
View erl-23-socket-bug.erl
1> {ok, Socket} = gen_tcp:connect("localhost", 80, [binary, {active,false}, {packet,http},inet]),
1> ok = gen_tcp:send(Socket, "GET /crossdomain.xml HTTP/1.0\r\n\r\n"),
1>
1> LoopHeaders = fun LoopHeaders(Len) ->
1> case gen_tcp:recv(Socket, 0) of
1> {ok, http_eoh} ->
1> inet:setopts(Socket, [{packet,raw}]),
1> Len;
1> {ok, {http_header,_,'Content-Length',_, Len_}} ->
1> LoopHeaders(list_to_integer(Len_));
View dvb_dummy_adapter.c
/*
* Dummy DVB adapter driver
*
* Copyright (C) 2010 Andy Walls <awa...@radix.net>
*
* Partially based on cx18-dvb.c driver code
* Copyright (C) 2008 Steve Toth <st...@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
View events_sink.erl
-module(events_sink).
-export([start_link/2]).
-export([init/1, handle_info/2, handle_call/3, terminate/2]).
-export([overloaded/1]).
-include("event_pt.hrl").
-define(RECHECK_INTERVAL, 200).
-define(ALLOWED_DELAY, 60000).
View events_router.erl
-module(events_router).
-export([start_link/0]).
-export([init/1, handle_info/2, handle_call/3, terminate/2]).
-export([sync/0]).
-export([deliver/2, remote_deliver/1]).
-export([load_config/1, add_handler/1, remove_handler/1]).
View srtp.erl
%%%----------------------------------------------------------------------
%%% Copyright (c) 2012 Peter Lemenkov <lemenkov@gmail.com>
%%%
%%% All rights reserved.
%%%
%%% Redistribution and use in source and binary forms, with or without modification,
%%% are permitted provided that the following conditions are met:
%%%
%%% * Redistributions of source code must retain the above copyright notice, this
%%% list of conditions and the following disclaimer.
View webrtc_view.erl
-module(webrtc_view). % Copy of webrtc_publish2
-behaviour(cowboy_websocket_handler).
-include_lib("erlmedia/include/video_frame.hrl").
-include_lib("erlmedia/include/media_info.hrl").
-export([live_stream/4]).
-export([init/3, terminate/3]).
View hds.html
<!DOCTYPE html>
<html>
<head>
<title>HDS</title>
<meta name="fragment" content="!" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf8">
</head>
<body>