Example bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
# . /etc/bash_completion
#fi
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
alias post-review="ns-post-review.py"
Example screenrc
# detach on hangup
autodetach on
# No licence info
startup_message off
# if activity is detected on an affected window switched into the background
# you will receive the activity notification message in the status line
# the window will also be marked with an @ in the window-status display
#defmonitor on
# Sets the visual bell message. message is printed to the status line
# Without parameter, the current message is shown.
#vbell_msg " *wtf?!* "
# COLOR: colors codes are combinations of
# [attribute modifier] [color description]
# the manual talks of "attribute/color modifiers".
# see the manual, section "STRING ESCAPES".
#
# Color table:
# 0 Black . leave color unchanged
# 1 Red b blue
# 2 Green c cyan
# 3 Brown / yellow d default color
# 4 Blue g green b bold
# 5 Purple k blacK B blinking
# 6 Cyan m magenta d dim
# 7 White r red r reverse
# 8 unused/illegal w white s standout
# 9 transparent y yellow u underline
# hardstatus alwayslastline : screen reserve the lastline of the display for it
# %{kb} blue background
# %{w}%d/%m/%Y - %c:%s: white current date and time
# %H hostname
# %-Lw all window #s, titles, and flags before the current window.
# %n current window number
# %f current window flag
# %t current window title
# %+Lw all windows #s, titles, and flags after the current window.
# %< ????
# %= pad remaining spaces
hardstatus alwayslastline "%{kb}%{c}[%{w}%d/%m/%Y - %c:%s%{c}]%{w} %-Lw%{+bB r}%50>%n%f %t%{-bB w}%+Lw %<%=%{c}[%{W}%H%{c}]"
Refer sample screenrc at https://github.com/krdpk17/linux/blob/master/vimrc_dot.txt or https://drive.google.com/file/d/1kcU_pblaIs79ZbdipvNRIJ4CKEe5axiF/view
It has configuration specific to ctags as well
Example ~/.emacs
root@ubuntu:~/ws1/rs_120/usr.src# cat ~/.emacs
(defun byte-compile-if-newer-and-load (file)
"Byte compile file.el if newer than file.elc"
(if (file-newer-than-file-p (concat file ".el")
(concat file ".elc"))
(byte-compile-file (concat file ".el")))
(load file))
(byte-compile-if-newer-and-load "~/emacs/startup")
(byte-compile-if-newer-and-load "~/emacs/p4")
cscope_config.sh
mkcsc ()
{
#/home/ganesh/ctags --languages=C++ --c++-kinds=+p --fields=+iaS --extra=+q .;
find ./ -name '*.h' > acscope.files;
find ./ -name '*.cpp' >> acscope.files
find ./ -name '*.c' >> acscope.files;
find ./ -name '*.py' >>acscope.files;
find ./ -name '*.pm' >>acscope.files;
find ./ -name '*.s' >>acscope.files;
find ./ -name '*.java' >>acscope.files;
find ./ -name '*.hpp' >> acscope.files
cscope -bvqi acscope.files
}
mkcsc
Output of running "bash cscope_config.sh" command
# bash cscope_config.sh
.......
cscope: -q option mismatch between command line and old symbol database
> Building symbol database 380 of 46136
> Building symbol database 3510 of 46136
> Building symbol database 10610 of 46136
> Building symbol database 11610 of 46136
> Building symbol database 14040 of 46136
> Building symbol database 14910 of 46136
> Building symbol database 16170 of 46136
> Building symbol database 16640 of 46136
> Building symbol database 16800 of 46136
> Building symbol database 19470 of 46136
> Building symbol database 21760 of 46136
> Building symbol database 22130 of 46136
> Building symbol database 22590 of 46136
> Building symbol database 23150 of 46136
> Building symbol database 23940 of 46136
> Building symbol database 24520 of 46136
> Building symbol database 25150 of 46136
> Building symbol database 25450 of 46136
> Building symbol database 25640 of 46136
> Building symbol database 26620 of 46136
> Building symbol database 29610 of 46136
> Building symbol database 32800 of 46136
> Building symbol database 35930 of 46136
> Building symbol database 38380 of 46136
> Building symbol database 39480 of 46136
> Building symbol database 41430 of 46136
> Building symbol database 43900 of 46136
root@k8smaster:~/worksheet/adc#
After that use "cscope -d"
Refer https://www.youtube.com/watch?v=9NcM-Tj2UZI
Install in Linux
2025 wget http://tamacom.com/global/global-6.6.2.tar.gz
2026 ls
2027 tar -zxvf global-6.6.2.tar.gz
2028 cd global-6.6.2
2029 ls
2030 cat Makefile.
2031 vim README
2032 ls
2033 cat INSTALL
2034 cat INSTALL | more
2035 ./configure
2036 cat INSTALL | more
2037 make
2038 cat INSTALL | more
2039 make install
2040 gtags --help
2041 man gtags
2042 history
Useful link:https://www.gnu.org/software/global/download.html
http://manpages.ubuntu.com/manpages/xenial/man1/gtags.1.html
Use it along with spacemacs
Useful link: https://github.com/syl20bnr/spacemacs
tree tool
root@minion1:~/personal/foss/dockerhack# apt-get install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
tree is already the newest version (1.7.0-3).
The following packages were automatically installed and are no longer required:
gconf-service gconf-service-backend gconf2 gconf2-common helix-p4d-base-16.1 libavahi-glib1 libbonobo2-0 libbonobo2-common
libcanberra0 libgconf-2-4 libgnome-2-0 libgnome2-common libgnomevfs2-0 libgnomevfs2-common libllvm3.8 liborbit-2-0 libtdb1
libvorbisfile3 sound-theme-freedesktop
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
root@minion1:~/personal/foss/dockerhack# cd cadvisor/
root@minion1:~/personal/foss/dockerhack/cadvisor# tree client/
client/
|-- clientexample
| `-- main.go
|-- client.go
|-- client_test.go
|-- README.md
`-- v2
|-- client.go
|-- client_test.go
`-- README.md
2 directories, 7 files
root@minion1:~/personal/foss/dockerhack/cadvisor#
GDB should be integrated with code and it should be possible to live debugging. Refer [TBD]Useful gdb tips/cheatsheat
Apply patch from one file diff to another branch same file
In Branch1-
root@ubuntu:~/ws1/rs_111# p4 diff usr.src/netscaler/linux_mgmt/bin/docker_startup.sh > diff_startup
root@ubuntu:~/ws1/rs_111#
root@ubuntu:~/ws1/rs_111# cat diff_startup
==== //depot/main/rs_111/usr.src/netscaler/linux_mgmt/bin/docker_startup.sh#13 - /root/ws1/rs_111/usr.src/netscaler/linux_mgmt/bin/docker_startup.sh ====
46,47c46,58
< cp /etc/hosts /tmp/hosts.new
< sed -i '/ip6-/d' /tmp/hosts.new
---
> python - <<END
> import socket
> with open("/etc/hosts", 'r') as hosts:
> with open("/tmp/hosts.new", "w") as hosts_new:
> for line in hosts:
> addr=line.split()[0:]
> try:
> socket.inet_aton(addr[0])
> hosts_new.write(line)
> except socket.error:
> print 'ignoring ' +str(addr)
> continue
> END
In BRANCH2-
root@e4c246bcbfe0:~/ws1/rs_111_56_SSP# patch usr.src/netscaler/linux_mgmt/bin/docker_startup.sh -i usr.src/netscaler/diff_startup
-o post.sh
patching file post.sh (read from usr.src/netscaler/linux_mgmt/bin/docker_startup.sh)
Hunk #1 succeeded at 48 (offset 2 lines).
root@e4c246bcbfe0:~/ws1/rs_111_56_SSP# diff post.sh usr.src/netscaler/linux_mgmt/bin/docker_startup.sh
48,60c48,49
< python - <<END
< import socket
< with open("/etc/hosts", 'r') as hosts:
< with open("/tmp/hosts.new", "w") as hosts_new:
< for line in hosts:
< addr=line.split()[0:]
< try:
< socket.inet_aton(addr[0])
< hosts_new.write(line)
< except socket.error:
< print 'ignoring ' +str(addr)
< continue
< END
---
> cp /etc/hosts /tmp/hosts.new
> sed -i '/ip6-/d' /tmp/hosts.new
Useful link:https://linuxacademy.com/blog/linux/introduction-using-diff-and-patch/
Personal experience