-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile
90 lines (79 loc) · 2.24 KB
/
profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
###############################################
# Default editor
export EDITOR="vim"
# History enhanced GaboFDC
export HISTTIMEFORMAT="[%F %T] "
export HISTFILESIZE=
export HISTSIZE=
export HISTCONTROL=ignoredups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Nice prompt
PS1='\[\e]0;\u@\h: \W\a\] \[\033[0;31m\]\t\[\033[0m\] \[\033[0;36m\] [\u@\h]\[\033[0m\]\[\033[0;34m\] \w \[\033[0m\] \$ '
# Proper pager
export PAGER=less
export LESS="-iMSx4 -FX"
###############################################
##### Alias enhanced GaboFDC
# shellcheck source=/dev/null
source /etc/os-release
### General
alias ls='ls --color'
alias ll="ls -lhA"
alias lll='ls -lhatr'
alias diff='vimdiff'
alias yum='sudo yum'
alias dnf='sudo dnf'
alias grep='egrep --color'
alias pgrep='\grep --color -P'
alias df='df -h -x squashfs'
alias ports='netstat -tupanl'
alias fastping='ping -c 100 -s.2'
#alias ipcalc='/opt/ipcalc-0.41/ipcalc'
# Miss type
alias grpe='grep'
alias les='less'
alias sduo='sudo'
# Parenting changing perms on / #
alias rsync='rsync -rav --progress --stats'
alias myip='curl ifconfig.co'
function hhistory {
history |awk -F']' '{print $2}' |uniq
}
function stats {
history | awk '{CMD[$4]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -n
}
function ms {
date -d @$( echo "($1 + 500) / 1000" | bc)
}
# Devel
alias tf='terraform'
alias pireq='pip install -r requirements.txt'
alias nenv='python3 -m venv .env'
alias aenv='source .env/bin/activate'
alias cdkfile='cdk synth > template-$(date +%F-%T).yml'
cdkdeploy(){
cdk diff "$@"
echo
read -rp "continue (y/N)"
if [[ $REPLY =~ ^[Yy]$ ]]; then
cdk deploy "$@"
fi
}
### MAC
if [ "$ID" == "mac" ]; then # Review
alias ls='ls -G'
alias ip='ifconfig -a'
alias flushdns='sudo dscacheutil -flushcache'
fi
### Ubuntu
if [ "$ID" == "ubuntu" ]; then # Review
alias pip='pip3'
alias apt='sudo apt'
alias yum='sudo apt-get'
alias dnf='sudo apt-get'
alias apt-get='sudo apt-get'
fi