Skip to content

Instantly share code, notes, and snippets.

View msanjaypandit's full-sized avatar

Sanjay Chaturvedi msanjaypandit

View GitHub Profile
@msanjaypandit
msanjaypandit / php-codes1.md
Last active March 7, 2018 09:23
[PHP Codes] #php #php-log-file #errors #php-file-write

Generate PHP Error on a Specific IP Generate PHP Errors on a Specific IP

if($_SERVER["REMOTE_ADDR"] =='xxx.xxxx.xxx.xxx'){
  error_reporting(E_ALL);
	ini_set('display_errors','Off');
	ini_set("log_errors", 1);
	ini_set("error_log", "Your Error log path");
  # Your Error log path e.g "D:/xampp/htdocs/live/errors/lservererror.html"
}
@msanjaypandit
msanjaypandit / virual-host-ubuntu.md
Last active March 7, 2018 08:54
[Virtual Host on Ubuntu] How to write virtual host/subdomain configuration file #xampp #virtual-host #lamp #ubuntu #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 system 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 / cronjob-linux.md
Last active January 29, 2018 06:08
[Cron jobs on linux] #cronjob #linux
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
@msanjaypandit
msanjaypandit / Mysql_Backup_Restore_Script.md
Last active March 8, 2018 06:06
[MySql Backup/Restore] Generate and restore mysql backup #Mysql #backup #restore

Download full database (.gz extention)
mysqldump -h[host] -u[user] -p[password] [database] | gzip -c | cat > /var/www/html/mysqldump_[database]_$(date +%Y%m%d_%H%M%S).sql.gz

Download full database with ssl enabled (.gz extention)
mysqldump -h[host] -u[user] -p[password] [database] --ssl-ca=[.PEM file] [database] | gzip -c | cat > /var/www/html/mysqldump_[database]_$(date +%Y%m%d_%H%M%S).sql.gz

Download Specific database table (.gz extention)
mysqldump -h[host] -u[user] -p[password] [database] [tablename] | gzip -c | cat > /var/www/html/mysqldump_[database]_[tablename]_$(date +%Y%m%d_%H%M%S).sql.gz

Download Database after ignore some table (.gz extention)

<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
</head>
<body>AngularJS directives are used to extend HTML. These are special attributes starting with ng- prefix. We're going to discuss following directives
<div id="App1" ng-app = "myapp1" ng-controller = "HelloController1">
<h3> Instant type your name </h3>