Skip to content

Instantly share code, notes, and snippets.

View russelldb's full-sized avatar

Russell Brown russelldb

View GitHub Profile
@gigamonkey
gigamonkey / criteria.txt
Last active January 5, 2020 06:21
Hiring criteria: looking for the ability to …
Write a program that does what it’s supposed to do
Write idiomatic code
Debug a program that you wrote
Debug a program someone else wrote
Debug the interaction between a system you wrote and one you didn’t
File a good bug report
Modify a program you didn’t write
Test a program you wrote
Test a program you didn’t write
Learn a new programming language
@seancribbs
seancribbs / ifelse.erl
Last active December 4, 2020 05:37
IF / ELSE in erlang, via parse_transform. EVIL, DO NOT USE
%% @doc A VERY EVIL parse_transform that allows two things:
%%
%% 1) The use of 'else' instead of 'true' in the final clause of an if
%% expression.
%%
%% 2) Automatic extraction of non-guard expressions into
%% anonymous variables that can then be used directly in the clause
%% guards.
%%
%% Until Erlang actually implements the 'cond' construct, this is a
@vmbrasseur
vmbrasseur / negotiation.markdown
Last active April 24, 2018 17:20
Negotiation Articles/Resources
@jlouis
jlouis / client_eqc.erl
Created June 15, 2015 15:56
EQC Cluster example
-module(client_eqc).
-compile(export_all).
-include_lib("eqc/include/eqc.hrl").
-include_lib("eqc/include/eqc_component.hrl").
api_spec() ->
#api_spec {
language = erlang,
modules = [
@andytill
andytill / Covering more with unit tests.md
Created May 25, 2015 15:20
Covering more with unit tests

Covering more with unit tests

Unit tests are quick to run, quick to write in bulk, target a small area of code, are not prone to timing issues and other intermittent failures and have excellent reporting tools.

However, actual usage is often prevented by side effects which require resources such as processes, ports and ets tables to exist or will crash the test.

Separating code into pure and impure functions can help and is typically beneficial. It can also harm readability, and even then not enable full coverage using unit testing. For example:

receive_message(Msg) ->
@max-mapper
max-mapper / readme.md
Last active May 21, 2022 11:02
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

@mguenther
mguenther / fj.erl
Last active May 10, 2018 08:19
fork/join with parallel quicksort as example (Erlang)
-module(fj).
-export([parallel/2]).
%%%-----------------------------------------------------------------------------
%%% @doc Executes the given function on every task in tasks in parallel.
%%% @spec parallel(Function, Tasks) -> Results
%%% where Results is a list matching the arity of input list Tasks
%%% but contains the result of invoking Function on those tasks
%%% @end

Installation of Erlang R16B03-1 and 17.0-rc2 to OS X 10.9.2 with Xcode and wxWidgets 3.0.0

Installing wxWidgets

@lenary
lenary / 00-intro.md
Last active August 29, 2015 13:56
Guidance Notes for CRDT Performance Issues

I've had one question about subpar performance in Riak 2.0's CRDTs. I thought I'd write this so that people can more easily diagnose these issues, without the CRDT team having to step in every time.

An Example: A Client was having problems with the performance fetching and updating sets. The issue manifested itself with poor fetch performance.

So, how do you go about debugging/diagnosing this?