dnd 5e – What happens to a network with the infusion Returning Weapon Artificer after it was hit?

The 2019 UA Designer can infuse any simple or war weapon that has the "Thrown" feature with the "Recurring Weapons" infusion. The net is a ranged weapon with thrown property.

A returning net flies back into the hands of the creature that threw it, regardless of whether it hits or not. It is easy to imagine that the net will fly back to its launcher if it fails. But once it has held its target, I can not guess what will happen. Is it bringing his day back?

Ability to forward the IP and port address of the internal remote network to the same IP and port address on the local Mac

For development reasons, I want to connect my local computer (MacOS) to a remote private network of a Kafka / Zookeeper cluster.

If I do port forwarding with

ssh root@ -N -L

My Mac does not do this (probably for security reasons) and reports "Local redirect could not be requested."

If I just put it on localhost: 9029, the kafka broker can not find the other nodes in the private network because the broker's metadata points to the private network.

I also thought about running a local haproxy on and proxy TCP traffic to localhost on different ports, but no chance. It says "Can not bind socket ("

How can I tell on my local machine to point to a redirected port on the remote?

6.0 Marshmallow – Why is the network radio of an Android phone sporadically turned off?

I have an Android phone that has a problem that I suspect is related to the hardware. Randomly, the service stops working on the phone and I've just found a way to temporarily fix the problem by dialing *#*#4636#*#* and turn the radio back on manually. This restores functionality, but only temporarily. It seems indefinite when it will work again.

I can not think of a good way to pinpoint the problem, so any insight would be helpful

machine learning – neural network from scratch in Python

After seeing Week 5 of the machine learning course on Coursera by Andrew Ng, I decided to use Python to write a simple neural network from scratch. Here is my code:

import numpy as np
import csv
global e
global epsilon
global a
global lam
global itr
e = 2.718281828
epsilon = 0.12
a = 1
lam = 1
itr = 1000

# The sigmoid function(and its derivative)
def sigmoid(x, derivative=False):
    if derivative:
        return sigmoid(x) * (1 - sigmoid(x))
    return 1 / (1 + e**-x)

# The cost function
def J(X, theta1, theta2, y, lam, m):
    j = 0 
    for i in range(m):
        # The current case
        currX = X(i).reshape(X(i).shape(0), 1)
        z2 = theta1 @ currX
        a2 = sigmoid(z2)
        a2 = np.append((1), a2).reshape(a2.shape(0) + 1, 1)
        z3 = theta2 @ a2
        a3 = sigmoid(z3)
        j += sum(-y(i) * np.log(a3) - (1 - y(i)) * np.log(1 - a3)) / m + (lam / (2 * m)) * (sum(sum(theta1(:, 1:) ** 2)) + sum(sum(theta2(:, 1:) ** 2)))
    return j

# The gradients
def gradient(X, theta1, theta2, y, lam, m):
    theta1Grad = np.zeros(theta1.shape)
    theta2Grad = np.zeros(theta2.shape)
    Delta1 = np.zeros(theta1.shape)
    Delta2 = np.zeros(theta2.shape)
    for i in range(m):
        # The current case
        currX = X(i).reshape(X(i).shape(0), 1)
        z2 = theta1 @ currX
        a2 = sigmoid(z2)
        a2 = np.append((1), a2).reshape(a2.shape(0) + 1, 1)
        z3 = theta2 @ a2
        a3 = sigmoid(z3)
        delta3 = a3 - y(i)
        delta2 = theta2(:, 1:).T @ delta3 * sigmoid(z2, derivative=True)
        Delta1 += delta2 @ currX.reshape(1, -1)
        Delta2 += delta3 * a2.reshape(1, -1)
    theta1Grad = Delta1 / m
    theta2Grad = Delta2 / m
    theta1Grad(:, 1:) += (lam / m) * theta1(:, 1:)
    theta2Grad(:, 1:) += (lam / m) * theta2(:, 1:)
    thetaGrad = np.append(theta1Grad.reshape(theta1Grad.shape(0) * theta1Grad.shape(1), 1), theta2Grad.reshape(theta2Grad.shape(0) * theta2Grad.shape(1), 1))
    thetaGrad = thetaGrad.reshape(thetaGrad.shape(0), 1)
    return thetaGrad

