Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mohammad Hadizadeh mohamm6d

🏠
Working from home
View GitHub Profile
@mohamm6d
mohamm6d / campaign.html
Created Apr 11, 2021
Campaign container with cookie-based password
View campaign.html
<!--- Starting april 2021 campaign container -->
<div id="campaign-container">
<img src="http://s.mmgo.io/t/CAm7" alt="motionmailapp.com" />
<div class="form-container">
Enter password for early-access to this campaign
<input type="password" placeholder="Enter password here" name="" id="campaign_password">
<button id="campaign_button">Let me in</button>
</div>
</div>
<style>
@mohamm6d
mohamm6d / shopify-tag-creator.php
Created Aug 19, 2020
This gist make tags for Shopify store based on variants
View shopify-tag-creator.php
<?
require_once dirname(__FILE__) . '/vendor/autoload.php';
class ShopifySdk
{
public function __construct()
{
$this->username = '';
$this->password = '';
@mohamm6d
mohamm6d / phpmyadmin_count_warning
Created Apr 28, 2020
Problem with phpMyAdmin and PHP. Warning in ./libraries/sql.lib.php#613 count()
View phpmyadmin_count_warning
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 / bash
Last active Apr 24, 2020
MYSQL Reset password ubuntu 20
View bash
sudo systemctl restart mysql
use mysql;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'username'@'localhost';
flush privileges;
View gist:1303c4d9932f637e87e4f3fde2795ce3
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 / uninstall Mysql Ubuntu
Created Apr 10, 2020
How to uninstall and re-install MySQL Ubuntu
View uninstall 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 / linux-essential-commands
Last active Mar 20, 2020
Linux Essential Commands
View 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 / post-receive
Created Mar 20, 2020
Sample of post-receive for Git repository
View post-receive
#!/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 / laravel-storage-error
Last active Mar 20, 2020
Installing Laravel Commands
View laravel-storage-error
cp .env.example .env
php artisan key:generate
php artisan migrate
sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache
View lamp.sh
#!/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