Skip to content

Instantly share code, notes, and snippets.

View kselax's full-sized avatar

Kselax kselax

View GitHub Profile
@kselax
kselax / testFinalClasses.php
Last active March 31, 2018 06:47
PHP OOP final classes and methods
<?php
echo "<p>Test final</p>";
// class couldn't be used like a parent class
final class A{
public function __construct(){
echo __CLASS__."<br>";
}
}
@kselax
kselax / case.sh
Last active April 26, 2018 10:52
shell script choose OS
#!/bin/bash
read -p "Plsease enter your OS (it could be Linux, Wndows, Mac, or what ever you want)? " OS
case "$OS" in
"Linux")
echo "Great choice"
echo "Here we are"
;;
"Windows")
@kselax
kselax / loop.sh
Created April 26, 2018 09:02
bash-loop
#!/bin/bash
for word in moose, cow, goose
do
echo I have a $word
done
@kselax
kselax / installer.sh
Created April 26, 2018 11:15
example for shell installer
#!/bin/bash
LIMIT=10
for((a=1; a <= LIMIT ; a++)) ; do
echo "$a"
done
MENU="1.install apache2
2.install php
@kselax
kselax / installer.sh
Created May 9, 2018 14:02
Install: 1. apache2; 2 mysql; 3.php5.6 php7; 4.phpmyadmin, 5.NVM
#!/bin/bash
G
#this script will install:
#apache2,
#mysql
#php5.6 and php7
EMPTY="#
#
#
@kselax
kselax / newvh.sh
Created May 10, 2018 13:36
shell script create folder in /var/www/ and add virtual host to apache2
#!/bin/bash
#this script will create virtual apahe host in
#folder /var/www/
#you should pass parameter site_name
#and will created folder /var/www/site_name
#and apache will configured serving this site
#set up site path
SITE_NAME=$1
@kselax
kselax / cpwp.sh
Created May 10, 2018 13:39
Shell script copy wordpress new latest wordpress site to your /var/www/
#!/bin/bash
#script will accept site domain_name and
#will copy lates version wordpress to
#/var/www/domain_name directory
#1 accept domain_name
#global varialbes
@kselax
kselax / rmvh.sh
Created May 10, 2018 14:37
Shell script that remove virtual hosts from apache2
#!/bin/bash
#script accept site name and remove folder from
#/var/www/site_name
#and virtualhost from apache2
SITE_NAME=$1
@kselax
kselax / set_key.sh
Last active May 12, 2018 14:26
shell script generates ssh key and places it to remote server
#!/bin/bash
#this script will generate sshkey and
#make connection to remote host and
#will put there this key
#parameters:
#set_key.sh [key_name]
@kselax
kselax / change_key.sh
Last active May 12, 2018 14:18
shell script generate new key and put on server instead old.
#!/bin/bash
#usage
#change_key.sh [new_key_name] [user_naem] [server_ip] [path_to_public_key]
#this script will generate sshkey and
#make connection to remote host and
#will put there this key
if [ $1 == "--help" ]; then