local_req = Path.expand("~/dev/req")
Mix.install([
{:req, path: local_req}
])
defmodule Getn do | |
def getn(prompt, count \\ 1) do | |
if System.otp_release() >= "28" do | |
case :shell.start_interactive({:noshell, :raw}) do | |
:ok -> getn_raw(prompt, count) | |
_error -> gets_cooked(prompt) | |
end | |
else | |
gets_cooked(prompt) | |
end |
Mix.install([ | |
{:cubdb, "~> 2.0"} | |
]) | |
{:ok, _} = CubDB.start_link(data_dir: "./cubdb", name: DB) | |
defmodule CubQuery do | |
@moduledoc """ | |
Key and query utilities for CubDB | |
""" |
Mix.install([ | |
{:finch, path: "./finch"}, | |
{:benchee, "~> 1.1.0"}, | |
{:bandit, "~> 1.0.0-pre.5"}, | |
{:plug, "~> 1.14.2"} | |
]) | |
defmodule PlugServer do | |
import Plug.Conn |
# Usage: open some_file.html | |
# Open a file in browser | |
function open () { | |
explorer.exe $(wslpath -w $(realpath $1)) | |
return 0 | |
} |
The default eth0
network interface on WSL2 has an MTU of 1280, which isn't sufficient for large packets sent over the Wireguard protocol.
You can confirm the issue by running ip a
and seeing that the MTU of the eth0
interface is 1280.
To fix this, you need to set the MTU of the eth0
interface to 1500. This has to be done every time WSL starts.
Edit /etc/wsl.conf
to include:
[boot]
Update 12/18/22: "Part 2" notes/changes added at the bottom.
Based on this post by Peter Ullrich, adapted to use the experimental Janus authorization library.
I've been working on an experimental authorization library over the last few days, and so was pleasantly surprised when Peter posted about building a Role and Permission System. I jumped at the opportunity to see how Janus could "slot in" to the architecture that he presented.
defmodule MediaPlayer.AutoplayNext do | |
@moduledoc """ | |
Helper statechart used to check whether the song is ending and communicate back to | |
the parent. | |
""" | |
use Protean | |
alias Protean.Action | |
alias LiveBeats.MediaLibrary |