- ruby -e “$(curl -fsSLĀ https://raw.githubusercontent.com/Homebrew/install/master/install)”
- brew install putty
- puttygen keyfile.ppk -O private-openssh -o keyfile.pem
- sudo chmod 0400 keyfile.pem
- ssh -i keyfile.pem user@ip
Reset git username password in mac os
git config --global --unset user.password
Upgrade mariadb 5.5 to 10.2 in centos 7
1. backup all databases first
2. service mariadb stop
3. yum remove mariadb mariadb-server
4. yum install vim epel-release -y
5. vim /etc/yum.repos.d/mariadb.repo
6.then paste this lines and save it :
# MariaDB 10.2 CentOS repository list - created 2018-02-15 08:21 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
7. yum install MariaDB-server MariaDB-client -y
8. systemctl enable mariadb
9. systemctl start mariadb
10. mysql_upgrade
.htaccess for remove index.php from url
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
.htaccess for Angular production build
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Remove SSL integration from a specific folder using .htaccess
Just add a condition to exclude the folder:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/folder
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
And if you wanted to redirect SSL requests to non-SSL forĀ /folder, then:
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/folder
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Switch Php version
sudo a2dismod php7.2
sudo a2enmod php5.6
sudo service apache2 restart
OR
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --set phar /usr/bin/phar5.6
sudo update-alternatives --set phar.phar /usr/bin/phar.phar5.6
sudo update-alternatives --set phpize /usr/bin/phpize5.6
sudo update-alternatives --set php-config /usr/bin/php-config5.6
SQL Query
SELECT column1, column2, ... FROM table_name LIMIT offset, count;
Mysql User Command
- DROP USER ‘username’@’localhost’;
- show databases;
- select User from mysql.user;
How to create a new user in mysql with all privileges
- mysql -u username -p then press enter
- type password
- CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;
- GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@’localhost’;
- FLUSH PRIVILEGES;