Instantly share code, notes, and snippets.

Vaibhav Saxena vaibhav9392

View GitHub Profile
@vaibhav9392
vaibhav9392 / backup.php
Last active Dec 29, 2016
AWS EC2 automatic volume daily/weekly/monthly snapshots.
View backup.php
#!/usr/bin/php -q
<?php
date_default_timezone_set('UCT');
$dryrun = FALSE;
$volumes = array('');
$api_key = '';
$api_secret = '';
$ec2_region = 'us-east-1';
require 'aws/aws-autoloader.php';
@vaibhav9392
vaibhav9392 / cyfe
Last active Apr 2, 2017
Connecting cyfe with aws ec2 database
View cyfe
# By default aws does not allow remote connection to database
# So we will need to enable it to connect with cyfe
# Step 1: Create new database user
# For two reasons
# i. We don't want to give root access to any application
# ii. By default root has access from localhost only
# Don't define host for this user(wildcard)
# Step 2: Allow access from remote server
@vaibhav9392
vaibhav9392 / my.cnf
Created Oct 4, 2015
Fix: Auto-stopping of mysql service on AWS micro instance
View my.cnf
/* Error reason:
InnoDB: Fatal error: cannot allocate memory for the buffer pool */
/* Solution: Change below value in my.cnf file */
/*File Location:
CentOS: /etc/my.cnf
Ubuntu: /etc/mysql/my.cnf*/
[mysqld]
View Removing index.php from codeigniter+LAMP
1. Create a .htaccess file in your application root directory.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
</IfModule>
<IfModule !mod_rewrite.c>