This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/bin/bash | |
mkdir -p ~/var/lib/mariadb | |
docker pull mariadb | |
docker run --name mariadb-local -p 3306 -v ~/var/lib/mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mariadb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* UK Postcode Pattern | |
* < Outward Code > < Inward Code> | |
* <AREA><DISTRICT> <SECTOR><UNIT> | |
* AREA = 1 or 2 chars | |
* DISTRICT = (one or 2 digits) or (digit then letter) | |
* Space (optional) | |
* SECTOR = digit | |
* UNIT = 2 chars | |
* | |
* $postcode_regex = '/^([A-Z]{1,2})([0-9]{1,2}|[0-9][A-Z])\s?([0-9])([A-Z]{2})$/i'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to .bashrc or .profile | |
# auto complete for ssh and scp | |
complete -o default -o nospace -W "$(grep -e 'Host[^N]' ~/.ssh/config | awk '{print substr($0, index($0,$2))}' ORS=' ')" scp sftp ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# expired MySQL password | |
systemctl stop mysqld | |
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" | |
systemctl start mysqld | |
# login to the console and change the password | |
mysql -u root | |
UPDATE mysql.user SET authentication_string = PASSWORD('password123') WHERE User = 'root' AND Host = 'localhost'; | |
FLUSH PRIVILEGES; | |
-- set passwords to never expire (optional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "creating folders 00 to 99" | |
mkdir $(seq -w 00 99) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum -y update | |
yum -y install yum-utils bc | |
# start from a clean install | |
# centos 7 may have some mariadb libs which cause clashes | |
yum remove -y maria* | |
yum clean | |
# install mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing mysql 5.7 on centos 6 | |
1. download yum repo | |
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm | |
2. install yum repo | |
yum -y localinstall mysql57-community-release-el6-7.noarch.rpm | |
3. verify yum repo | |
yum repolist enabled | grep "mysql.*-community.*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#update the server | |
echo "updating server, this might take some time ..." | |
sudo yum update -y | |
#install apache, php and mysql | |
echo "installing apache, php and mysql .." | |
sudo yum install -y httpd24 php56 mysql56-server php56-pdo php56-mysqlnd |