# Gradient descent
def gradientDescent(X, theta1, theta2, y, lam, m):
    for i in range(itr):
        grad = gradient(X, theta1, theta2, y, lam, m)
        theta1Grad = grad(0:theta1.shape(0) * theta1.shape(1)).reshape(theta1.shape)
        theta2Grad = grad(theta1.shape(0) * theta1.shape(1):).reshape(theta2.shape)
        theta1 = theta1 - a * theta1Grad
        theta2 = theta2 - a * theta2Grad
    return (theta1, theta2)

with open('data.csv', 'r') as f:
    data = csv.reader(f)
    d = ()
    c = 0
    # Read the data
    for row in data:
        # Don't add the first line(it's our features' labels)
        if c == 0:
            c += 1
        curr_row = ()
        k = 0
        for j in row:
            if j != '':
                if k == 1:
                    # Add a 1 between the y and x values(for the bias)
                k += 1
    d = np.array(d)
    x = d(:, 1:)
    y = d(:, 0)
    # Split the data into training cases(80%) and test cases(20%)
    x_train = x(0:(d.shape(0)//5) * 4, :)
    y_train = y(0:(d.shape(0)//5) * 4)
    x_test = x((d.shape(0)//5) * 4 : d.shape(0), :)
    y_test = y((d.shape(0)//5) * 4 : d.shape(0))
    # Initialize theta(s)
    theta1 = np.random.rand(5, x(0).shape(0)) * 2 * epsilon - epsilon
    theta2 = np.random.rand(1, 6) * 2 * epsilon - epsilon
    print(J(x_train, theta1, theta2, y_train, lam, x_train.shape(0)))
    theta1, theta2 = gradientDescent(x_train, theta1, theta2, y_train, lam, x_train.shape(0))

Please note that my data has only 2 possible outputs, so no one-to-all classification is required.

Thank you in advance!

networking – Configure the network interface for IPoE on Linux

I have a small card with two ethernet ports. I want to configure the first port as a WAN port. For example, pfSense has a WAN port that connects to the Internet or home router.

My problem is that I connect to the Internet in my new house by plugging an Ethernet cable to the wall. No router was provided by the Internet service provider. I have my own TP-Link 600 router and connected to the WAN port and everything works fine.

As far as I know, my internet connection is IPoE. I guessed that by looking at the "WAN STATUS PAGE" router, which nicknamed the WAN connection ipoe_eth1_d (with a dynamic public IP, a gateway and no VPI / VCI)

How can I configure my Linux box nic to work just like the WAN port of my TP-Link router?

python – Network Programming – asynchronous single-threaded chat server with nicknames only

I'm starting to learn network programming. I've implemented a very simple TCP-based chat server, where users just have to provide the username.
The assumption is that the server does not use additional threads and does not block the sockets. The code:

import sys
import time
import socket
import select

class User:
    def __init__(self, name, sock):
        self.name = name
        self.sock = sock

class Server:
    def __init__(self, host, port):
        self.users = ()

        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.sock.bind((host, port))

    def accept_usr(self):
        usock, _ = self.sock.accept()
        usock.send(b"Please, choose your username: ")
        uname = usock.recv(1024)
        self.users.append(User(uname, usock))
        _, writes, _ = select.select((), self._usocks(), ())
        for w in writes:
            w.send(bytes(f"{uname} has joined us!", encoding="ascii"))

    def handlerr(self, errs):
        for s in errs:

    def update(self):
        reads, writes, errs = select.select((*self._usocks(), self.sock), self._usocks(), self._usocks())
        for r in reads:
            if r is self.sock:
                uname = (u for u in self.users if u.sock is u.sock)(0).name
                msg = r.recv(1024)
                for w in writes:
                    w.send(bytes(f"{uname}: {msg}", encoding="ascii"))

    def run(self):
        while 1:

    def _usocks(self):
        return (u.sock for u in self.users)

if __name__ == "__main__":
    s = Server("localhost", int(sys.argv(1)))

For hints and comments, I would be grateful.

One obvious improvement I can think of is storing the mapping of socket-> users in a dictation so that I can quickly determine the author of the sent message.