.
:net_kernel.start([:"main@127.0.0.1"]) | |
:erlang.set_cookie(:cook) | |
{:ok, peer, peername} = | |
:peer.start(%{connection: 0, name: :peer, host: ~C'127.0.0.1'}) | |
:peer.call(peer, :erlang, :set_cookie, [:cook]) | |
Node.connect(peername) | |
# add code paths | |
:rpc.call(peername, :code, :add_paths, [:code.get_path()]) |
# ATTENTION: This is now supported in plug_cowboy as of 2.1.0: | |
# https://hexdocs.pm/plug_cowboy/Plug.Cowboy.Drainer.html | |
defmodule DrainStop do | |
@moduledoc """ | |
DrainStop Attempts to gracefully shutdown an endpoint when a normal shutdown | |
occurs. It first shuts down the acceptor, ensuring that no new requests can be | |
made. It then waits for all pending requests to complete. If the timeout | |
expires before this happens, it stops waiting, allowing the supervision tree | |
to continue its shutdown order. |
#!/usr/bin/env bash | |
set -x | |
term_handler() { | |
echo "Stopping the server process with PID $PID" | |
erl -noshell -name "term@127.0.0.1" -eval "rpc:call('app@127.0.0.1', init, stop, [])" -s init stop | |
echo "Stopped" | |
} | |
trap 'term_handler' TERM INT |
What do Tensorflow, Apache Airflow, Rule Engines, and Excel have in common?
Under the hood they all use DAGs to model data-flow dependencies of the program. Using graphs to model programs is great because you can modify the program at runtime. Lets talk about doing this in Elixir for great good.
UPDATED 3.12.2020
The old version of youtube with "disable_polymer" is not working anymore, so the script also stopped working.
Thanks to JanTheDeveloper we have a new working script. Big up!
I just changed the '//span[contains(text(),"Watch later")]',
to '//span[contains(text(),"Remove from")]',
and it should work for any playlist, not just the watch later one. (thanks to hudsonite for the tip)
setInterval(function () {
document.querySelector('#primary button[aria-label="Action menu"]').click();
- You can store a price in a floating point variable.
- All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
- All currencies are subdivided in decimal units (like dinar/fils)
- All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
- All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
- Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
- For any currency you can have a price of 1. (ZWL)
- Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
Just make Erlang to do some light-load task in a bunch of relatively short leaving processes. Calculating PI to 80th digit in batches per 10 procs with short, 8 ms, sleep in-between, to give schedulers a breath space, will do.
Run erl with 8 schedulers and no busy waiting on schedulers at all.
# file: code_lock.ex | |
# Translated from: http://erlang.org/doc/design_principles/statem.html#example-revisited | |
# callback mode: :handle_event_function | |
# | |
defmodule CodeLock do | |
@behaviour :gen_statem | |
@name :code_lock_2 | |
def start_link(code), | |
do: :gen_statem.start_link({:local, @name}, __MODULE__, code, []) |