Skip to content

Instantly share code, notes, and snippets.

View palpalani's full-sized avatar

Palaniappan P palpalani

View GitHub Profile
alias ..="cd .."
alias ...="cd ../.."
alias h='cd ~'
alias c='clear'
alias art=artisan
alias codecept='vendor/bin/codecept'
alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
@palpalani
palpalani / php-event-extensions.sh
Created July 12, 2020 03:39
Installing ev, event and libevent for PHP 7.4 on Ubuntu 20.04
cd /usr/src/
git clone https://github.com/expressif/pecl-event-libevent.git
cd pecl-event-libevent
phpize
./configure
make && sudo make install
sudo apt update
sudo apt install php7.4-dev libevent-dev
@palpalani
palpalani / larg-dump-import.sql
Last active August 31, 2017 12:13
Import a large sql dump file to a MySQL database from command line
#!/bin/sh
#Refer https://cmanios.wordpress.com/2013/03/19/import-a-large-sql-dump-file-to-a-mysql-database-from-command-line/
# store start date to a variable
imeron=`date`
echo "Import started: OK"
dumpfile="/home/bob/bobiras.sql"
var Elixir = require('laravel-elixir');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var react = require('gulp-react');
var concat = require('gulp-concat');
var Task = Elixir.Task;
Elixir.extend('jsx', function (src, dest) {
src = src || 'resources/assets/jsx/!*.jsx';
dest = dest || 'public/js';
@palpalani
palpalani / install_predis.sh
Last active December 10, 2018 04:34
Installing Redis, Hiredis on Ubuntu 14.04
#!/bin/bash
echo "--------------------------------------------------------------------------------------------"
echo "Installing Predis on Ubuntu 18.04"
echo "Read more: https://github.com/nrk/predis"
echo "Author: Ralf Rottmann | @ralf | http://rottmann.net"
echo "--------------------------------------------------------------------------------------------"
PHP_CONF_DIR="/etc/php/7.3/apache2/conf.d"
echo "Checking prerequisites..."
echo "Git available?"
[ ! -s /usr/bin/git ] && sudo apt-get -q -y install git || echo "Git already installed."
* -A in SSH enables agent forwarding.
* -p 2122 is not needed if you use the default port of 22.
* Replace SSH_USER and example.com with your own values.
* Example run: $ envoy run deploy_demo
* --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload
@servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com'])
@task('install_test', ['on' => ['test']])
cd project
@palpalani
palpalani / gist:15030df2823bcb22ef23
Created March 2, 2016 06:04 — forked from harrisonde/gist:90431ed357cc93e12b51
Deploy Laravel 5 applications on AWS Elastic Beanstalk
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk.
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config)
# -------------------------------- Commands ------------------------------------
# Use "commands" key to execute commands on the EC2 instance. The commands are
# processed in alphabetical order by name, and they run before the application
# and web server are set up and the application version file is extracted.
# ------------------------------------------------------------------------------
commands:
01updateComposer:
@palpalani
palpalani / rebuild-indexes.sql
Created April 12, 2015 05:44
Rebuild Indexes of all tables in a single MSSQL database
/*
MSSQL
-----
Rebuilds indexes on smallest tables first, allowing the maximum number of indexes to be rebuilt in the shortest amount of time.
Real time progress updates, allowing you to estimate how much time is remaining before completion.
Correctly handles multiple schemas, a common flaw in other scripts.
*/
SET NOCOUNT ON
GO
@palpalani
palpalani / functions.php
Created December 27, 2014 10:18
WordPress - Contact 7 form - load js, css only needed pages
<?php
/*
Contact 7 form - load js, css only needed pages
*/
add_action( 'wp_print_scripts', 'deregister_cf7_javascript', 100 );
function deregister_cf7_javascript() {
if ( !is_page(array(8, 10)) ) {
wp_deregister_script( 'contact-form-7' );
}
@palpalani
palpalani / functions.php
Created December 27, 2014 10:16
WordPress - Display comments in admin to authors own posts only
<?php
//Display comments in admin to authors own posts only
function wps_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses['join'] = ", wp_posts";
$clauses['where'] .= " AND wp_posts.post_author = ". $user_ID ." AND wp_comments.comment_post_ID = wp_posts.ID";
};
return $clauses;