Skip to content

Instantly share code, notes, and snippets.

View abhinavlal's full-sized avatar

Abhinav Lal abhinavlal

View GitHub Profile
@abhinavlal
abhinavlal / gist:1447181
Created December 8, 2011 14:55
git flow settings
#old config
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
support = support/
versiontag = pr_
#new config
[gitflow "prefix"]
@abhinavlal
abhinavlal / gist:1490488
Created December 17, 2011 15:27
Add white space after 30 characters if there is no whitespace
function breakString($string){
$stringArray = explode(" ", $string);
if(is_array($stringArray)){
foreach($stringArray as $index => $substring){
if(strlen($substring) > 30){
$subsubStrings = str_split($substring, 30);
$stringArray[$index] = implode(" ", $subsubStrings);
}
}
}
@abhinavlal
abhinavlal / gist:1530040
Created December 28, 2011 22:08
bash prompt
# @gf3’s Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Shamelessly copied from https://github.com/gf3/dotfiles
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
fi
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
@abhinavlal
abhinavlal / resolvity.php
Created February 8, 2012 11:04
free resolvity number
<?php
require_once 'init.php';
$resolvity = new Turbodoc_Resolvity('accounts');
$response = $resolvity->request('GET');
$numbers = json_decode($response, true);
@abhinavlal
abhinavlal / gist:2071818
Created March 18, 2012 13:00
elasticsearch upstart script
#! /bin/sh
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts elasticsearch
# Description: Starts elasticsearch using start-stop-daemon
### END INIT INFO
@abhinavlal
abhinavlal / gist:2072027
Created March 18, 2012 13:12
graylog2 upstart script
#!/bin/bash
### BEGIN INIT INFO
# Provides: graylog2
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts graylog2
# Description: Starts graylog2 using start-stop-daemon
### END INIT INFO
@abhinavlal
abhinavlal / gist:2072425
Created March 18, 2012 13:32
Graylog mongo config
mongo
> use admin
> db.addUser('admin', 'AdminPassword')
> db.auth('admin', 'AdminPassword')
> use graylog2
> db.addUser('grayloguser', '123')
> db.auth('grayloguser', '123')
> exit
<?php
/*
* returns the DND Status of given phone number.
*
*/
require_once 'init.php';
class updateDNDStatus
{
<div style="background:url('https://ray.practo.com/images/pvrwidget-red.png');height:36px
!important; width:193px !important;margin:5px !important;line-height:36px !important;
padding:5px 10px 24px 75px !important; text-align:left;font-family:'Arial', Calibri !important; font-size:18px !
important; font-weight:bold !important; color:#FFF !important;text-shadow:1px 1px 0 #A33232
!important;display:inline-block !important;">+91 08050002060</div>
<!------------- correct code ---->
<div style="background:url('https://ray.practo.com/images/pvrwidget-red.png');height:36px
!important; width:193px !important;margin:5px !important;line-height:36px !important;
@abhinavlal
abhinavlal / reset_autoincrement.sh
Created January 19, 2013 08:45
Reset auto increment of all tables in a mysql database
mysql -Nsr -e "SELECT t.table_name FROM INFORMATION_SCHEMA.TABLES t WHERE t.table_schema = 'DB_NAME'" | xargs -I {} mysql DB_NAME -e "ALTER TABLE {} AUTO_INCREMENT = 1;"