command line – Recursively moving files up one level

When exporting from Apple Photos with settings that preserve the album & folder structure, every album folder contains dated folders for every date represented in that album, with the actual images inside those. An example export for this question gives this structure…

Export/
    Colour/
        11 November 2005/
            img_0440.jpg
        13 November 2005/
            pb130006_1_1.jpg
    Life/
        Creatures/
            12 November 2005/
                img_0453.jpg
        People/
            9 November 2005/
                img_0174.jpg
            10 November 2005/
                img_0181.jpg
            14 November 2005/
                pb140009.jpg
        Plants/
            10 November 2005/
                img_0404.jpg
                img_0408.jpg
            13 November 2005/
                img_0477.jpg
            14 November 2005/
                img_0625.jpg

What can I at the command line to traverse the contents of Export & move all found files up one directory level?

The desired result on my example would be…

Export/
    Colour/
        img_0440.jpg
        pb130006_1_1.jpg
    Life/
        Creatures/
            img_0453.jpg
        People/
            img_0174.jpg
            img_0181.jpg
            pb140009.jpg
        Plants/
            img_0404.jpg
            img_0408.jpg
            img_0477.jpg
            img_0625.jpg

A solution that works in bash, because I do a lot of my CL stuff in BBEdit which is bash only, or fish because that’s my preferred shell in Terminal, would be preferred, but I’ll work with other shells.

dnd 5e – For the Fey Touched and Shadow Touched feats, what exactly does “spell slots […] of the appropriate level” mean?

“Appropriate level” means one with which the spell could normally be cast

The relevant quote from the new Fey Touched and Shadow Touched feats is (TCoE, p. 79-80):

You can also cast these spells using spell slots you have of the appropriate level.

In this case, the phrase “spell slots (…) of the appropriate level” means you can cast the spells using any slots that would normally be appropriate for you to cast the spells with. There is no ambiguity here, as “spell slots” is plural modifying the subject to which the “of the appropriate level” applies to to be the totality of the spell slots you have.

So you can use the base spell slot level of the spell, or you can opt to use a higher-level spell slot as outlined in the PHB rules:

When a character casts a spell, he or she expends a slot of that spell’s level or higher, effectively “filling” a slot with the spell.

So, at a minimum you have to use a slot of the spell’s level, but are free to use a higher one.


Is the word “the” not intended to restrict it to only using a single slot level (the base level)?

If the feature was intended to only allow the spells to be cast at the base level, the wording would need to be “You can also cast these spells using a spell slot you have at the base level of the spell.” or “You can cast these spells using appropriate spell slots, but only at their base level.”


What about the Artificer Initiate feat?

One of the other points raised is that in another feat in the same book, Artificer Initiate (p. 79), the corresponding part of the description says:

You can also cast the spell using any spell slots you have.

Here, it is unambiguous that you can cast using higher-level spell slots. So does this mean the text for the Fey Touched and Shadow Touched feats was intentional to prevent being able to use “any slots”?

There is a significant difference between the Artificer Initiate feat and the Fey/Shadow Touched feats. The Artificer Initiate feat only allows you to learn 1st level spells, whereas the Fey/Shadow Touched feats allow for 2nd level spells as well (e.g. misty step). Given that 5e is explicitly an exceptions-based game (via the “specific beats general” principle), if the same wording were used on the Fey Touched and Shadow Touched feats, it would create an exception allowing the 2nd-level misty step to be cast using a 1st-level slot (given that 1st-level is a valid choice from “any” spell slots, but not from the “appropriate” spell slots).

It’s also worth considering, that not all feats (or indeed features) are written by the same writer, and given that 5e is written using natural language, as opposed to strictly defined and interpreted language. There are multiple ways to convey the same meaning using natural language. As a result, trying to put two features side-by-side and using one feature to try disprove a feature application in the other due to wording differences won’t be appropriate in most cases.

❕NEWS – Bitcoin runs to the highest level ever: more than doubled in value since the beginning of the year | Proxies123.com

