To generate a private / public RSA key pair, you can either use openssl, like so:
$ openssl genrsa -out private.pem 4096
$ openssl rsa -in private.pem -outform PEM -pubout -out public.pem Or, you can use the following python script:
| defmodule TravelerWeb.SearchbarLive do | |
| use TravelerWeb, :live_view | |
| alias Phoenix.LiveView.JS | |
| alias Traveler.Places | |
| def mount(_params, _session, socket) do | |
| socket = assign(socket, places: []) | |
| {:ok, socket, layout: false} | |
| end |
| defmodule Foo do | |
| defmacro foo(do: block) do | |
| quote do | |
| res = unquote(block) | |
| IO.inspect(res) | |
| end | |
| end | |
| end | |
| defmodule Use do |
| defmodule MyApp.Worker do | |
| use GenServer | |
| # api | |
| @spec start_link(worker_id :: String.t()) :: GenServer.on_start() | |
| def start_link(worker_id) do | |
| GenServer.start_link(__MODULE__, [worker_id], name: via_tuple(worker_id)) | |
| end |
| -module(dvvset_test). | |
| -export([main/0]). | |
| %% NOTE: we always generate a new client ID to enforce consistency. | |
| main() -> | |
| %% client 1 write | |
| Dot0 = dvvset:update(dvvset:new("value-0"), generate_id()), | |
| %% server |
| -module(kv_bench). | |
| -compile([export_all]). | |
| main(Count) -> | |
| Values = lists:foldl(fun(C, Acc) -> | |
| [{C, {v, C}} | Acc] | |
| end, [], lists:seq(1, Count)), | |
| {TimeDict, ResultDict} = timer:tc(?MODULE, get_last_dict, [Count, Values]), |
| -module(list_bench). | |
| -compile([export_all]). | |
| main(Count) -> | |
| Values = lists:foldl(fun(C, Acc) -> | |
| [C, C, C, C, C, C, C, C, C, C | Acc] | |
| end, [], lists:seq(1, Count)), | |
| {TimeDict0, ResultDict} = timer:tc(?MODULE, count_dict, [Values]), |
| # download erlang 19: <http://erlang.org/download/otp_src_19.3.tar.gz> & untar | |
| # download patch: <https://github.com/erlang/otp/commit/a64c4d806fa54848c35632114585ad82b98712e8.diff> | |
| # apply patch | |
| patch < a64c4d806fa54848c35632114585ad82b98712e8.diff | |
| # ensure that openssl is installed in [email protected]/{version} | |
| brew install openssl | |
| # compile |
| Program: /Users/roberto/workspace/intellij_run_cmd | |
| Arguments: "mix test $FilePathRelativeToProjectRoot$:$SelectionEndLine$" |
| require 'find' | |
| biggest_file_by_ext = {} | |
| Find.find('.') do |path| | |
| next if File.directory?(path) | |
| # get file info | |
| ext = File.extname(path) | |
| next unless ext.length > 0 | |
| # get file size | |
| size = File.size(path) |