View Firewall rules and running processes
sudo iptables -L -n -v | |
sudo netstat -plutn |
View UFW Setup
sudo ufw status | |
sudo ufw disable | |
sudo ufw default deny incoming | |
sudo ufw default allow outgoing | |
View gist:d68d615b3f7ef3f67c09dd624f094644
nc -u -w 2 -v 159.89.213.212 13543 |
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(); |
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); |
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 |
View gist:d831d1fbb89e2cf87fef
git remote add bitbucket /url/to/am/empty/bitbucket/repo | |
git push --mirror bitbucket |
NewerOlder