Skip to content

Instantly share code, notes, and snippets.

View msanjaypandit's full-sized avatar

Sanjay Chaturvedi msanjaypandit

View GitHub Profile
@msanjaypandit
msanjaypandit / virtual-host-centos.md
Last active March 8, 2018 09:59
[Virtual host on centos] #lamp #centos #virtual-host #subdomain #configuration

Ubuntu

You may be using a ubuntu machine or you are creating virtual host on ubuntu server. Open terminal using ctrl+alt+T in ubuntu, putty on windows. Connect with ssh if you are going to creating virtual host on ubuntu server.

  1. sudo apt-get update (it will update all libraries)
  2. cd /var/www (Move to www path)
  3. sudo mkdir -p example1.com/public_html (it will create both directory example1.com and example1.com/public_html)
  4. sudo mkdir -p example2.com/public_html (it will create both directory example2.com and example2.com/public_html)
  5. cd /etc/apache2/sites-available/
@msanjaypandit
msanjaypandit / jquery-libraries.md
Last active March 8, 2018 09:17
[jquery Libraries] #jquery #javascript #equal-height #Responsive
@msanjaypandit
msanjaypandit / lamp-centos.md
Last active April 27, 2018 06:16
[LAMP on AMI] #AMI #AWS #EC-2 #Lamp #centos
  1. Clink on launch a virtual machine
  2. Select "Amazon Linux 2 LTS Candidate AMI 2017.12.0" A latest Amazon linux candidate 64 bit.
  3. Select "t2.micro" as Free tire instance.
  4. select auto option "Configure Instance Details"
  5. insert 30GB as storage.
  6. Create security group and assign port.
  7. click on launch using a new key pair (Remember you need to put .pem file at secure place.)
  8. Now your instance is ready.
  9. ssh -i /web/KP-EC2.pem [email protected]
  10. sudo yum update -y
@msanjaypandit
msanjaypandit / aws-cli.md
Last active March 29, 2018 05:18
[AWS CLI] #aws-cli #aws #cli #a3

Aws cli configuration

AWS Access Key ID [None]: YOURKEY
AWS Secret Access Key [None]: YOURSECRETKEY
Default region name [None]: us-west-2
Default output format [None]: json

Space in S3 Bucket
aws s3api --profile PROFILE_NAME list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]" | awk 'NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"}'

@msanjaypandit
msanjaypandit / php-security.md
Last active March 4, 2022 19:55
[PHP-Security] #PHP #Security

PHP-Security

you are uploading the file use below code.

$file = basename(realpath($_GET['file']));

Avoid using mysql(i)_ extensions use PDO

filter_var($_REQUEST['search'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);