Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Schuindt fschuindt

View GitHub Profile
View nginx.conf
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
worker_processes auto;
error_log /home/broadcaster/log/error.log warn;
pid /home/broadcaster/run/nginx.pid;
events {
worker_connections 768;
}
View Dockerfile
FROM ubuntu:20.10
ARG NGINX_GIT=https://github.com/nginx/nginx.git
ARG NGINX_RTMP_GIT=https://github.com/arut/nginx-rtmp-module.git
ARG NGINX_RELEASE=release-1.19.6
ARG DEBIAN_FRONTEND=noninteractive
RUN apt -y update && \
apt install -y apt-utils && \
apt install -y --no-install-recommends build-essential make \
@fschuindt
fschuindt / collatz.ex
Created Jul 21, 2018
The Collatz conjecture.
View collatz.ex
defmodule Collatz do
def of(1), do: 1
def of(n) do
IO.puts n
do_of(n, rem(n, 2))
end
defp do_of(n, 0) do
View README.md

Concurrent calculation of Fibonacci in Elixir up to the 1200th position (faster than you can see)

It uses a known formla to evaluate a position instead of calculating it in a sequencial and/or recursive approach.
Formula

It's amazing how fast it is:
Demonstration

View Definition
TRUE = λx. λy. x
FALSE = λx. λy. y
NOT = λb. b FALSE TRUE
AND = λb1. λb2. b1 b2 FALSE
OR = λb1. λb2. b1 TRUE b2
XOR = λb1. λb2. b1 (b2 FALSE TRUE) b2
View keybase.md

Keybase proof

I hereby claim:

  • I am fschuindt on github.
  • I am fschuindt (https://keybase.io/fschuindt) on keybase.
  • I have a public key whose fingerprint is 0A5E 2BE6 6AD9 0D73 B963 6503 7350 1743 8F37 9CD5

To claim this, I am signing this object:

View archtimes.zsh-theme
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[grey]%}%n@%m%{$reset_color%}'
local user_symbol='$'
fi
View challenge1.exs
# Challenge 1: Given a list of integers, create a module that maps that list
# into different processes. Deliver to those processes the element and a
# function to be performed with it. This function can be anything, for
# instance: "Returns square of the number". Finally each process shoud send
# a message to the spawning process with the result.
defmodule Spawner do
@moduledoc """
Maps a list into processes performing a given function. Each one sends a
message to the spawning process, this one uses the IO module to print it out.
View pythagorean.exs
defmodule Triple do
def pythagorean(n) when n > 0 do
for a <- 1..n,
b <- 1..n,
c <- 1..n,
do: IO.puts "#{a} #{b} #{c}"
end
end
Triple.pythagorean(10)
View reduce.exs
defmodule Math do
def sum_list(list, accumulator \\ 0)
def sum_list([head | tail], accumulator) do
sum_list(tail, head + accumulator)
end
def sum_list([], accumulator) do
accumulator
end