Kesavan Muthuvel's Personal Home Page

Index | Bookmarks | I'm supporting | More info? | Royal Thunderbird! | Maemo N900 | Nexus 4 (Android + more ) | KODI [aka] XBMC | My Public Key (GPG) | My Sign | Travel Photos | Blog
Thanks to.. | Open Materials | interview qns | scripts to look | RegEx me! | Web Dev tips | eBooks Collection
Looking for a girl A day - a cartoon Shameless self promo Generate random values

Tricks for Web Development

What are you looing for ?

# auth :
# date : 2016-06-22
# Updated version always avail at
# 1 - 	(quick-commands)	and/or
# 2 - ( quick-commands-web-dev.txt )
# SELFNOTE - Keep this sync with Work & GitHub & ownCloud 

	The following commands could be entered to display the information shown. 
	:echo @%  def/my.txt	directory/name of file  
	:echo expand('%:t')	my.txt  name of file ('tail')  
	:echo expand('%:p')	/abc/def/my.txt  full path  
	:echo expand('%:p:h')	/abc/def  directory containing file ('head')  
	:set hlsearch
	:hi! link Comment Comment 	# Hide the commands
	:hi! link Comment Ignore 	# Show the comments
	:setlocal noautoindent nocindent nosmartindent indentexpr= nonu
	:setlocal nocindent
	:setlocal nosmartindent
	:setlocal indentexpr=

	:diffoff & :diffthis					# Turn Off/On Colors during Diff
	:set tabstop=4 shiftwidth=4 expandtab	# Tab to 4 WHITESPACE 

	:set tabstop=4 noexpandtab				# 4 WHITESPACE  to  Tab 
	:set syntax=whitespace					#show spaces
	:set listchars=tab:▸\ ,eol:¬			#show tabs,eol
	:set ts=4
	:set et
	:659,723retab!							#tabs to 4spaces from 659 to 723 lines

	vimdiff commands

	]c :        - next difference
	[c :        - previous difference
	do          - diff obtain
	dp          - diff put
	zo          - open folded text
	zc          - close folded text
	:diff update - re-scan the files for differences

	syntax off
	set nohlsearch
	set t_Co=0 # 7/8 colors , 

	C-W C-W 						#lets you toggle between the diff columns
	:set diffopt+=iwhite			#To avoid whitespace comparison
	CTRL+W twice 					#lets you toggle between the diff columns
	ctrl-w l ctrl-w h 				#vim philosipy h-left , l-right
	ctags -R --languages=php .		# Make a tags file
	:set tags=$project/tags			# Set that in .vimrc
	Ctrl+]	-	Goto Definition		# Play around
	Ctrl+t	-	Back to Code


	Find files (man find ; or link
	find /home/tmpdir -type f -name "*string*" 	-print	# f-file d-dir l-link	-iname “*.pl”
	find ~ -name \*.c -print		#Instead of doing things this way, you should enclose the pattern in quotes or escape the wildcard

	# Expressions &  RANGES 
	# xtime 	# x in  - data (m)odified ; data+inode+permission (c)hanges ; file read-only (a)ccess
	# -n - less than n days (RECENT CHANGES)
	# +n - more than n days (OLDER CHANGES)
	#  n - exactly n days
    # ( expr ) Force precedence.
    # ! expr True if expr is false.
    # expr1 expr2 And (implied); expr2 is not evaluated if expr1 is false.
    # expr1 -a expr2 Same as expr1 expr2.
    # expr1 -o expr2 Or; expr2 is not evaluated if expr1 is true.

	find . -ctime n															# File's status was last changed n*24 hours ago
																			# (data+inode+permission changes )
	find . -mtime -7														# File's data was last modified 7*24 hours ago
																			# finds files changed in the last week
	find . -mtime -7 -type f												# file's data modified less than 7 days	ago
	find www/code/ -mtime 8 -mtime -10 -iname "*.pl" 						# perl files modified less than 10 days & more than 8 days ago
																			# ie , modified between 8-10 days 
	find ~ -type f -name test.txt -newermt 2014-11-04 ! -newermt 2014-11-04	# files modified between dates
	find  . -type f -name '*.php' -mmin -60									# php files modified in last one hour

	#find with REGEX - Read more if need : -regextype posix-extended	
	find ~ ! -regex '.*/\..*'  -type f										# REGEX to filter non-hidden files/directories/links	
	find ~ -regex '^(?!\.)(.*)todo.*' -type f								# REGEX to filter *todo* files/directories/links
	find ~ -type f ! -regex '.*/\..*' -a -regex '.*todo.*'					# REGEX to filter non-hidden *todo* files
	find ~ -type f  \( -regex '.*/\..*' \) -regex '.*todo.*'				# REGEX to filter hidden *todo* files
	Find & Grep		# list files with patterns
	# Combining find & grep is strongly depreciated ; Just for learning. Go with GNU grep (below)
	find . -name "*.php" 	  -exec grep -H "some_string" {} \;	
	find / -iname "*checkin*" -exec grep 'Confirm Password' {} \;
	find . -type f -exec grep -H PATTERN '{}' \;  2>/dev/null	#NO SYMB LINK FOLLOW
	Grep files with a particular string in the file name
	grep -rH "string" www/code/				# -r recursive
	grep -ir  -E 'get|wcl' sample.php|tail	# -i case-insensitive
	grep -H ERROR  www/log					# -H force to print --with-filename; default nature
	grep -C3 error  www/log					# -Cn prints n lines before & after the matching lines
											# -(A)bove (B)elow (C)ombined

	grep -ir --include \*.php pattern  ./*	# only particular file type , recursive
	#Numbering the occurance
	perl -ne 'print ++$a." $_" if /pattern/' file.ext
	#recursive statistics on file types in directory
	find . -type f | sed 's/.*\.//' | sort | uniq -c
	   16 avi
	   29 jpg
	  136 mp3
		3 mp4
	# list files of date & remove them 
	ll /tmp/*wsdl-bou*|grep 'Jul 24'|awk '{print $9}'|xargs rm 

	Search for a file for all users with matching pattern:
	for user in bsatishraj btata gkasim kmuthuvel kthokala ktoufique pdurgaprakash rkema_old smareddy smareddy-old smatte snagotu vgunnam; do for envdb in `find /data/$user -maxdepth 5 -type f -name 'env_db.php'` ; do grep -E 'BE_DB_DATABASE|BE_DB_SLAVE_DATABASE|BE_DB_WEATHER_DATABASE' $envdb|grep 'define(' |awk {'print $2 '}|sort|uniq |xargs echo -e "$user - $envdb \t\t -" ; done; done

	kmuthuvel@localhost:atlas:~$ for user in kmuthuvel;
	> do
	>  for envdb in `find /data/$user -maxdepth 5 -type f -name 'env_db.php'` ;
	>  do
	>   grep 'define(' |
	>   awk {'print $2 '}|
	>   sort|
	>   uniq|
	>   xargs echo -e "$user - $envdb \t\t -"
	>  done;
	> done
	kmuthuvel - /data/kmuthuvel/code/core/config/env_db.php				- old_db shard01
	kmuthuvel - /data/kmuthuvel/code-xyz/core/config/env_db.php			- km_db shard01
	kmuthuvel - /data/kmuthuvel/archive/code/core/config/env_db.php		- km_db newdb shard01
	kmuthuvel - /data/kmuthuvel/new/core/config/env_db.php				- km_db shard0
	alias ls="ls --color"
	alias phpk="php -d display_errors=1 -d error_reporting=E_ALL -l"
	alias phpx="php -d xdebug.profiler_output_dir=$HOME/profile -d xdebug.profiler_enable=On"

	ln -s for new development env
	ln -s /data/kmuthuvel/kmcode /srv/www/	#data to public_html
	ln -s /srv/www/ /srv/www/	#public to www

	SED / AWk
	sed -n -e 's/.*\(.*\)<\/name>.*/\1/p'  persons.txt 	#kesavan 
	Mount Disk list	
	sudo fdisk -l
	sudo cat /etc/fstab		# Currently mounted items
	sudo ls /dev
	kmuthuvel@localhost:atlas:~$ for user in bsatishraj ktoufique kthokala rkema gkasim snagotu vgunnam pdurgaprakash  ; do echo $user `grep km_db /data/$user/code/core/config/env_db.php|wc -l`;   done;
	$ export PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\$"
	ps -elF|head -1;ps -elF| grep listen_for_events_pa
	ps -elf|head -1;ps -elf| grep listen_for_events_pa

	rss in ps are resident ; resident set size;the non-swapped physical memory that a task has used (in kiloBytes)(alias rssize, rsz).
	RES in top ? (may be RSS of ps? . I assume so!

	Disk Usage
		du -sch * 2>/dev/null				# disk usage by every file/directory 
		du -sch * 2>/dev/null |tail -1		# disk usage by current directory 	
		du -sch * 2>/dev/null |sort -hr		# disk usage , sort by size 
		du -sh * | sort -hr |head -10		# disk usage , top 10 

	Permissions take a different meaning for directories. 
		read 	- determines if a user can view the directory's contents, i.e. do ls in it.
		write 	- determines if a user can create new files or delete file in the directory. (Note here that this essentially means that a user with write access toa directory can delete files in the directory even if he/she doesn't have write permissions for the file! So be careful with this.)
		execute	- determines if the user can cd into the directory.
		diff --old-group-format=$'\e[0;31m%<\e[0m'      --new-group-format=$'\e[0;33m%>\e[0m'      --unchanged-group-format=$'\e[0;32m%=\e[0m' /home/tmpdir/migrating_active_collections_report.php code/core/goodyear/scripts/migrating_active_collections_report.php	
		diff --old-group-format=$'\e[0;31m%<\e[0m'      --new-group-format=$'\e[0;32m%>\e[0m'      --unchanged-group-format=$'\e[0;32m%=\e[0m' /home/tmpdir/migrating_active_collections_report.php code/core/goodyear/scripts/migrating_active_collections_report.php			
		diff --old-group-format=$'\e[0;31m%<\e[0m'      --new-group-format=$'\e[0;32m%>\e[0m'       /home/tmpdir/migrating_active_collections_report.php code/core/goodyear/scripts/migrating_active_collections_report.php	
			diff --new-line-format="%dn%L"  --old-line-format="%dn%L"  --unchanged-group-format="" --old-group-format=$'\e[0;31m%<\e[0m'      --new-group-format=$'\e[0;32m%>\e[0m'       /home/tmpdir/migrating_active_collections_report.php code/core/goodyear/scripts/migrating_active_collections_report.php

		crontab -l >.crontab ;vi .crontab ; sleep 2 && crontab .crontab		# Current cronjobs , saved locally
		alias crontab="vi ~/.crontab"										# Edit cron jobs directly
		# Refer :
		/var/spool/cron/crontabs/*					#	Backup this regularly

		err_report() { echo "Error on line $1"; }
		trap 'err_report $LINENO' ERR
		ls ./-sample-idotic-file

	Check who configured what:
	for user in `/bin/ls /data/`; do for envdb in `find /data/$user -maxdepth 5 -type f -name 'env_db.php'` ; do grep -E 'DB_DATABASE|DB_SLAVE_DATABASE|DB_WEATHER_DATABASE' $envdb|grep 'define(' |awk {'print $2 '}|sort|uniq |xargs echo -e "$user - $envdb \t\t -" ; done; done
			/msg nickserv identify kesavan 
	\P 		grep -v Sleep						-- (\P === pager)	-- MySQL > PAGER(grep) > STDOUT	
	pager 	grep -v Sleep | more; 
	\P											-- Default pager wasn't set, using stdout. '
	-- More on Pager 
	mysql> pager less  /** **/

	-- Find Column & Tables
	COLUMN_NAME 	LIKE '%order%' 		AND 
	TABLE_NAME 		LIKE '%867%' 		AND


	SELECT id,book_name FROM books WHERE Order_Status REGEXP 'Time|Relativity|Gravity';

	mysql> select customer_id,substring_index(substring_index(xml_log,'',-1),'',1) lob
    -> from kmuthuvel.orders_xml where order_id = 12345;
	-- Copy Table
	CREATE TABLE km_dup.table1 SELECT * FROM km_orig.table1

	-- SQL to fetch latest from same table V1 
	SELECT * FROM (SELECT id,customer_id,note,date_created FROM customer WHERE customer_id =  123 AND note LIKE 'Customer not happy%' ORDER BY id DESC ) AS LATEST GROUP BY customer_id
	-- SQL to fetch latest from same table  V2 Tuned
	SELECT , ccn.customer_id ,ccn.note , ccn.date_created FROM customer ccn LEFT JOIN customer ccn2
	ON (ccn.customer_id = ccn2.customer_id AND ccn.date_created < ccn2.date_created AND  ccn.note = ccn2.note
	) WHERE ccn2.date_created IS NULL AND ccn.customer_id = 123 AND ccn.note LIKE 'Customer not happy%' ;
	-- Example V1
	SELECT * FROM (	SELECT id,customer_id,note,date FROM customer_log ORDER BY id DESC ) AS LATEST 
	GROUP BY customer_id ORDER BY date DESC ;
	-- Example V2
	SELECT c1.* FROM customer_log c1 
	LEFT JOIN customer_log c2 ON (c1.customer_id = c2.customer_id AND < ) 

	SELECT id,report_id, CONVERT(params USING utf8) params,last_updated ,run_every,notes,active  FROM autoreports ORDER BY id DESC LIMIT 5; 
	mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt -hlocalhost --ukmuthuvel -pXXXXXXXXXXXX my_database   > ~/my_database.routines.sql
	mysql -hlocalhost -ukmuthuvel -pXXXXXXXXXXXX kmuth_new < my_database.routines.sql

	ob_start();var_dump(); user_error(ob_get_contents()); ob_get_clean();
	php -d display_errors=1 -d error_reporting=E_ALL -l #

	if(DEV) error_log(date('c')."\t ==>$sql<== with  ==> ".var_export($anything,true)."<== \n",3,"/tmp/dev.log");

	echo "
";	print_r($_POST); 
	echo "
";	var_dump($_POST); exit;

	service php-fpm restart	
	Syntax Error here";


		$response = $client->ValidateUser("kesavan", "Password1",'DE'); #SERVICE
	}catch (Exception $e) {
		echo "Caught exception:".get_class($e)."\n{$e->getMessage()}\nIn file:{$e->getFile()} at line #{$e->getLine()}\n{$e->getTraceAsString()}\n";
		throw $e;

	Custom Profiler
	self::profiler('Going to kill me!!! ');
	$total_orders = count($orders); $i =1;$startTime= microtime(true);
	public static function profiler($msg){
		$message = date('Y-m-d H:i:s')." Memory:".round(memory_get_usage()/(1024*1024)).
			"MB MemoryPeak:".round(memory_get_peak_usage()/(1024*1024))."MB  \t".
			 number_format(( microtime(true) - $startTime), 4)." Seconds \t".
	Color'd echo
	echo " \e[1;34m ". date(c)." \e[35m error-message \e[0m ";
	Included files/functions

	Custom Error Backtracing
	$caller =debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2)[1]['function'];
	$caller2 =debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,3)[2]['function'];	
	echo date('c')."\t".__FILE__.__CLASS__. __METHOD__ . __LINE__ . "leaving now \n";
	echo date('c')."\t". __FILE__.__CLASS__."Inside method:". __METHOD__."@ line#" . __LINE__ ."Called by:$caller |  calling getResults \n";
	echo date('c')."\t".__CLASS__."Inside method():".__METHOD__."@ line#".__LINE__."==>".var_export($incFile,1)."<==\n";

	echo date('c')." ".basename(__FILE__)."|". __METHOD__."|".__LINE__.'==>calling:Basic_report->genericAutoReport<=='."\n";
	echo date('c')." ".basename(__FILE__)."|". __METHOD__."|".__LINE__."==>is_auto\n";

	Console-Table foramtted output
	$x = include 'data.php';	# input array

	$mask = "|%5.5s |%-20.20s| %-13.13s |\n";
	foreach ($x as $brand => $data)
			list($brand_name,$aliases) = $data;

	Normal Flow
		git status								#Show the current status
		git branch 	new_enchancements			#Creates new Branch (Local)
		git checkout 	new_enchancements		#Switch to branch (new_enchancements)		
		git checkout -b new_enchancements		#Creates & Switch to new_enchancements branch (Local)
		git add file.php						#Adding new file to git
		git commit -m "Fixed,all files"			#Commit the file
		git push origin new_enchancements		#Send to origin
		git checkout --f new_enchancements		#Switch to branch by force 

		git remote -v							#git remote info
		git reset filename.txt					#remove a file from the current index, the "about to be committed" area, 
												#without changing anything else.
		git reset								#undo `git add .` 
		git -c color.ui=always		#force color output
		Always create new branch from `development` only. Else you may conflicts raising from the branch from where you create the new.
				 -------new-feature----------> 5 changes (new feature added )
		-------/--------development----------> 0 changes (upto date with master)
					        \---hotfix-------> 2 changes (quick hotfix;go by eod )
		0 ---- 1 ---- 2 ---- 3 ---- Time --->
					        /---hotfix-------> 7 changes (combines with new feature)
				 -------new-feature----------> 5 changes (new feature added )
		-------/--------development----------> 0 changes (upto date with master)

		0 ---- 1 ---- 2 ---- 3 ---- Time ---->
	Save changes to temp & goto other branch & come back
	$git branch								#list branches						#10:00 AM
	$git status								#current status						#10:30 AM
	$git stash								#move changes to temp location		#10:31 AM
	$git checkout very_new_branch			#switch to other branch				#10:40 AM
	$git add new.file.ext					#work on other branch				#02:30 PM
	$git commmit -m 'Fixed issues;'			#commit the changes					#02:40 PM
	$git checkout my-branch					#back to original branch			#03:00 PM
	$git stash pop							#get the changes from stash			#03:03 PM

	Revert to previous commit
	git reset --hard  2454tb6
	git push -f origin kmuth-branch
	Revert To Original/Old - Entire directory (code base)
		git pull ?
		git stash; git fetch origin; git reset --hard origin/development	#Entire directory to REMOTE_MASTER/REMOTE_BRANCH
		git reset --hard df2bcfac7cabc0fd14d5c5abce22d65589e458a1 			#Entire directory to particular version
	Revert To Original/Old version - File level (single file)
		git checkout -b old_is_gold												#Creates & Switch to branch old_is_gold
		git checkout HEAD path/to/file											#Single File , from Master 
		git checkout d279318b40657be62accea2130ef2fdf9b150b26 -- [full/path]	#Single File , from particular commit 

	Revert To Original/Old version - Branch level (From remote into local) (Multiple files)
		git checkout -b old_local_branch			#Creates & Switch to branch old_local_branch
		git merge --no-ff old_remote_gold			#Auto-merging from old_remote_gold to old_local_branch
		git push origin old_local_branch			#Push changes to origin again

	Get changes from master into branch in git
		git rebase master
	Pick & Squash
		git rebase -pi development
			pick 	f7f3f6d commit 1      
			squash 	310154e commit 2   
			squash 	a5f4a0d commit 3
		git push -f origin hot-fix-branch
		git rebase -pi development
			#first on as pick , rest all squash
			>> Refusing to squash a merge: 7daa8381fc40294b9616ebe28466a0cc2aabdca3
		git status
			>>rebase in progress; onto 3f688ad
			>>You are currently editing a commit while rebasing branch 'kmuth-hot-fix' on '3f688ad'
		git rebase --continue
			#removed all the commit messages 
			>>Successfully rebased and updated refs/heads/kmuth-hot-fix.
		git push -f origin kmuth-hot-fix
	Squashing with conflict resolved merges 
		git checkout development						# Move to development
		git branch -D hf_with_5changes_8commits			# Delete  from locally
		git pull origin development						# Make sure git is upto date
		git checkout -b hf_with_5changes_8commits		# Create & checkout  from development
		git apply ~/5changes.patch.diff					# Apply the diff (from gitlab) on 
		git push -f origin hf_with_5changes_8commits	# Git push all the final changes

	Patch apply
		git apply --stat ~/fix_affleck_upload.patch
		git apply --check ~/fix_affleck_upload.patch
		git apply ~/fix_affleck_upload.patch
		git add 
		git commit -m "patch added"
		git push origin 
	Copy branch to branch
		git checkout -b new_branch old_branch
		git checkout development
			Switched to branch 'development'
			Your branch is up-to-date with 'origin/development'.
		git merge --no-ff heavy_reports
			Auto-merging sonar/system/application/views/reporting.php
			Auto-merging core/build/classes/core/reporting/classes/orders_report.php.php
			Auto-merging core/build/classes/core/reporting/classes/KPI_Report.php
			CONFLICT (content): Merge conflict in core/build/classes/core/reporting/classes/KPI_Report.php
			Automatic merge failed; fix conflicts and then commit the result.
		git push origin development
			Everything up-to-date	

	Get single file from different branch from remote
		cd /data/kmuthuvel/code		#go to top code level
		git checkout origin/diff_branch full/path/to/file.ext
		git checkout origin/smt_usage_emails core/build/classes/core/ercot/SmtDataDailyPeer.php
		git checkout origin/master   #to live
		git clean -f 				# remove-local-untracked-files
	Remove/Delete remote/local branch
		git branch -d 		#local only		
		git push origin --delete 	#remove remote(if you know what you are doing!)
		git push origin :		#alias of above	
	Unable to commit ? 
		To git@
		 ! [rejected]        new_enchancements -> new_enchancements (non-fast-forward)
		error: failed to push some refs to 'git@'
		hint: Updates were rejected because the tip of your current branch is behind
		hint: its remote counterpart. Integrate the remote changes (e.g.
		hint: 'git pull ...') before pushing again.
		hint: See the 'Note about fast-forwards' in 'git push --help' for details.
		git push origin --delete new_enchancements		#1 remove remote branch
		cd /data/kmuthuvel; rm -rf code					#2 remove local setup	
		git clone git@	#3 setup fresh code
		git branch new_enchancements (git branch -a)	#4 create unique branch
		git checkout new_enchancements					#5 switch to new branch
		...												#6 develop changes
		git diff										#7 verify changes
		git status;git add file1 file2 ;				#8 add files and status
		git commit -m 'Reports enchanced'				#9 commit changes
		git push -u origin new_enchancements			#10 done!
	Diff & Logs
		git diff   file.ext	# Compare latest to Old
		git diff a268ab7670c5430a2a98638cb04820516f8b1b9e 85cfd5ae0e4a1d888eb9611d99c6eac2ba92740f  orders_report.php.php
		git diff HEAD^ HEAD [users_controller.php]
		git log -S'unique_identifier' -- orders_report.php.php
		git log -G'unique_identifier' -- orders_report.php.php
		git show 211dbe40cd784b06932122f7ba67d656ed438b01	# Particular commit
		git diff --unified=0 -- filename.ext  # git diff with line numbers (aka git diff -U0)

		[TIP]	#
		git log --pretty=format:"%h - %an, %ar : %s" -S'unique_identifier' -- orders_report.php.php
		git log --pretty=format:"%h - %an, %ar : %s" orders_report.php.php
		git log --pretty=format:"%H - %an, %ar : %s" orders_report.php.php
		git log --author=kmuthuvel
		git log --author="\(kmuthuvel\)\|\(rms\)|\(einstein\)"
		git log --pretty=format:"%h %s" --graph --author=kmuthuvel
		git log --no-merges master	
		git log --all --			#who deletes this file ; tracks all the history of file that got deleted.

		#List all the modified files for a commit (better version below)
		git diff-tree --no-commit-id --name-only -r 2bc51f53a15da1428f8320d9ee93f8e7069a05a2
		#Quick summary on a commit ( --stat & --name-status)
		git show --stat --summary 66064dbfb18f2562261588c64f8e74a9c941ab00
		git show --name-status a5e347198e93a6ecb69077ac2cd1491337531671
		git show --name-only 581c968d50ca3259b94081ac428969184ed51eab
		git diff --name-only | xargs  ls -lt 		# latest modified files
		git log --name-only --pretty=format:"%H - %h - %an, %ar : %s"  --author=kmuthuvel  --walk-reflogs   my_hot_fix			# log on only that specific branch		
		git log --stat --oneline --pretty=format:"%h - %an, %ar : %s" --author="\(kmuthuvel\)\|\(raju\)" --walk-reflogs welcome-offshore 
		#digging for an info
		git log --pretty=format:"%h - %an, %ar : %s"  * | grep -i -E 'social|ssn'
		#digging log with modified files
		git log --name-status --author=kmuthuvel --pretty=format:"%h - %an,%ar| %f : %s " * | grep -A2 -i -E 'social sec|ssn'
		Changed files:
		git diff --name-only development
		git log --oneline --pretty="format:" --name-only development.. | awk 'NF' | sort -u

	git clean -f								# clean your local
	git fetch origin							# fetch all
	git checkout -b hot-fix origin/hot-fix		# make sure you don't any existing branch with same name
	git merge --no-ff origin/development		# try to fix automatic and you'll see errors
	vim core/conflict.php						# remove conflicts manually
	git commit -am 'fixed conflicts on 1234'	# add and commit to git
	git merge --no-ff origin/development		# it should work now
	git push origin hot-fix						# job done
	git checkout development					# back to development
	git branch -d hot-fix						# delete the hot-fix that no more need
		git fetch origin 
		git checkout -b new_enchancements origin/new_enchancements 
		git checkout development 
		git merge --no-ff new_enchancements 
		git push origin development
		git checkout development			#Always checkout development
		git branch 
		git add file.php					#Adding new file to git
		git commit -m "Fixed,all files"		#Commit the file
		git push origin new_enchancements	#Send to origin
		On branch development
		Your branch is up-to-date with 'origin/development'.

		git pull
		git push -u origin new_enchancements	#Send to origin	
		# quick view on all branches
		ORIG=`git branch|grep \* | sed -e 's/\* //g'` ; for i in `git branch|sed -e 's/\* //g' -e 's/ //g'` ; do git checkout $i 1> /tmp/$USER_git_warings.log; if [ /tmp/$USER_git_warings.log ] ; then if [ `grep up-to-date /tmp/$USER_git_warings.log  |wc -l` -eq 0 ] ; then ST='-w' ;  else ST='-g' ; fi ; cat /tmp/$USER_git_warings.log | msg2 $ST  ; rm -f /tmp/$USER_git_warings.log;   fi ;git diff --stat --cached origin/$i ; done  ; git checkout $ORIG ;
		#Git Repository Deleted File Recovery Method
		Undo a commit and redo
		git commit -m "Something terribly misguided"              (1)
		git reset --soft HEAD~                                    (2)
		<< edit files as necessary >>                             (3)
		git add ...                                               (4)
		git commit -c ORIG_HEAD                                   (5)

		git commit --amend -m "New commit message"		#Amending the most recent commit message	
														#Edit an incorrect commit message in Git

		$git rm --cached 	#deal with error “Git: fatal: Pathspec is in submodule 												

	index="access_log" "/account/login" POST mobile host="de-*" | timechart span="1d" count
	index="access_log" "/account/login" POST mobile host="de-*" Android Firefox														
	host="de-*" index="myaccount_frontend_dce" | table _time customer_id order_id mobile browser platform service_state
	host="de-*" 382450 | table _time
	host="de-*" "direct-your-energy"  sourcetype=fe_metrics | table _time customer_id order_id total_execution_time customer_service_state

	host="de-*" uri="*direct-your-energy*" sourcetype=access_log phpsessid!=''|eval session=phpsessid | eval  os = case(match(user_agent,"Windows .. 5\.1"),"Windows XP",match(user_agent,"droid"),"Android",  match(user_agent,"Windows NT 610"),"Win10", match(user_agent,"Mac"),"Mac",          match(user_agent,"Windows NT 6.1"),"Windows 7"    )   | eval browser = case(match(user_agent,"MSIE 10.0"),"Internet Explorer 10.0",match(user_agent,"Trident"),"IE11", match(user_agent,"Chrome"),"Chrome",match(user_agent,"Safari/"),"Safari") | eval arch = case(match(user_agent,"droid"),"android",match(user_agent,"iPad"),"ipad",match(user_agent,"iPod"),"ipod")  |table os browser uri session|join session [search host="de-*" sourcetype=fe_metrics | table _time session order_id customer_id customer_service_state]

	host="de-w*"  confirmation_page_trace order_id=2417516 OR order_id=2417512 OR order_id=2417509|rex field=_raw "confirmation_page_trace: (?[^XYZ]+):" | table _time order_id customer_id session_id host method view |sort -_time
	host="de-w*"  confirmation_page_trace order_id=2417516 OR order_id=2417512 OR order_id=2417509|rex field=_raw "confirmation_page_trace: (?[^XYZ]+):" | table _time customer_id order_id session_id host method view |sort  order_id _time


	# route add
	# Netsh
	# add v4tov4 listenport=8080  listenaddress= protocol=tcp
	# netsh interface portproxy add v4tov4 listenport=8080 listenaddress

	C:\WINDOWS\system32>netsh interface portproxy add v4tov4 listenport=8080 listenaddress= connectport=80

	C:\WINDOWS\system32>netsh interface portproxy show v4tov4

	Listen on ipv4:             Connect to ipv4:

	Address         Port        Address         Port
	--------------- ----------  --------------- ----------   8080 80


	forfiles /s  /c "cmd /c if @isdir==FALSE echo @path @fsize  /S /D +11/04/2016 "
	forfiles /P . /S /D +11/04/2016 /c "cmd /c if @isdir==FALSE echo @path @fsize"


	CHANGE Permissions:
	takeown /f "C:\Users\kmuthuvel.old" /r
	icacls "C:\Users\kmuthuvel.old" /reset /T
	Data Recovery
	find AppData  -iname '*xlsb*' -o -name '*foo*'	#excel
	find .   -iname '*wr*tmp*'						#word / temp / auto recovery(wrd,wrf,wra)
	find .   -iname '*wbk*'							#auto recovery file that is complete  
	Domain Group Memeber lookup	
	gpresult /USER KMUTHUVEL /V
	for user in kmuthuvel cog_Mthapa TKhan2 SBasutkar ; do  NET USER $user /DOMAIN; done

	wmic logicaldisk get caption,description,drivetype,providername,volumename

	Name	|Sex|City,State
	Jorge	|M|Corpus, TX	
	Valerie	|M|Corpus, TX	
	Sabrina	|F|Corpus, TX	
	To convert the numbers into text?
	1)	Use a datevalue(text(XX,”mm/dd/yyyy”) formula
	2)	Use the text to values function to separate anything so “DATE” and “TIMESTAMP” are in two different columns.

	Multi Instance 
	#ExcelLauncher	!!! WARNING !!! Breaks lot of built-in functionality

	Indian currency format(millions to lakhs)
		Update Custom:
		[>=10000000]"RS "##\,##\,##\,##0;[>=100000]"RS " ##\,##\,##0;"RS "##,##0		
		Step 1 - Select
			First 2 rows:		Click on A3 Cell. 
			First 2 cols:		Click on C1 Cell. 
			First x rows & y cols:	Click on (y+1)(x+1) Cell
		Step end - View  > Window > Freeze Panes > Freeze Panes

`ldconfig` is a program that is used to maintain the shared library cache. This cache is typically stored in the file /etc/ and is used by the system to map a shared library name to the location of the corresponding shared library file.	
Usage :  ldconfig -v  will make new  programs ,ex gpg2 was able to find

	.	# (

	general.useragent.locale	ta-IN	about:config
	595c99c907d7bc86620ebe8bc7f23532b8428468	password-1
Thanks for @theartofweb for their Search Keyword Highlighting

Return to Kesavan Muthuvel's home page.

Please send comments on these web pages to (or)  Feedback here

CopyLeft (Ͻ) 2008 - 2017 Kesavan Muthuvel More on CopyLeft

I Don't Love FaceBook