Skip to content

Instantly share code, notes, and snippets.

View mohamm6d's full-sized avatar
🤗

Mohammad Hadizadeh mohamm6d

🤗
View GitHub Profile
@mohamm6d
mohamm6d / countries_code.json
Created February 3, 2020 13:36
JSON: Countries list with ISO two-letter codes
[{"Code": "AF", "Name": "Afghanistan"},{"Code": "AX", "Name": "\u00c5land Islands"},{"Code": "AL", "Name": "Albania"},{"Code": "DZ", "Name": "Algeria"},{"Code": "AS", "Name": "American Samoa"},{"Code": "AD", "Name": "Andorra"},{"Code": "AO", "Name": "Angola"},{"Code": "AI", "Name": "Anguilla"},{"Code": "AQ", "Name": "Antarctica"},{"Code": "AG", "Name": "Antigua and Barbuda"},{"Code": "AR", "Name": "Argentina"},{"Code": "AM", "Name": "Armenia"},{"Code": "AW", "Name": "Aruba"},{"Code": "AU", "Name": "Australia"},{"Code": "AT", "Name": "Austria"},{"Code": "AZ", "Name": "Azerbaijan"},{"Code": "BS", "Name": "Bahamas"},{"Code": "BH", "Name": "Bahrain"},{"Code": "BD", "Name": "Bangladesh"},{"Code": "BB", "Name": "Barbados"},{"Code": "BY", "Name": "Belarus"},{"Code": "BE", "Name": "Belgium"},{"Code": "BZ", "Name": "Belize"},{"Code": "BJ", "Name": "Benin"},{"Code": "BM", "Name": "Bermuda"},{"Code": "BT", "Name": "Bhutan"},{"Code": "BO", "Name": "Bolivia, Plurinational State of"},{"Code": "BQ", "Name": "Bonaire, Sint E
#!/bin/sh
#######################################
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems.
# Written by @AamnahAkram from http://aamnah.com
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors.
#######################################
#COLORS
@mohamm6d
mohamm6d / laravel-storage-error
Last active March 20, 2020 08:19
Installing Laravel Commands
cp .env.example .env
php artisan key:generate
php artisan migrate
sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache
@mohamm6d
mohamm6d / post-receive
Created March 20, 2020 08:20
Sample of post-receive for Git repository
#!/bin/sh
echo "Starting deploying ..."
git --work-tree=/var/www/example.com/public_html --git-dir=git-server/example-com.git checkout -f
echo "Starting composer ... please wait"
composer install --working-dir=/var/www/example.com/public_html
echo "Composer done"
@mohamm6d
mohamm6d / linux-essential-commands
Last active March 20, 2020 08:23
Linux Essential Commands
#This is for when multiple packages are installed
sudo nano /etc/apt/sources.list
#Short open tag ubuntu
nano /etc/php.ini
#Install PHP extensions
sudo apt-get install php-mbstring php7.3-mbstring php-gettext libapache2-mod-php7.3
@mohamm6d
mohamm6d / uninstall Mysql Ubuntu
Created April 10, 2020 06:30
How to uninstall and re-install MySQL Ubuntu
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server
@mohamm6d
mohamm6d / gist:1303c4d9932f637e87e4f3fde2795ce3
Created April 13, 2020 06:14
Adding new user to SFTP bitnami
Create a new user in your system. This will create the directory /home/USERNAME/
sudo useradd -s /bin/bash -m USERNAME
Add USERNAME to the daemon groups
sudo usermod -G daemon USERNAME
Set the HOME environment variable for that user to the WordPress directory installation so when you SSH to your server using that USERNAME, it will be logged into that directory instead of /home/USERNAME. To do that, please add the following line at the end of the /home/USERNAME/.bashrc file
export HOME="/opt/bitnami/apps/wordpress/htdocs"
# Force moving to that new HOME directory
cd ${HOME}
Add the content of the user’s public key file to the /home/USERNAME/.ssh/authorized_keys file. In this example, the user’s public key is assumed to be in USERNAME.pub:
Copy
@mohamm6d
mohamm6d / bash
Last active April 24, 2020 18:06
MYSQL Reset password ubuntu 20
sudo systemctl restart mysql
use mysql;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'username'@'localhost';
flush privileges;
@mohamm6d
mohamm6d / phpmyadmin_count_warning
Created April 28, 2020 09:08
Problem with phpMyAdmin and PHP. Warning in ./libraries/sql.lib.php#613 count()
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
#Press CTRL + W and search for (count($analyzed_sql_results['select_expr'] == 1)
#Replace it with ((count($analyzed_sql_results['select_expr']) == 1) and save the file
@mohamm6d
mohamm6d / shopify-tag-creator.php
Created August 19, 2020 11:24
This gist make tags for Shopify store based on variants
<?
require_once dirname(__FILE__) . '/vendor/autoload.php';
class ShopifySdk
{
public function __construct()
{
$this->username = '';
$this->password = '';