Bitcoin, in the last month has made a leap of more than 50% (This thanks to PayPal that has entered payments also in cryptocurrencies). A further 15% increase, only in the last week. And totally, since the beginning of the year, it’s revaluation exceeds 150%!
For Bitcoin it seems to have really gone back three years, when the most well-known cryptocurrency in the world, in the autumn accelerated an “endless race”, reaching its never-reached peak, close to $ 20,000!
And the future predictions inherent to Bitcoin, still continue to be optimistic!

New “Touched” feats, what exactly does ‘appropriate level mean?

So in our RPG group there is a difference in opinion on what ‘appropriate level’ actually means in the context of the spell.

One interpretation means you can’t cast invisibility or Misty step with a first level spell slot.

The second interpretation means you can’t cast the chosen first level spell at higher spell slot levels.

Which interpretation is correct?

architecture – What is right level of event aggregator

Recently I had conversation with colleague, who proposed that whole app could be driven through event aggregator (or message bus).

I think this is really good pattern if someone wants to decouple publisher and subscriber, especially in cases where we have multiple publishers/subscribers. If there is just one, I think it is perfectly fine to request service from DI and call method on it, not really a need for event aggregator (but it is fine IMO). Also if there is request – response, there is not really and event, and maybe someone should use other patterns (i.e. observer pattern?).

However my colleague proposed something much more “drastic” – tunneling whole app communication through event aggregator. For instance when UI wants to know something from DomainEntity it would create event RequestSomethingFromDomainEntity(id: 37), Then domain entity would respond with SomethingFromDomainEntity(id: 37, data: data()).

I see following pros:

  • Such classes are super easy to test, you just generate events
  • Basically everything is decoupled from everything (at least semantically)
  • Implementing business rules is super easy, because interactor classes need only access to event aggregator

And following cons:

  • you do not really know what events class may expect or produce
  • someone cannot really tell anymore who talks to who in app, because everything has dependency on event aggregator and anything can handle messages
  • I image it is really hard to debug

My questions are:

  • Can someone who worked in this style share his thoughts?
  • Are there any other pros/cons?
  • Do pros outweighs cons?

dnd 5e – Why do level 4 and 5 Druid spells seem to change tone?

I am playing a Druid for the first time (D&D 5e) and am quite enjoying it. My character recently hit level 9, and I noticed that the 4th and 5th level spells seem to shift in tone dramatically from earlier levels.

While lower level spells seem to emphasize beasts and nature thematically, the higher level spells seem to shift toward elementals and life force / necromancy style spells. Is there a reason for this?

In other words, is there lore behind the shift in tone and theme?

Or is there a tactical reason for this shift?

Or am I imagining things?

beginner – Google foobar level 2 challenge

I am a beginner in Python-3. I was solving a level 2 challenge in Google Foobar. Given an initial amount of items (LAMBs) I have to distribute it among individuals, who are ranked according to seniority, while adhering to the following rules:

  1. The junior most individual gets 1 Lamb
  2. An immediately senior individual can’t get more than twice their juniors lambs, otherwise the junior will rebel
  3. A senior individual can’t get less lambs than the sum of their 2 previous juniors, otherwise the senior will rebel
  4. In case lambs are leftover and adding a senior does not violate any previous rules, they must be added.

The goal is to find the difference between how many individuals can be paid if we pay the minimum amount to each (stingy) and the maximum amount to each (generous). I noticed that stingy condition resembles a Fibonacci sequence and the generous condition is sum of powers of 2. My code is as follows:

from math import log2

def solution(total_lambs)
    return (stingy(total_lambs) - generous(total_lambs))

def stingy(total_lambs)
    if (total_lambs == 1): # from condition 1 at least 1 individual gets paid
        return 1
    elif (total_lambs == 2): # from condition 2 and 4 the most each can is 1
        return 2
    else:
        ind, total, x0, x1 = 2, 2, 1, 1 # no. individuals, sum of Fib seq, intial Fib nos.
        while (total <= total_lambs):
            x0, x1 = x1, x0 + x1 # advancing the Fib seq
            total = total + x1 # total is the sum of lambs paid
            if (total > total_lambs): 
                return ind
            else:
                ind = ind + 1

