Hari Sekhon 5 years ago
commit d8154f99d8

@ -0,0 +1,85 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Sat Jul 1 00:06:15 2006 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
aterm*background: black
aterm*foreground: whitesmoke
aterm*geometry: 72x24
aterm*transparent: true
aterm*shading: 50
#Looks nice but slows things down too much
aterm*fading: 70
aterm*cursor: red
aterm*scrollBar: false
aterm*transpscrollbar:true
aterm*scrollBar_right:true
aterm*saveLines: 20000
aterm*jumpScroll: true
aterm*multiscroll: true
borderlessaterm*background: black
borderlessaterm*foreground: whitesmoke
borderlessaterm*geometry: 72x24
borderlessaterm*transparent: true
borderlessaterm*shading: 50
#Looks nice but slows things down too much
borderlessaterm*fading: 70
borderlessaterm*cursor: red
borderlessaterm*scrollBar: false
borderlessaterm*transpscrollbar:true
borderlessaterm*scrollBar_right:true
borderlessaterm*saveLines: 20000
borderlessaterm*jumpScroll: true
borderlessaterm*multiscroll: true
aterm80*background: black
aterm80*foreground: whitesmoke
aterm80*geometry: 80x24
aterm80*transparent: true
aterm80*shading: 50
aterm80*fading: 70
aterm80*cursor: red
aterm80*scrollBar: false
aterm80*transpscrollbar:true
aterm80*scrollBar_right:true
aterm80*saveLines: 20000
aterm80*jumpScroll: true
aterm80*multiscroll: true
borderlessaterm80*background: black
borderlessaterm80*foreground: whitesmoke
borderlessaterm80*geometry: 80x24
borderlessaterm80*transparent: true
borderlessaterm80*shading: 50
borderlessaterm80*fading: 70
borderlessaterm80*cursor: red
borderlessaterm80*scrollBar: false
borderlessaterm80*transpscrollbar:true
borderlessaterm80*scrollBar_right:true
borderlessaterm80*saveLines: 20000
borderlessaterm80*jumpScroll: true
borderlessaterm80*multiscroll: true
xterm*charClass: 33:48,37:48,45-47:48,38:48
xterm*background: black
xterm*foreground: white
xterm*geometry: 80x24
xterm*saveLines: 20000
xterm*jumpScroll: true
xterm*multiscroll: true
#xterm*highlightColor: LightSkyBlue
xterm*cursorColor: MediumBlue
xterm*pointerColor: MediumBlue
xterm*internalBorder: 3
xterm*scrollBar: false
xterm*rightScrollBar: false

@ -0,0 +1,9 @@
keycode 115 = Super_L
add Mod4 = Super_L
keycode 116 = Super_R
add Mod4 = Super_R
clear Mod1
keycode 66 = Alt_L
keycode 69 = Alt_R
add Mod1 = Alt_L
add Mod1 = Alt_R

@ -172,10 +172,14 @@ doc_alias(){
# docfile="$(readlink -f "$docpath")"
# fi
# fi
if type "d$docfile" &>/dev/null; then
echo "WARNING: d$docfile conflicts with existing alias, duplicate doc $docfile among ~/docs, ~/github/docs, ~/bitbucket/docs?"
return
fi
#local count=0
#[ -f ~/docs/$docfile ] && ((count+=1))
#[ -f "$github/docs/$docfile" ] && ((count+=1))
#[ -f "$bitbucket/docs/$docfile" ] && ((count+=1))
#if [ $count -gt 1 ]; then
# echo "WARNING: $docfile conflicts with existing alias, duplicate doc '$docfile' among ~/docs, ~/github/docs, ~/bitbucket/docs?"
# return
#fi
# shellcheck disable=SC2139,SC2140
alias "d$docfile"="\$EDITOR $docpath"
}

