Skip to content

Instantly share code, notes, and snippets.

View milanchheda's full-sized avatar
🎯
Focusing

Milan Chheda milanchheda

🎯
Focusing
View GitHub Profile
@milanchheda
milanchheda / apache_solr_4_0_on_ubuntu_12_04.md
Last active September 3, 2018 13:42
Installation of Apache solr 4.0 on Ubuntu 12.04 using Vagrant

Installation of Apache solr 4.0 on Ubuntu 12.04:

vagrant init hashicorp/precise64; vagrant up --provider virtualbox
vagrant up
vagrant ssh

Install Tomcat 6:

apt-get update
@milanchheda
milanchheda / smart_resize_image.php
Last active September 11, 2016 12:23
Came across this fantastic piece of PHP code that resizes the image maintaining the quality and proportional.
<?php
/**
* easy image resize function
* @param $file - file name to resize
* @param $string - The image data, as a string
* @param $width - new image width
* @param $height - new image height
* @param $proportional - keep image proportional, default is no
* @param $output - name of the new file (include path if needed)
* @param $delete_original - if true the original image will be deleted
@milanchheda
milanchheda / readme.md
Last active August 13, 2018 03:22
How to setup Forticlient SSL VPN client on ubuntu 14.04
@milanchheda
milanchheda / deleteFromSolr.sh
Created October 25, 2016 12:03
Bash script to delete data from Apache SOLR
#!/bin/sh
curl http://localhost:8080/solr/update/?commit=true -H 'Content-Type: text/xml' --data-binary '<update><delete><query>type:[content_type_name]</query></delete></update>'
single core:
curl http://localhost:8080/solr/update?commit=true -H "Content-Type: text/xml" --data-binary ':'
multiple core:
curl http://localhost:8080/solr/[CORE_NAME]/update?commit=true -H "Content-Type: text/xml" --data-binary ':'
@milanchheda
milanchheda / app.js
Created December 13, 2016 15:22 — forked from JuanJo4/app.js
Twitter OAuth with node-oauth for node.js + express 4
/*
Node.js, express, oauth example using Twitters API
Install Dependencies:
npm install express
npm install oauth
Create App File:
Save this file to app.js
@milanchheda
milanchheda / scriptExecutionTime.php
Created February 26, 2017 10:20
Script Execution Time in PHP
<?php
//place this before any script you want to calculate time
$time_start = microtime(true);
//sample script
for($i=0; $i<1000; $i++){
//do anything
}
@milanchheda
milanchheda / adding_virtual_host.sh
Created March 19, 2017 12:26
A simple shell script to add a new virtual host on Ubuntu machine.
# Create configuration file for the new virtual host in `sites-available` folder
sudo cat <<EOF >/etc/apache2/sites-available/$1.conf
<VirtualHost $2:80>
DocumentRoot "/var/www/html/$1/"
ServerName $2
<Directory "/var/www/html/$1/">
allow from all
order allow,deny
# Enables .htaccess files for this site
AllowOverride All
@milanchheda
milanchheda / redis_install.sh
Last active April 25, 2017 14:43
Redis Installation
#!/bin/bash
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
cp src/redis-server /usr/local/bin
cp src/redis-cli /usr/local/bin
redis-server
@milanchheda
milanchheda / Artisan.php
Created July 9, 2017 08:42
Laravel Cheat Sheet
php artisan --help OR -h
php artisan --quiet OR -q
php artisan --version OR -V
php artisan --no-interaction OR -n
php artisan --ansi
php artisan --no-ansi
php artisan --env
// -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose
@milanchheda
milanchheda / create_laravel_app.sh
Created July 12, 2017 13:29 — forked from connor11528/create_laravel_app.sh
Create a new Laravel application
#!/bin/bash
laravel new $1
cd $1
composer install
yarn install
touch README.md
cp .env.example .env
git init
git add -A