Skip to content

Instantly share code, notes, and snippets.

Ali Halabyah alihalabyah

Block or report user

Report or block alihalabyah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View UFW Setup
sudo ufw status
sudo ufw disable
sudo ufw default deny incoming
sudo ufw default allow outgoing
@alihalabyah
alihalabyah / gist:e9d5cd077efb4b62cdd40bf4cf75c8ac
Created Feb 19, 2017
Magento 2 Reset Directories and Files Permissions
View gist:e9d5cd077efb4b62cdd40bf4cf75c8ac
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 *
View gist:8a7ac8054ad706094cd7d0e0bed25c18
$store = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore();
$imageUrl = $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();
@alihalabyah
alihalabyah / gist:284c7be1419568b350e2
Created Nov 6, 2015
Read & Write Access to Group
View gist:284c7be1419568b350e2
# First of all make sure that the user is added to the group (the group name here is www-data)
sudo usermod -a -G www-data <some_user>
# Then change the group of the directory
sudo chgrp -R www-data /var/www
# Finally, give group write permissions
sudo chmod -R g+w /var/www
View gist:51d4a9372dcaf31ae474
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
## add .DS_Store to .gitignore
git add .gitignore
git commit -m '.DS_Store banished!'
View gist:69a39841b5c49d093957
LOAD DATA INFILE 'file.csv' INTO TABLE table_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(col_name);
@alihalabyah
alihalabyah / gist:b981ae29b0c948ff26d1
Created Apr 8, 2015
How to reset git remote changes
View gist:b981ae29b0c948ff26d1
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master
@alihalabyah
alihalabyah / gist:d831d1fbb89e2cf87fef
Created Apr 8, 2015
Github mirror Bitbucket or vice versa
View gist:d831d1fbb89e2cf87fef
git remote add bitbucket /url/to/am/empty/bitbucket/repo
git push --mirror bitbucket
You can’t perform that action at this time.