How can I create an environment variable that contains the IP address of an adapter that is set via DHCP?

I am using docker and my scripts reference an environment variable that I’m manually setting in user’s foo account /etc/environment like:

SERVER_IP=172.16.16.29 

I’m using in my docker-compose file (which I’m running under as foo)

environment:   - ServerIP=$  {SERVER_IP} 

I would like to be able to have a variable DHCP_IP that will be populated when adapter enp0s3 has it’s IP address set so that I can use DHCP_IP in place of SERVER_IP in the docker-compose above.

I’m not concerned about the IP address changing often as I’m using MAC address filtering in my router to assign the same IP. But I don’t want to have to set the IP address manually in a file like I’m doing now.

So how can I put the value of the ip address of enp0s3 into a variable called DHCP_IP, and how can I reference that at the command line or in a file?

Or if you know of an alternative, I’m open to suggestions.

Is there any way to create a discount that only discounts one product in an order?

We have a Drupal 7 site using Commerce and Discounts and we need to create a discount that will discount one product in the order by 100%.

Basically, we need to give a coupon discount for ONE free product but so far we only see a way to discount ALL products on the order or the entire order.

We’ve tried Commerce Discount EXTRA (module) and it gets close by using the “Per Quantity Product Discount” but it forces you to select one specific product that the discount would apply to instead of ANY product.

So, does anyone know of a way to achieve creating a discount to only discount ONE of ANY product in an order?

How to calculate entropy of a symbol and entropy rate?

I’ve been stuck on this question from my text book for a while now:

A box contains 4 dice:

  • 2 fair 4-sided dice A and B: p(i) = 1/4 i={1, 2, 3, 4}
  • 1 loaded 4-sided dice C: p(2) = 1
  • 1 loaded 4-sided dice D: p(3) = 1

You pick one of the dice at random and throw it indefinitely. The sequence of throws can be modelled as the output of the source S = S1, S2, . . .

Calculate the entropy of a symbol H(S) and the entropy rate H*(S):

I know that the entropy of a symbol can be found using the equation:

  • H(S) = lim as n goes to infinity H(Sn)

and the entropy rate:

  • H*(S) = lim as n goes to infinity of H(S1,S2,…,Sn) / n

But I am still unsure on how to proceed though I have already calculated the probability P(S1,…,Sn).

Asymmetric Encryption + Signature workflow

Let´s say that Alice wants to send an encrypted message that only Bob can read, plus confirm that Alice is the person that wrote that message.

What is the procedure that will take place?

When I see digital signature workflow I always see that the message it´s transferred “clear” to the receiver (so Bob can hash the document in his side and compare it with the hash received by Alice), but the encrypted part (using Alice´s private key) is always the hash.

What happens when we want to encrypt also the message to a specific person? There will be a “second encryption” process, in which the message will be encrypted by Bob´s public key?

Just an example to confirm:

  • Alice produce digital signature: creates a hash of the document + encrypt it using her private key.

  • Alice encrypts the message itself: Takes the document and encrypt it using Bob´s public key (so only he can decrypt it, using his private key). (I guess that if the document is big can take a long time to finish the process, right?)

6$ Per Year SSD Shared Hosting* Unlimited Domains * cPanel/Cloudlinux/Softaculous * Instant Setup

SSD Shared Hosting from 6$ /Year | Reseller Hosting from 1.99$ /mo | cPanel/Softaculous

STALLION HOST cPanel shared hosting plans

Included With Every Shared Hosting Account

[-] cPanel/Cloudlinux
[-] Softaculous
[-] Free Migrations
[-] SEOTools/TrendySiteBuilder
[-] Spam Scan
[-] 99% Uptime Guaranteed
[-] Free…

6$ Per Year SSD Shared Hosting* Unlimited Domains * cPanel/Cloudlinux/Softaculous * Instant Setup

Partial sums of primes

$ 2+3+5+7+11+13…$ is clearly the sum of the primes.

Now i consider partial sums such:

$ 2+3+5+7+11=28$ which is divisible by $ 7$

My question is:

are there infinitely many partial sums such that:

$ p_1+p_2+p_3+…+p_{k}+p_{k+1}=m*p_{k}?$ with $ m$ some positive integer? With Pari/gp apparently up to 10^10 there are only two examples $ 7$ and $ 8263$ . Heuristically do you think that infinitely many such partial sums should exist?