This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
difficulty 2 | |
description "You need to fix a bug in the version 1.2 of your app. Checkout the tag `v1.2`." | |
setup do | |
repo.init | |
FileUtils.touch("app.rb") | |
repo.add("app.rb") | |
repo.commit_all("Initial commit") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MasterProxy do | |
use Application | |
# See http://elixir-lang.org/docs/stable/elixir/Application.html | |
# for more information on OTP Applications | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
cowboy = Plug.Adapters.Cowboy.child_spec(:http, MasterProxy.Plug, []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sysctl -w fs.file-max=12000500 | |
sysctl -w fs.nr_open=20000500 | |
ulimit -n 4000000 | |
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000' | |
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384' | |
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384' | |
sysctl -w net.core.rmem_max=16384 | |
sysctl -w net.core.wmem_max=16384 | |
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
sudo dpkg -i erlang-solutions_1.0_all.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gazler@gazler-desktop-pc:~/development/pubsub_stress$ WS_CLIENTS=10000 PORT=4000 REMOTE_PORT=4002 MIX_ENV=prod mix phoenix.server | |
#PID<0.253.0>700 subscribers listening on "rooms:lobby" | |
{"Kernel pid terminated",application_controller,"{application_start_failure,pubsub_stress,{{shutdown,{failed_to_start_child,'Elixir.PubsubStress.WebSocketSimulator',{'EXIT',{undef,[{'Elixir.PubsubStress.WebSocketSimulator',start_link,[10000,<<\"4002\">>],[]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,314}]},{supervisor,start_children,3,[{file,\"supervisor.erl\"},{line,297}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,263}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,306}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,237}]}]}}}},{'Elixir.PubsubStress',start,[normal,[]]}}}"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
case Car.create(conn.assigns.user, params) do | |
{:ok, car} -> | |
conn | |
|> redirect(to: car) | |
{:error, changeset} -> | |
conn | |
|> render("new.html", changeset: changeset) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Authex.Mixfile do | |
use Mix.Project | |
def project do | |
[app: :authex, | |
version: "0.0.1", | |
elixir: "~> 1.0", | |
deps: deps] | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "Columns with pipes" do | |
result = Earmark.to_html(["a | b | c", "d | e \| f | g"]) | |
expected = """ | |
<table> | |
<colgroup> | |
<col align="left"> | |
<col align="left"> | |
<col align="left"> | |
</colgroup> | |
<tr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gazler@gazler-desktop-pc:~/development/elixir/elixir$ iex | |
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
Interactive Elixir (0.14.3) - press Ctrl+C to exit (type h() ENTER for help) | |
iex(1)> Regex.split(~r/(%{[^}]+})/, "%{foo}(%{bar}): %{baz}") | |
["", "%{foo}", "(", "%{bar}", "): ", "%{baz}", ""] | |
gazler@gazler-desktop-pc:~/development/elixir/elixir$ iex | |
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install -y wget unzip git make | |
RUN wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
RUN dpkg -i erlang-solutions_1.0_all.deb | |
RUN apt-get update | |
RUN apt-get -y install erlang |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem "rapidash" | |
gem "activesupport", "~>4.0.0" |