@ -458,7 +458,7 @@ gitdiff(){
revert_typechange(){
# want splitting to separate filenames
# shellcheck disable=SC2046
co $(git status --porcelain | awk '/^.T/{print $2}')
co $(git status --porcelain -s "${1:-.}" | awk '/^.T/{print $2}')
}
rm_untracked(){
@ -467,6 +467,6 @@ rm_untracked(){
for x in "${@:-}"; do
# want splitting to separate filenames
# shellcheck disable=SC2046
rm -v $(git status --porcelain setup | awk '/^??/{print $2}')
rm -v $(git status --porcelain -s "$x" | awk '/^??/{print $2}')
done
}

@ -67,6 +67,14 @@ for x in ~/bin/*; do
add_PATH "$x"
done
# do the same with MANPATH
#if [ -d ~/man ]; then
# MANPATH=~/man${MANPATH:-:}
# export MANPATH
#fi
# ============================================================================ #
# M y G i t H u b r e p o s
# ============================================================================ #

@ -0,0 +1,23 @@
#
# Author: Hari Sekhon
# Date: 2006-06-28 23:25:09 +0100 (Wed, 28 Jun 2006)
#
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
trap clear EXIT
# the default umask is set in /etc/login.defs
#umask 022
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#welcome
# from brew install bash-completion
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
#sudo setmixer -V pcm 100

@ -1,7 +1,7 @@
# vim:ts=2:sts=2:sw=2:et
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2019-09-13 17:02:47 +0100 (Fri, 13 Sep 2019)
# Date: 2015-10-31 19:04:34 +0000 (Sat, 31 Oct 2015)
#
# https://github.com/harisekhon/bash-tools
#
@ -13,35 +13,66 @@
# http://www.linkedin.com/in/harisekhon
#
# http://EditorConfig.org
# stop recursing upwards for other .editorconfig files
#root=true
root = true
# Unix-style newlines with a newline ending every file
[*]
indent_size = 4
indent_style = space
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.go]
indent_size = 4
indent_style = tab
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_size = 4
indent_style = tab
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 2
indent_style = space
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[.*]
indent_size = 4
indent_style = space
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
# ============================================================================ #
# Older Stuff, don't think I use this any more
# ============================================================================ #
# Matches multiple files with brace expansion notation
# Set default charset
#[*.{js,py}]
#charset = utf-8
# Indentation override for all JS under lib directory
#[lib/**.js]
#indent_style = space
#indent_size = 2
# Matches the exact files either package.json or .travis.yml
#[{package.json,.travis.yml}]
#indent_style = space
#indent_size = 2
#[*.xml]
#indent_style = space
#indent_size = 2

@ -1,12 +1,105 @@
#
# Author: Hari Sekhon
# Date: 2012-01-31 14:08:42 +0000 (Tue, 31 Jan 2012)
#
# configure your user name and email in ~/.gitconfig.local
#[user]
# name = Hari Sekhon
# email = harisekhon@gmail.com
[include]
path = .gitconfig.local
[core]
# detects filemode changes
filemode = true
# global .gitignore
excludesfile = ~/.gitignore
[push]
# default = current
default = simple
[alias]
br = branch
co = checkout
ci = commit
p = push
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
br = branch
co = checkout
ci = commit
p = push
st = status
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
unstage = reset HEAD --
last = log -1 HEAD
# how to use commands inside git aliases
visual = !gitk
df = diff
dc = diff --cached
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
# Show files ignored by git:
ign = ls-files -o -i --exclude-standard
[color]
ui = auto
diff = auto
grep = auto
# do not set always here, use:
# -c color.status=always
# for specific overrides, otherwise may break gitci and related functions
status = auto
branch = auto
[color "branch"]
current = green ul
local = yellow
remote = red # default
plain = white
[color "diff"]
new = green
old = red # default
plain = white
whitespace = yellow reverse
func = yellow
frag = cyan # default
meta = green bold # default
[color "grep"]
context = white
filename = cyan
function = yellow
linenumber = green
match = red
selected = yellow
separator = white
[color "status"]
added = magenta
changed = red
untracked = cyan
branch = magenta blink
nobranch = red blink
[help]
# dangerous this just autocorrected my git rename to git rebase, lucky it errored out...
autocorrect = 0
#[difftool "sourcetree"]
# cmd = opendiff \"$LOCAL\" \"$REMOTE\"
# path =
#
#[mergetool "sourcetree"]
# cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
# trustExitCode = true
#[filter "media"]
# clean = git media clean %f
# smudge = git media smudge %f
# required = true

335
.gitignore vendored

@ -1,4 +1,8 @@
# vim: filetype=conf
#
# Author: Hari Sekhon
# Date: 2012-06-24 22:03:34 +0000 (Sun, 24 Jun 2012)
#
# Once in a while you should check which files have been ignored via:
#
@ -6,8 +10,337 @@
#
# to check that there aren't some legit files you need to commit
pytools_checks/
*.avi
*.bak
*.bak.*
#*.bak.\d{4}-\d{2}-\d{1,2}_\d{2}-\d{2}-\d{2}
*.bin
*.bz2
*.class
*.dump
*.flv
*.gif
*.gz
*.jar
*.jpeg
*.jpg
*.kdb
*.lock
*.log
*.lzo
*.macports-saved_*
*.mp3
*.mp4
*.mpeg
*.mpg
*.o
*.out
*.orig
*.part
*.pyc
*.pyo
*.stdout
*.stderr
*.swo
*.swp
*.tar
*.tgz
*.tbz2
*.tmp
*.wmv
*.zip
*~
.activator/
.adobe
.agent.env
.aliaslists
.android/
.anyconnect
.ApacheDirectoryStudio/
.atftp_history
.audacious/accels
.audacious/log
.a
.audacious/playlist.xspf
.audacious/.thumbs
.bashrc_dynamichosts
.bashrc_dynamichosts.src
.bash_history
.bash_vars
.boot2docker/
.cache
.cassandra/
.cassandra/cqlshrc
.cassandra/cqlsh_history
.cassandra/nodetool_history
.cbq_history
.ccm/
.CFUserTextEncoding
.compiz
.conda/
.config
.cpan/build/
.cpan/FTPstats.yml
.cpan/histfile
.cpan/Metadata
.cpan/sources/
.cpanm
.cups/
.data
.dbshell
.dbus
.dcos/
.DCOPserver_*
.devcenter/.metadata/
.devcenter/DevCenter/.default/
.devcenter/DevCenter/.metadata/
.devcenter/logging/
.docker_vars
.docker/machine/
.dropbox/
.DS_Store
.dvdcss/
.erlang.cookie
.evolution
.fluxbox/backgrounds
.fluxbox/BEST
.fluxbox/best-styles/styles-backup
.fluxbox/DIVISION2
.fluxbox/fbrun_history
.fluxbox/lastwallpaper
.fluxbox/menu
.fluxbox/NOBG
.fluxbox/OTHERTHEMES
.fluxbox/startup.log
.fontconfig
.fseventsd
.gaim/accels
.gaim/icons
.gaim/status.xml
.gconf
.gconfd
.gem
.gimp-*
.gitk
.gmvault/
.gnome
.gnome2
.gnome2_private
.gnupg/gpg-agent-info-*
.gnupg/private-keys-*
.gnuplot_history
.gpg-agent.env
.gradle
.groovy
.gstreamer-*
.gvfs
.hg
.htoprc
.ICEauthority
.IdeaIC*
.idea
.inkscape-etc/
.ion3
.ipython/
.irb-save-history
.irb_history
.ivy2/
.jline-jython.history
.kde
.kodos
.kube/
.ldapvi_history
.lesshst
.links2
.local
.m2/
.macports/
.macromedia
.matplotlib/
.mcop
.mcoprc
.minikube/
.minishift/
.minishift.env
.mozilla
.mtools/
.mysql_history
.nbprofiler/
.neo4j_shell_history
.npm/
.octave_hist
.octave_hist$
.openoffice.org
.openoffice.org2
.oracle_jre_usage/
.ovftool.ssldb
.Qsync/
.parallel/
.pig_history
.pki
.psql_history
.pentaho/
.pulse
.puppet/
.pwm3
.PyCharm*/
.pylint.d
.python-eggs/
.qt
.qicon
.qnicon
.RData
.recently-used
.recently-used.xbel
.rediscli_history
.Rhistory
.rnd
.rstudio-desktop/
.sbt/boot/
.sbt/repositories
.sbt/*/plugins/project/target/
.sbt/*/plugins/target/
.scala_history
.sdkman/archives
.sdkman/bin
.sdkman/candidates
.sdkman/ext
.sdkman/src
.sdkman/tmp
.sdkman/var
.serverauth.*
.sh_history
.Skype
.spark_history
.Spotlight-*
.spumux/
.sqlite_history
.sqlline/history
.ssh/known_hosts
.ssh-agent.env
.subversion/auth
.svn
.swatch_script.*
.TemporaryItems
.themes
.thumbnails
.tilda/locks/*
.tomboy
.tomboy.log
.travis/
.Trash
.Trashes
.vagrant
.vagrant.d/
.vboxclient-autoresize.pid
.vboxclient-clipboard.pid
.vboxclient-seamless.pid
.vim/
.viminfo
.vnc/
.wapi
.wget-hsts
.wine
.wireshark-etc/
.wireshark/
.wmii-3.5
.Xauthority
.xine
.xmms
.xsession-errors
.zenmap-etc/pango/pangorc
abs-guide.pdf
android-sdks/
Applications/
AT.postflight.*
bin/altfirewalls
bin/altnames
bin/contrib/*
bin/desktops
bin/firewalls
bin/servers
bitbucket/
bitbucket/*
boxes/
Box Documents/
c
Calibre Library/
cli_junkie.gif
Desktop
Documents
Downloads
drive/
Dropbox/
eclipse/
enterprise
fluxbox-themes
fluxbox/debian007.jpg
github/
github/*
gitolite-admin/
gitroot/
GNUstep
Google*Drive
hadoop-sources/
hgroot/
IdeaProjects/
Images
infrastructure/puppetinfrastructure/
#jython*
Library
mbox
mcollective-plugins/
Movies
Music
norev
NS-GUISettings
ops/
original-tars
originals_tars
otherpics
Qsync/
Pictures
Public
puppet.git/
PycharmProjects/
pytools_checks/
rpms/
shm/
siege.log
Sites
subversion/
svnroot/
testing/
tmp.*
vagrant/basho_bench/
vagrant/id_rsa.pub
vagrant/jce_policy-6
vagrant/jython
vagrant/kibana/
vagrant/lib
vagrant/mrepo
vagrant/mx4j-*
vagrant/mysql-connector-*
vagrant/thrift-*
VirtualBox VMs/
VirtualBoxShared
visualvm*
windows/bin2
wordlists/*.lower
wordlists/hosts.large
wordlists/hosts.medium
wordlists/hosts.small
wordlists/pw.medium
wordlists/pw.small
wordlists/pw.tiny
wordlists/snmp
wordlists/ultimate.*
wordlists/users.large
wordlists/users.medium
wordlists/users.small
wordlists/users.tiny
wordlists/users.weighted
*#*#
*.doc
*.docx

@ -0,0 +1,21 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Mon Mar 24 15:22:28 2008 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
[mysql]
no-beep
reconnect
#safe-updates
secure-auth
show-warnings
#sigint-ignore

@ -0,0 +1,19 @@
#
# Author: Hari Sekhon
# Date: 2006-07-01 23:10:15 +0100 (Sat, 01 Jul 2006)
#
RCfile for "top with windows" # shameless braggin'
Id:a, Mode_altscr=1, Mode_irixps=1, Delay_time=3.000, Curwin=0
CPU fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX
winflags=65337, sortindx=10, maxtasks=0
summclr=2, msgsclr=6, headclr=2, taskclr=6
TIM fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=65337, sortindx=12, maxtasks=0
summclr=6, msgsclr=6, headclr=1, taskclr=1
MEM fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=65337, sortindx=14, maxtasks=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
USR fieldscur=AbdEcgfHIjlOPQrstuvyzMKNWX
winflags=65337, sortindx=7, maxtasks=0
summclr=3, msgsclr=3, headclr=2, taskclr=3

228
.vimrc

@ -1,22 +1,230 @@
"
" Author: Hari Sekhon
" Date: 2006-07-01 22:52:16 +0100 (Sat, 01 Jul 2006)
"
syn on
set ai
set et
set ts=4
set sw=4
set sts=4
set bg=dark
" ============================================================================ "
" show all settable option values and their values
"set all
set ai " autoindent
set bg=dark " background
set et " expandtab
set ic " ignorecase
set is " incsearch
"set list " visually displays eol, tabs etc so you can always see them
set ls=1 " laststatus. Status line 0=off, 1=multi-windows, 2=on
set listchars=tab:>-,eol:$,trail:.,extends:# " changes the list characters, makes tabs appear as >---
set ml " modeline. respect the vim: stuff at the stop of files. This doesn't seem to work for me
set mls=15 " modelines. Controls how many lines to check for modeline, systems often set this to 0,
set nocp " nocompatible
set nofen "nofoldenable
set nohls " nohlsearch
"set nu " number (column on left)
set ru " ruler
set sm " showmatch. show matching brackets {}
set scs " smartcase. switch to case sensitive match if uppercase letter is detected
set si " smartindent
set smd " showmode
set sta " smarttab - make "tab" insert indents instead of tabs at beginning of line
set sts=4 " softtabstop. changes tab key to 4 spaces wide. This is the one you need
set sw=4 " shiftwidth. number of spaces for indentation, should be the same as tabstop really to make tabs and Shift-> the same width
set ts=4 " tabstop
set tw=0 " textwidth (stops auto wrapping)
set viminfo='100,<1000,s10,h " save <1000 lines in the registers instead of <50 lines between files since otherwise I lose lots of lines when deleting and pasting between files
set wrap " line wrapping
" reload the buffer when file has changed but buffer has not (useful for go fmt from within vim)
set autoread
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
" add comment to next line when using 'o' in command mode
" add comment to next line when using Insert mode
set formatoptions+=or
" re-open at last cursor line
" ============================================================================ "
"behave mswin
be xterm
:if has("gui_running")
"colorscheme slate
colo slate
:endif
" ============================================================================ "
filetype plugin indent on
filetype plugin on
"filetype off
" shows what last set ts, ie .vimrc
":verbose set ts
" set scrollbind - in each window then windows will scroll together
" ============================================================================ "
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" re-open at last cursor line
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
autocmd BufReadPost *
\ if line ("'\"") > 0 && line ("'\"") <= line ("$") |
\ exe "normal! g`\"" |
\ endif
" auto-strip trailing whitespace on write
autocmd BufWritePre * %s/\s\+$//e
" highlight trailing whitespace
" XXX: doesn't work
"autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
" this works
autocmd Filetype * match Error /\s\+$/
au BufNewFile,BufRead Makefile set noet
au BufNewFile,BufRead LICENSE set tw=80
"au BufRead,BufNewFile perl set ts=4 st=4
"au BufRead,BufNewFile *.pl set ts=4 st=4
"au BufNew,BufRead *.pp set syntax=conf
" filetype is better than syntax since it figures out indentation and tab completion etc and the ruby is better than conf since it gives more syntax highlighting
au BufNew,BufRead *.pp set filetype=ruby sts=2 sw=2 ts=2
au BufNew,BufRead *.yml set sts=2 sw=2 ts=2
au BufNew,BufRead *.yaml set sts=2 sw=2 ts=2
"au BufNew,BufRead *.rb set filetype=ruby sts=2 sw=2 ts=2
" this will disable
"au BufNew,BufRead *.txt set ft=
au BufNew,BufRead *.txt hi def link confString NONE
augroup filetypedetect
au! BufRead,BufNewFile *.hta setfiletype html
augroup end
au BufNew,BufRead *.py nmap ;l :w<CR>:!clear; pylint % \| headtail.py<CR>
au BufNew,BufRead *.pl nmap ;l :w<CR>:!clear; perl -I . -tc %<CR>
au BufNew,BufRead *.go nmap ;l :w<CR>:!clear; go fmt %<CR><CR>
au BufNew,BufRead .bash*,*.sh,*.ksh nmap ;l :w<CR>:!clear; shellcheck -Calways % \| more -R<CR>
au BufNew,BufRead *.csv nmap ;l :w<CR>:!clear; validate_csv.py %<CR>
au BufNew,BufRead *.json nmap ;l :w<CR>:!clear; validate_json.py %<CR>
au BufNew,BufRead *.ini nmap ;l :w<CR>:!clear; validate_ini.py %; validate_ini2.py %<CR>
au BufNew,BufRead *.properties nmap ;l :w<CR>:!clear; validate_properties.py %<CR>
au BufNew,BufRead *.ldif nmap ;l :w<CR>:!clear; validate_ldap_ldif.py %<CR>
au BufNew,BufRead *.xml nmap ;l :w<CR>:!clear; validate_xml.py %<CR>
au BufNew,BufRead *.yml,*.yaml nmap ;l :w<CR>:!clear; validate_yaml.py %<CR>
" auto-strip trailing whitespace on write
autocmd BufWritePre * %s/\s\+$//e
endif
" ============================================================================ "
"nmap <silent> ;c :call Cformat()<CR>
nmap <silent> ;c :,!center.py<CR>
nmap <silent> ;e :,!center.py -s<CR>
nmap <silent> ;d :r !date '+\%F \%T \%z (\%a, \%d \%b \%Y)'<CR>kJ
nmap <silent> ;D :Done<CR>
nmap ;f :,!fold -w 120 -s \| sed 's/[[:space:]]*$//'<CR>
"nmap <silent> ;h :call Hr()<CR>
nmap <silent> ;h :Hr<CR>
" this inserts Hr literally
"imap <silent> <C-H> :Hr<CR>
nmap <silent> ;j :JHr<CR>
"nmap <silent> ;' :call Sq()<CR>
nmap <silent> ;' :call StripTrailingWhiteSpace()<CR>
nmap ;n :n<CR>
nmap ;p :prev<CR>
nmap ;q :q<CR>
nmap ;r :call WriteRun()<CR>
"nmap <silent> ;s :call ToggleSyntax()<CR>
nmap <silent> ;s :,!sqlcase.pl<CR>
nmap ;u :call HgGitU()<CR>
nmap ;; :call HgGitU()<CR>
nmap ;w :w<CR>
"nmap ;x :x<CR>
" ============================================================================ "
function! ToggleSyntax()
if exists("g:syntax_on")
syntax off
else
syntax enable
endif
endfunction
":command Hr :normal i # ============================================================================ #<ESC>lx
:command Hr :normal a# <ESC>76a=<ESC>a #<ESC>
":function Hr()
":s/^/# ============================================================================ #/
"if b:current_syntax eq "sql"
" ::normal a-- <ESC>74a=<ESC>a --<ESC>
"else
":normal a# <ESC>76a=<ESC>a #<ESC>
"endif
":endfunction
":function Br()
":call Hr()
":endfunction
:command Br :Hr
"function JHr()
" s,^,// ========================================================================== //,
"endfunction
":command JHr :normal a// ========================================================================== //<ESC>lx
:command JHr :normal a// <ESC>74a=<ESC>a //<ESC>
:command Done :normal 37a=<ESC>a DONE <ESC>37a=<ESC>
":function RemoveIPs()
" : %s/\d\+\.\d\+\.\d\+\.\d\+/<IP_REMOVED>/gc
":endfunction
"
":function RemoveMacs()
" : %s/\w\w:\w\w:\w\w:\w\w:\w\w:\w\w/<MAC_REMOVED>/gc
":endfunction
"
":function RemoveDomains()
" : %s/company1/<DOMAIN_REMOVED>/gci
" : %s/company2/<DOMAIN_REMOVED>/gci
":endfunction
function Scrub()
": call RemoveIPs()
": call RemoveMacs()
": call RemoveDomains()
:%!anonymize.py --all
endfunction
" StripQuotes()
function Sq()
:s/["']//g
endfunction
function StripTrailingWhiteSpace()
:%s/[[:space:]]*$//
endfunction
function WriteRun()
:w
:!./%
" TODO: if .go then 'go run %'
endfunction
" ============================================================================ "
" either works, requires expand()
"let MYLOCALVIMRC = "~/.vimrc.local"
"let MYLOCALVIMRC = "$HOME/.vimrc.local"

@ -20,8 +20,12 @@ CONF_FILES := \
.editorconfig \
.gitconfig \
.gitignore \
.my.cnf \
.toprc \
.tmux.conf \
.vimrc
.vimrc \
.Xdefaults \
.Xmodmap
include Makefile.in
@ -31,12 +35,13 @@ build: system-packages
:
install:
@setup/setup_bash.sh
@echo "linking dot files to \$$HOME directory: $$HOME"
@if grep -Eq "(source|\.).+$${PWD##*/}/.bashrc" ~/.bashrc 2>/dev/null; then echo "already sourced in ~/.bashrc"; else echo "source $$PWD/.bashrc" >> ~/.bashrc; fi
@f=""; [ -n "$$FORCE" ] && f="-f"; \
for filename in $(CONF_FILES); do \
test -f "$$HOME/$$filename" || ln -sv $$f "$$PWD/$$filename" ~; \
done
ln -sv $$f "$$PWD/$$filename" ~ 2>/dev/null; \
done || :
@ln -sv $$f ~/.gitignore ~/.gitignore_global 2>/dev/null || :
.PHONY: test
test:

@ -20,6 +20,8 @@ endif
export PATH := $(PATH):/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
CODE_FILES := $(shell git ls-files)
CPANM = cpanm
SUDO := sudo

@ -1,6 +1,105 @@
#
# Author: Hari Sekhon
# Date: 2011-06-01 16:58:33 +0000 (Wed, 01 Jun 2011)
#
# Things to install by hand
# RStudio
# Sophos Anti-Virus
# ClamXav
# Chrome
# Colloquay
# GitHub
# Google Drive
# JConsole
# KeePassX
# Reggy
# Remote Desktop Connection
# Skype
# SourceTree
# Spotify
# Sublime Text 2
# SynergyOSX
# TunnelBlick
# VLC
# WindowWrangler?
# Wireshark
# YouTube
# iPhone Explorer
# iTerm?
# brew cask install minikube
# brew cask install minishift
# brew cask install podman
# Install HomeBrew Desktop packages - one per line
bash-completion
cmatrix
colordiff
coreutils
csshx
diffpdf
dnsmasq
dnstop
e2fsprogs
etcd
ffmpeg
git
gnu-sed
gnupg2
gnuplot
gradle
# runtime only
#groovy
# GDK - use SDKMan instead
#groovysdk
imagemagick
ipcalc
haproxy
iperf
ipython
jq
# no longer available
#jwhois
kompose
kubectl
kubernetes-cli
lynx
md5sha1sum
mercurial
midnight-commander
minikube
minishift
mplayer
mtr
mysql
octave
openssl
p7zip
parallel
parquet-tools
pinentry
postgresql
pwgen
python
r
rdesktop
readline
snappy
sqlite
thrift
tmux
# done by SDKMan now
#maven
#sbt
#scala
watch
wget
whois
xz
yamllint
# automake
# autoconf
# Mac already supplies a libtool, so this gets prefixed with a 'g'
# libtool
ipython
parquet-tools

@ -0,0 +1,25 @@
#
# Author: Hari Sekhon
# Date: 2013-02-18 10:48:12 +0000 (Mon, 18 Feb 2013)
#
# vim:ts=4:sw=4:et
DBD::mysql
IO::Socket::SSL
JSON
JSON::XS
LWP::Simple
LWP::UserAgent
Mail::IMAPClient
Net::DNS
Net::SSH::Expect
Test::Kwalitee
Net::SSLeay
SMS::AQL
Text::More
Text::Unidecode
Thrift::BinaryProtocol
Thrift::BufferedTransport
Thrift::Socket
URI::Escape
XML::Simple

@ -0,0 +1,325 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Sat Apr 7 13:23:57 2007 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Deb desktop packages - one per line
#mwcollect
#nessus
#PEAR-PHP_Shell
acpitool
adtool
air
airsnort
alsa-utils
aosd-cat
app-dicts/dictd-dicts
app-vim/perl-support
apt-file
apt-spy
arpd
arping
arptables
arpwatch
at
aterm
atftpd
audacious
autocutsel
azureus
bash-completion
bastille
biew
bittorrent
bonnie++
bridge-utils
btscanner
bum
catdoc
ccrypt
chkrootkit
chntpw
cksfv
clusterssh
cmospwd
conky
cowsay
cryptcat
csync2
curl
cvs
davl
ddrescue
debootstrap
debsecan
denyhosts
dev-libs/geoip
dev-perl/net-ssh-perl
dev-perl/perltidy
dhcping
dia
dialog
dnspython
dnstop
dnstracer
dosfstools
drbd
driftnet
dsniff
dynagen
dynamips
e2fsprogs
emacs
eterm
eterm-themes
etherape
ethstatus
ethtool
ettercap-gtk
evince
fcrackzip
figlet
filelight
fluxbox
foremost
fortune-mod
fping
ftp
gaim
games-misc/fortune-mod
gcc
gdb
gdm
gdm-themes
gftp
gimp
git
git-core
gitk
gkrellm
gksu
gnupg
gnupg-agent
gparted
gpm
grub
gt5
gvim
harden-doc
heartbeat
hexedit
honeyd
hostapd
hping2
hping3
htop
httping
hunt
iceweasel
ifstat
ike-scan
incron
iozone
ipcalc
ipmitool
iptables
iptraf
ipython
irssi
jedit
jhead
kde
khexedit
kismet
kodos
kolourpaint
ksh
kvirc
labrea
ldap-utils
ldapscripts
ldapvi
libc6-dev
liblist-allutils-perl
liblist-moreutils-perl
libnet-cidr-perl
libnet-netmask-perl
libperl-critic-perl
libssl-dev
links
linux-gazette-all
logrotate
logwatch
lokkit
lsat
lshw
lsof
lsscsi
luma
lvm2
lynx
m4
macchanger
magicrescue
mailx
mboxgrep
mc
mdadm
memdump
mercurial
most
mp3info
mtr
multitail
nagios-nrpe-plugin
nagios-plugins
nasm
nbd-client
nbd-server
nbtscan
ncftp
nemesis
nepenthes
net-snmp
net-tools
netbeans
netcat
netdiscover
netperf
netsed
netselect
netselect-apt
nfs-kernel-server
nfs-utils
ngrep
nikto
nmap
ntfs3g
ntop
ntp
ntpdate
openipmi
openldap
openssh-server
openvpn
openvpn-blacklist
p0f
paketto
parted
pasco
pastebinit
pciutils
perl-doc
php5-cli
phrack-all
pidgin
pidgin-sipe
pinentry-gtk
piozone
pound
psh
pssh
pv
pwgen
pychecker
pydns
pyflakes
pygobject
pylint
python-doc
rancid
rancid-cgi
rancid-core
rancid-utils
rats
rdesktop
root-tail
router-audit-tool
rsync
sbd
scanlogd
scanssh
screen
sec
secure-delete
sguil-client
sguil-sensor
sguil-server
siege
sipcalc
slay
sleuthkit
slocate
slurm
smb4k
snortsam
splint
squid
squid-graph
ssmtp
steghide
strace
stunnel
subversion
sucrack
sudo
sun-java6-plugin
swatch
sys-apps/ack
syslog-ng
sysstat
sysv-rc-conf
tcpdump
tcptrack
tct
tftp
tftpd
tilda
toilet
tomboy
traceroute
tshark
unzip
usbutils
vim-full
virt-manager
vlc
vnc4server
win32codecs
wine
wipe
wireless-tools
wireshark
wmaker
wmaker-data
wmctrl
wpasupplicant
x86info
xbattbar-acpi
xchat
xclip
xdotool
xfce4-artwork
xine-ui
xkbset
xosd-bin
xosview
xpdf
xprobe
xscreensaver
xsel
xserver-xorg
xterm
zenity
zip
zsh

@ -0,0 +1,7 @@
#
# Author: Hari Sekhon
# Date: 2013-02-18 10:47:57 +0000 (Mon, 18 Feb 2013)
#
# vim:ts=4:sw=4:et
jgrep

@ -0,0 +1,17 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2019-09-06 17:09:33 +0100 (Fri, 06 Sep 2019)
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# List of Golang software to install via 'go get -u', one per line
github.com/rakyll/hey

@ -3,8 +3,10 @@
#
# Author: Hari Sekhon
# Date: 2019-02-17 11:11:52 +0000 (Sun, 17 Feb 2019)
# 2013-07-17 21:27:25 +0100 (Wed, 17 Jul 2013)
# (found older version)
# 2012-06-25 15:20:39 +0100
# (originally an alias in .bashrc)
# (originally an alias in .bashrc)
#
# https://github.com/harisekhon/bash-tools
#

@ -0,0 +1,25 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Wed Feb 3 16:44:26 2016 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
PyInstaller
autopep8
#avro
beautifulsoup4
#hadoopy
kazoo
nose
pyflakes
#pymongo
pytest
requests

@ -0,0 +1,445 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Tue Oct 17 20:25:14 2006 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Gentoo Portage packages to install - one per line
# hal dep required for network manager and is hal masked, review this
# openvas is masked, review this
#arptables
#bastille
#ksh
#metasploit
#mwcollect
#nessus
#networkmanager
#noscript
#openvas
#xsupplicant
acct
acpi
acpitool
acroread
adtool
air
airsnort
alsa-utils
apachetop
app-admin/analog
app-dicts/dictd-dicts
app-emacs/gentoo-syntax
app-vim/gentoo-syntax
app-vim/perl-support
argus
arp-sk
arpd
arping
arpoison
arptools
arpwatch
aspell
at
atftpd
audacious
audacious-plugins
audacious-themes
audit
authforce
autobook
autocutsel
autopsy
axel
baghira
bash-completion
bcrypt
bcwipe
biew
bind-tools
bitchx
bittorrent
bonnie++
bridge-utils
catdoc
ccrypt
cfengine
cfengine-syntax
chkrootkit
chntpw
cksfv
clusterssh
cmospwd
commonbox-styles
commonbox-styles-extra
conky
cowsay
cracklib-words
cryptcat
csync2
ctypes
curl
cvs
d4x
davl
dcfldd
dclock
dd-rescue
ddrescue
debootstrap
denyhosts
dev-libs/geoip
dev-perl/List-MoreUtils
dev-perl/Net-Netmask
dev-perl/net-ssh-perl
dev-perl/Perl-Critic
dev-perl/perltidy
dev-util/git
dhcpd-syntax
dhcping
dia
dialog
dictd
djbdns-man
dnspython
dnstop
dnstracer
dnswalk
dosdetector
dosfstools
drbd
driftnet
dsniff
dynagen
dynamips
e2fsprogs
emacs
eterm
eterm-themes
etherape
ethstatus
ethtool
ettercap
evince
figlet
filelight
firewalk
fluxbox
fluxbox-styles-fluxmod
fluxbox-syntax
foremost
fortune-mod
fping
fragroute
ftp
games-misc/fortune-mod
gdb
gdm
gdm-themes
gentoo-artwork
gentoo-artwork-livecd
gentoo-bashcomp
gentoo-xcursors
gentoolkit
gftp
gimp
git
git-core
gitk
gkrellm
gksu
glsof
gnu-netcat
gnupg
gparted
gpm
grdesktop
grub
gspoof
gt5
gvim
gxmessage
heartbeat
hexedit
honeyd
hostapd
hping
html2text
htop
httperf
httping
httrack
hunt
hydra
ifstat
iftop
ike-scan
imagemagick
incron
iozone
ip-sentinel
ipcalc
iperf
ipmitool
ipsorcery
iptables
iptraf
iputils
ipython
irssi
jad-bin
jedit
jhead
johntheripper
k3b
kde
khexedit
kismet
knock
kodos
krdc
kuake
kuroo
kvirc
labrea
libextractor
linkchecker
linklint
links
linux-kernel-in-a-nutshell
logrotate
logsurfer+
logwatch
lsat
lshw
lsof
lsscsi
luma
lvm2
lynx
m4
mac-robber
macchanger
magicrescue
mailx
mboxgrep
mc
md5deep
mdadm
mdcrack
memdump
mercurial
most
mount-cifs
mozilla-firefox-bin
mozilla-thunderbird-bin
mp3info
mplayer
mtr
multitail
mysql-gui-tools
nagios-plugins
nagios-syntax
nasm
nbaudit
nbd
nbtscan
ncftp
nemesis
nepenthes
net-analyzer/amap
Net-CIDR
net-im/psi
Net-RawIP
net-snmp
net-tools
netbeans
netcat
netdiscover
nethogs
netkit-telnetd
netperf
netscape-flash
netsed
netselect
nettop
nfs-kernel-server
nfs-utils
ngrep
nikto
nipper
nmap
nmbscan
nsat
ntfs3g
ntfsprogs
ntop
ntp
ntp-syntax
openipmi
openldap
openssh
openvpn
openvpn-blacklist
ophcrack
p0f
packETH
packit
paketto
pam-syntax
pam_usb
paros
parted
pasco
pastebinit
pciutils
PEAR-PHP_Shell
perl-doc
pidgin
pidgin-sipe
pinentry
piozone
pipebench
pipeworks
pkcrack
portsentry
pound
pscan
psh
psi-themes
pssh
pv
pwgen
pychecker
pydns
pyflakes
pygobject
pylint
qtparted
rainbowcrack
rancid
rancid-cgi
rancid-core
rancid-utils
rar
rats
rdesktop
redhat-artwork
rkhunter
root-tail
router-audit-tool
rsync
samba
sbd
scanlogd
scanssh
screen
sec
secure-delete
sguil-client
sguil-sensor
sguil-server
sharutils
siege
sipcalc
sleuthkit
slocate
slurm
smartmontools
smb4k
snort
snortsam
SOAP-Lite
socat
splint
squid
squid-graph
sshfs-fuse
ssmtp
steghide
strace
stunnel
subversion
sudo
swatch
sys-apps/ack
sys-fs/fuse
syslog-ng
sysstat
tcpdump
tcpreplay
tcpslice
tcptrack
tct
tenshi
tftp
tftpd
thcrut
tilda
toilet
tomboy
traceroute
trafshow
truecrypt
tsclient
tshark
twill
twisted
unrar
unzip
upnpscan
usbutils
usbview
vim
virt-manager
vixie-cron
vlock
vmware-player
vnc
vncsnapshot
webfuzzer
weblint
webscarab
whoischk
win32codecs
wine
wipe
wireless-tools
wireshark
wmaker
wmaker-data
wmctrl
x11-terms/aterm
x86info
xchat
xclip
xdotool
xev
xfe
xine-ui
xkbset
xlsclients
xorg-x11
xosd
xosview
xprobe
xrefresh
xrestop
xrootconsole
xscreensaver
xsel
xterm
xvid
yakuake
yersinia
zenity
zip
zsh

@ -0,0 +1,46 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Fri Oct 20 16:44:03 2006 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Gentoo Portage packages to install - one per line
asmon
mountapp
wmbio
wmblob
wmbutton
wmclockmon
wmcpuload
wmcube
wmdots
wmdiskmon
wmdrawer
wmfire
wmfsm
wmhdplop
wmifinfo
wminet
wmix
wmlongrun
wmMatrix
wmmemmon
wmmisc
wmmon
wmnd
wmnetload
wmnetmon
wmpiki
wmpower
wmtop
wmwave
xscreensaver-app

@ -0,0 +1,86 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Tue Oct 17 20:25:14 2006 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Gentoo Portage packages to install - one per line
abs-guide
alien
app-misc/beagle
bar
bing
bittorrent
bwmon
cherrypy
ckermit
cmospwd
cutecom
djbdns
echoping
flasm
ganglia
hdparm
htdig
htmltidy
gnome-power-manager
krusader
iplog
ipython
iptstate
isic
kchmviewer
kolourpaint
linpopup
linux-docs
linux-gazette-all
linux-logo
logsentry
makepasswd
mbrowse
minicom
mp3_check
ndiswrapper
net-mail/imapsync
netwag
netwox
opera
pbnj
pflogsumm
phrack-all
porthole
powertop
rain
raccess
seamonkey
siphon
smokeping
sniffit
ssldump
sslwrap
tmpwatch
valgrind
watchpid
webalizer
webmin
whowatch
windowmaker
x11-themes/windowmaker-themes
wmctrl
xbatt
xbattbar
xchm
xconsole
xdiskusage
xpdf
xpenguins
xsimpsons

@ -0,0 +1,41 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Tue May 27 20:29:57 2008 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Gentoo Portage packages to install - one per line
app-emacs/gentoo-syntax
app-vim/gentoo-syntax
at
bash-completion
bind-tools
denyhosts
e2fsprogs
ethtool
gentoolkit
lsof
mailx
ntp
ntp-syntax
openssh
pam-syntax
pciutils
portsentry
scanlogd
slocate
sudo
syslog-ng
traceroute
usbutils
vim
vixie-cron

@ -0,0 +1,192 @@
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: Tue Mar 18 21:20:52 2008 +0000
#
# https://github.com/harisekhon/devops-bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# RPM desktop packages - one per line
#mwcollect
acpi
acpitool
air
airsnort
alsa-utils
app-dicts/dictd-dicts
app-vim/perl-support
arpd
arpwatch
aterm
atftpd
autocutsel
bash-completion
bittorrent
bridge-utils
catdoc
chntpw
clusterssh
cmospwd
cowsay
csync2
cvs
davl
debootstrap
denyhosts
dev-perl/Net-Netmask
dev-perl/net-ssh-perl
dev-perl/Perl-Critic
dev-perl/perltidy
dia
dialog
dnspython
drbd
dsniff
dynagen
dynamips
emacs
eterm-themes
ettercap-gtk
evince
figlet
filelight
fluxbox
foremost
fortune-mod
games-misc/fortune-mod
gcc
gdb
geoip
git
git-core
gitk
gkrellm
gksu
gt5
gvim
heartbeat
hexedit
honeyd
hostapd
incron
iozone
ipcalc
ipmitool
iptraf
ipython
irssi
jedit
jhead
kdebase
kdenetwork
khexedit
kodos
ksh
kubernetes-client
kvirc
lshw
lsscsi
luma
lvm2
m4
magicrescue
man
man-pages
mboxgrep
mdadm
memdump
mercurial
mp3info
mysql
MySQL-python
mysql-server
mytop
nagios-plugins
nagios-plugins-mysql
nasm
nbd
nbtscan
nc
nepenthes
Net-CIDR
net-snmp
netbeans
netperf
netselect
nfs-kernel-server
nfs-utils
nmap
ntfs3g
openipmi
openldap
openvpn
openvpn-blacklist
paketto
pasco
pastebinit
pdfgrep
PEAR-PHP_Shell
perl-doc
pidgin
pidgin-sipe
piozone
pound
psh
pssh
pv
pydns
pygobject
pylint
rancid
rancid-cgi
rancid-core
rancid-utils
rdesktop
router-audit-tool
rpm-build
rpmlint
sbd
screen
sguil-client
sguil-sensor
sguil-server
sipcalc
slurm
snort
snortsam
squid
squid-graph
strace
subversion
sys-apps/ack
tftp
tftpd
tilda
toilet
tomboy
tshark
virt-manager
vlc
vnc
win32codecs
wine
wireshark
wmaker
wmaker-data
wmctrl
x86info
xclip
xdotool
xkbset
xosview
xprobe
xsel
xterm
zenity

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2019-09-18 23:21:50 +0100 (Wed, 18 Sep 2019)
#
# https://github.com/harisekhon/bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Checks if .bashrc and .bash_profile are sourced, otherwise injects source lines in to the $HOME directory equivalents
set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
setup_file(){
local filename="$1"
if grep -Eq "(source|\.).+$srcdir/$filename" ~/"$filename" 2>/dev/null; then
echo "$filename already sourced in ~/$filename"
else
echo "injecting into ~/$filename: source $srcdir/$filename"
echo "source $srcdir/$filename" >> ~/"$filename"
fi
}
setup_file .bashrc
setup_file .bash_profile
Loading…
Cancel
Save