Skip to content

Instantly share code, notes, and snippets.

Puneet Arora puneetar

Block or report user

Report or block puneetar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bash_profile_set_terminal_colors
### Add this to `~/.bash_profile
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
@puneetar
puneetar / git_branch_name_bash_profile
Created Aug 20, 2018
To show proper git branch name when present in the console.
View git_branch_name_bash_profile
#--------To show proper git branch name when present in the console.
#--------Add this to ~/.bash_profile or ~/.bash_rc
#--------This will start showing branch names in the terminal like
#--------puneetar folder_name (branch_name) $
#--------
parse_git_branch() {
   #  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
git branch 2> /dev/null | grep '*' | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@puneetar
puneetar / git-completion.bash
Created Aug 16, 2017
Git base completion script
View git-completion.bash
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@puneetar
puneetar / karabiner_diamond_cursor_option_ijkl.json
Created Aug 13, 2017
Karabiner : Diamond Cursor : Change option + I/J/K/L to Arrow Keys
View karabiner_diamond_cursor_option_ijkl.json
{
"title": "Diamond Cursor",
"rules": [
{
"description": "Change option + I/J/K/L to Arrow Keys",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "i",
View idea.vmoptions
# custom IntelliJ IDEA VM options
# references from https://gist.github.com/P7h/4388881 and https://gist.github.com/devnulled/4120215
# running Scala with Scalaz on JVM 1.8.0 64 bit for IntelliJ 2017.1
-server
-Xms2048m
-Xmx3048m
-XX:ReservedCodeCacheSize=240m
-XX:NewSize=512m
-XX:MaxNewSize=512m
@puneetar
puneetar / JSONToCSVConverter
Created Sep 8, 2016
Javascript function to convert JSON to CSV
View JSONToCSVConverter
export function JSONToCSVConvertor(JSONData, fileName, ShowLabel, errorCallback) {
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
var CSV = '';
if (ShowLabel) { //This condition will generate the Label/Header
var row = "";
for (var index in arrData[0]) { //This loop will extract the label from 1st index of on array
if (arrData[0].hasOwnProperty(index)) {
row += index + ','; //Now convert each value to string and comma-seprated
}
@puneetar
puneetar / .git_hooks_commit-msg
Created May 25, 2016
git commit hook : file : commit-msg
View .git_hooks_commit-msg
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
# For eg : branch name : puneet/CHOW-142412-this-works
# will result into commit message : "CHOW-142412: this is my commit message"
#
#NAME=$(git branch | grep '*' | sed 's/* //')
NAME=$(git branch | grep '*' | sed 's/* \(.*\)\///' | sed 's/\([0-9]\)-.*/\1/')
DESCRIPTION=$(git config branch."$NAME".description)
You can’t perform that action at this time.