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 |
require 'openssl' | |
require 'base64' | |
# ===== \/ sign ===== | |
# generate keys | |
key = OpenSSL::PKey::EC.new("secp256k1") | |
key.generate_key | |
public_key = key.public_key | |
public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format |
defmodule Foo do | |
defmacro foo(do: block) do | |
quote do | |
res = unquote(block) | |
IO.inspect(res) | |
end | |
end | |
end | |
defmodule Use do |
Instructions on how to setup a secured Jenkins CI.
$ wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list$ .d/jenkins.list'
$ sudo apt-get update
$ sudo apt-get install jenkins
If you have multiple applications on Heroku and would like to use a single Logentries account for all of them, this is how you do it. Basically, do not use add-ons, and send all drains to your account.
Add Log
Manual
access.log
new
set named myapp-{environment}
, for instance myapp-staging
(at least, this is how I like to name my entries)Plain TCP, UDP - logs are sent via syslog
optionCreate Log Token
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]), |