Skip to content

Instantly share code, notes, and snippets.

View alihalabyah's full-sized avatar
🎯
Focusing

Ali Halabyah alihalabyah

🎯
Focusing
View GitHub Profile
@alihalabyah
alihalabyah / gist:e9d5cd077efb4b62cdd40bf4cf75c8ac
Created February 19, 2017 13:35
Magento 2 Reset Directories and Files Permissions
find . -type f -exec chmod 644 {} \; // 644 permission for files
find . -type d -exec chmod 755 {} \; // 755 permission for directory
find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chmod -R g+w *
nc -u -w 2 -v 159.89.213.212 13543
sudo ufw status
sudo ufw disable
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo iptables -L -n -v
sudo netstat -plutn
Problem description:
Write a method that takes in 2 parameters:
A string containing either "A" or "B" indicating the recipient of a bank transfer.
An integer array containing the amount for each of those transfers. So for instance, if the String is BA and the array is [1,2], it means A transfers 1 to B, then B transfers 2 to A.
This method should return what the initial balance for each bank account A and B need to be so that they never go into negative balance.
In the example above, it should return [1, 1].
Initial balance [1, 1].
A transfers 1 to B [0, 2].
B transfers 2 to A [2, 0].