Probability simulation variations and variables?

This is really nerdy, but I need help interpreting code I found online (https://pastebin.com/MkyDbtj7).

I am an avid Magic: The Gathering player and also an electrical engineering student. I was thrilled to find code for mana calculations online, but had trouble reading the code. What variables do I need to change to get the results in the second and third tables shown here?

Thank you very much!

8 – Is it possible to pass variables as arguments to * .libraries.yml?

Suppose I have defined a foo.libraries.yml as follows:

external.bc.js:
  version: 1.x
  js:
    //players.brightcove.net/{{variable here}}/{{variable here}}/index.min.js: { type: external, minified: true}

Where {{ variable here }} Here I want to insert values ​​when I attach the library

Then in one hook_ENTITY_TYPE_view() I run:

$build('#attached')('library')() = 'brightcove/external.bc.js';

At this point I would also like to pass these variables. Is that possible?

mysql – delete a row with 2 variables with limit from the table

I am developing a PHP script that stores the user's session in a database.

If a user logs out of the server, remove only one line (since the same user can log in more than once).

When the server restarts, remove all user sessions from this server with the same IP address.

  • Table name:
  • Column in table:
    • ID (int, autoincrement, 11)
    • Serverip (Mediumint)
    • User ID (text)

Run on:

mysql  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1

The query runs correctly but does not delete anything.

    elseif ($_GET('status') == "logout"){
        $sql = "DELETE FROM totalconcurrent WHERE (serverip,userid) IN ((INET_ATON('".get_server_ip()."'),'".$_GET('id')."')) LIMIT 1;";
        if ($conn->query($sql) === TRUE) {
            echo "1 Session of ".$_GET('id')." removed";
        } else {
            echo "Error: " . $sql . "
" . $conn->error; } }

The query runs correctly but does not delete anything.

    elseif ($_GET('status') == "reboot"){
        $sql = "DELETE FROM totalconcurrent WHERE serverip IN ((INET_ATON('".get_server_ip()."')));";

        if ($conn->query($sql) === TRUE) {
            echo "Server rebooted, removed all session stored in this server";
        } else {
            echo "Error: " . $sql . "
" . $conn->error; } }

I have tried many times and many types of queries to do this without finding the right way to do it.

What questions do I need?

In local memory variables (Javascript), OAuth token memory and XSS

Quote from a long-deceased Auth0 forum post: https://community.auth0.com/t/why-is-storing-tokens-in-memory-recommended/17742

"All the values ​​stored in memory are still vulnerable to XSS attacks since then
They are accessible via JavaScript. I Agree?

I Agree. The main difference is that localStorage makes it even easier
enumerate the contents. The only point is to avoid an animal
Force XSS attacks to put your localStorage anywhere
otherwise it could be allowed to be used for shameful purposes. Save in
Memory just makes it so that someone has to go through the extra effort of
target your app. But yes, memory is still fragile
to XSS attacks. "

I do not get it

My javascript is rusted, but I'm trying to turn off a quick redirect_uri implementation:

// https: // localhost / redirect.html # access_token = 123


// my library.js

function APICaller(token) {

   var private_static_token = token; // HOW CAN XSS GET HOLD OF THIS?

   APICaller.overlySimpleGet = async function(url) {
     return fetch(encodeURI(url), {
       method: 'GET',
         headers: { 'Authorization': 'Bearer ' + private_static_token },
       })
       .then(response => response.json());
   }
}

// app code (imported library.js)

APICaller.overlySimpleGet("https://localhost/apiresponse.json")
   .then((json) => console.log(json));

Given the first statement in the forum post:

"Saving in memory only means that someone has to go through them
additional effort for the targeted alignment of your app. But yes, memory is
still vulnerable to XSS attacks "

How is the value of private_static_token vulnerable to XSS?

If your redirect_uri page has an XSS vulnerability, it seems a much easier option for the attacker to only read the token if the page loads before it even gets to your local variable.
And that could be an untargeted attack.

Side note:

It seems to me that there is really only one good way to save tokens – an httponly / Secure / Samesite = strict cookie with CSRF protection that only works if you have a backend.

The other browser storage options can all be compromised by XSS with varying degrees of effort, so that they have a strict content security policy in place.
(So ​​I wonder why implicit OAuth flows don't support both cookies and headers, but there's no doubt a good / practical reason why I can't think of atm.)

cv.complex variables – Bromwich integral that has been converted to an integral on the real axis

I am new to complex integration and inverse Laplace transformations. I've already asked this question on math.se, but I haven't received an answer.

The author of a textbook claims that the inverse Laplace transform has expression
$$
f (t) = frac {2 exp (bt)} { pi} int_0 ^ infty Re bigl ( hat {f} (b + iu) bigr) cos (ut) , mathrm {d} u.
$$

He gets this formula by replacing it $ s = b + iu $ in the Bromwich integral
$$
f (t) = frac {1} {2 pi i} int_ {bi infty} ^ {b + i infty} exp (st) hat {f} (s) , mathrm {d } s.
$$

However, I've checked this formula numerically and it doesn't seem to apply:

fhat <- function(s) 1/(s+3) # Laplace transform of exp(-3x)
b <- 5 
integrand <- function(u, x){
  Re(fhat(b+1i*u))*cos(x*u)
}
x <- 2 
2*exp(b*x)/pi * integrate(integrand, 0, Inf, x = x, subdivisions = 10000)$value
# -0.1124648
exp(-3*x)
# 0.002478752

To the $ b = -2 $ The result is close to the expected value $ exp (-3x) $::

b <- -2
2*exp(b*x)/pi * integrate(integrand, 0, Inf, x = x, subdivisions = 10000)$value
# 0.002479138

I got that $ b $ must be chosen somewhere to the right of the singularities of $ has {f} $ (Here $ -3 $). Am I wrong? Here the result depends on the choice $ b $, Do I get something wrong or is something wrong in this textbook?

cv.complex variables – Another type of imaginary number

 The imaginary number i (i^2 = -1) has proven not only to be a source of much theoretical math but also to be useful in the sciences and engineering.  Another type of imaginary number is j (the number whose logarithm is -1: e^j = -1); has the mathematics of this concept been explored?  Does the concept of a complex number, a + jb, or e^(a + jb), make any sense in this context?

Function and variables

Create a function in which the required relative errors of variables are calculated for entered functions with 3 variables, values ​​of variables and relative function errors.
Can anyone give me an idea how to start?
Thank you very much.

Functions – Variables are not shown in the function code

I'm creating a shortcode that requires the use of two different variables $banner and $banner__feature, I know the variables are correct and working because I tested them in another template file that I created.
As for the function code, only the HTML code from the website is displayed, not the variables. I don't know what I'm doing wrong here and I need the variables to show.

$banner = esc_url( get_stylesheet_directory_uri() . '/images/banner.jpg' );

$banner__feature = esc_url( get_stylesheet_directory_uri() . '/images/banner__feature--easter.jpg' );

function banner_shortcode() {

return '';

}
add_shortcode( 'banner', 'banner_shortcode' );

Command Line – How do I create and assign persistent global system-wide variables like $ Home in Powershell?

I'm just starting to learn powershell and one thing is getting annoying.

The undesirable and unfair distinction between $env:Home and $HOME, While $ HOME can be completed automatically by entering $ hom> Tab, we have to enter $ env: Ho> Tab for the counterpart.

I have the idea that $HOME This is a kind of global variable that persists in every powershell session even after the system is restarted.

So the question: How do I create such persistent and global variables and assign values ​​either from the command output or the environment variable output or the direct path of the directory / file?