def generous(total_lambs):
    if (total_lambs == 1):
        return 1
    if (total_lambs == 2):
        return 2
    else:
        ind = int(log2(capital + 1)) # typecasting to int removes decimals
        if (total_lambs - 2**n + 1 >= 2**(n - 1) + 2**(n - 2)): # condition 2, 3 and 4 
            return ind + 1
        else:
            return ind

Please suggest improvements wherever possible.

server – XSS on marketing websites like craigslist. How does this work on a technical level?

I was wondering how this works.
We have a marketing site in Holland where people can sell second hand goods.
Rumor goes that there is a lot of phishing going on there and XSS code is used in the images that are uploaded to the site for malicious intent.

Can someone explain to me how this works and how people can stay out of trouble?
I have some theoretical understanding of protocols and scripting.
Examples or 3rd party source for clarification are most appreciated.

Hi, I invited 4 people through the link and they registered. But in the INVITE LEVEL 1 COMPLETED section Not added. Why?

I invited 4 people through the link and they registered.
But in the INVITE LEVEL 1 COMPLETED section
Not added. Why?

unity – How do I storing a Score in each level?

I have a problem when I store the DistanceScore to text, the problem is why the DistanceScore always storing at text number 1, this happens when I play at level 2 which is the DistanceScore could be store in text number 2and so on, FYI I have 3 levels here.

here the preview
enter image description here

enter image description here

I played level 2 and decide to defeat for knowing the distance

as you can see on the top of level 2 gameplay is distance so when i dead the distance saved and storing to text each level.

enter image description here

and when I go to the main menu the Level 1text updated instead of Level 2.

this is my script:

public Item() _item;

public int mapIndex;

public enum ITEM_TYPE
{
    LEVEL
}

public ITEM_TYPE _type;

private void Start()
{
    loadItemInformation();
}

public void loadItemInformation()
{
    for (int i = 0; i < _item.Length; i++)
    {
        if (_type == ITEM_TYPE.LEVEL)
        {
            _item(i).bestScore.enabled = true;
            _item(i).distance.enabled = true;

            float distanceUi = PlayerPrefs.GetFloat("distance" + i.ToString());
            float value = PlayerPrefs.GetFloat("Time" + i.ToString());
            float minutes = Mathf.FloorToInt(value / 60);
            float seconds = Mathf.FloorToInt(value % 60);

            if (value == 0)
            {
                _item(i).bestScore.text = "No Record Yet";
            }

            else
            {
                _item(i).distance.text = "Unstopable ";
                _item(i).bestScore.text = "Best Time = " + string.Format("{0:00}:{1:00}", minutes, seconds);
            }

            _item(i).distance.text = "Long distance = " + distanceUi.ToString();
            

        }
    }
}

}

    (System.Serializable)
    public class Item
    {
        public TextMeshProUGUI bestScore;
        public TextMeshProUGUI distance;
    }

here the distance script:

#region Distance
(Header("Distance"))
public Transform checkPoint;
public TextMeshProUGUI distanceText;
M_GameManager _GameManager;
private float distance;
private float highDistance;
float index;
#endregion


private void Start()
{
    _GameManager = FindObjectOfType<M_GameManager>();
    checkPoint = GameObject.FindGameObjectWithTag("Finish").transform;
    distanceText = GameObject.FindGameObjectWithTag("DistanceTxt").GetComponent<TextMeshProUGUI>();
    index = (float)(PlayerPrefs.GetInt("Level"));// typo here i call it set and now I've fix it
}
index = PlayerPrefs.GetFloat("Level");
distance = (checkPoint.transform.position.x - transform.position.x);
    if (transform.position.x > checkPoint.transform.position.x)
    {
        distance = 0;
        //PlayerPrefs.SetFloat("distance" + index, distance);
    }
    if (_GameManager.isDead || _GameManager.isTimeout || _GameManager.fuelFinished)
    {
        PlayerPrefs.SetFloat("distance" + index, distance);
        PlayerPrefs.Save();
    }
    distanceText.text = distance.ToString("F1") + "m";

and for _item(i).bestScore.text this work to storing each level but why for the distance not working.